cna.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * Linux network driver for Brocade Converged Network Adapter.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of the GNU General Public License (GPL) Version 2 as
  6. * published by the Free Software Foundation
  7. *
  8. * This program is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. * General Public License for more details.
  12. */
  13. /*
  14. * Copyright (c) 2006-2010 Brocade Communications Systems, Inc.
  15. * All rights reserved
  16. * www.brocade.com
  17. */
  18. #ifndef __CNA_H__
  19. #define __CNA_H__
  20. #include <linux/version.h>
  21. #include <linux/kernel.h>
  22. #include <linux/types.h>
  23. #include <linux/pci.h>
  24. #include <linux/delay.h>
  25. #include <linux/bitops.h>
  26. #include <linux/timer.h>
  27. #include <linux/interrupt.h>
  28. #include <linux/if_ether.h>
  29. #include <asm/page.h>
  30. #include <asm/io.h>
  31. #include <asm/string.h>
  32. #include <linux/list.h>
  33. #define bfa_sm_fault(__mod, __event) do { \
  34. pr_err("SM Assertion failure: %s: %d: event = %d", __FILE__, __LINE__, \
  35. __event); \
  36. } while (0)
  37. extern char bfa_version[];
  38. #define CNA_FW_FILE_CT "ctfw_cna.bin"
  39. #define FC_SYMNAME_MAX 256 /*!< max name server symbolic name size */
  40. #pragma pack(1)
  41. #define MAC_ADDRLEN (6)
  42. typedef struct mac { u8 mac[MAC_ADDRLEN]; } mac_t;
  43. #pragma pack()
  44. #define bfa_q_first(_q) ((void *)(((struct list_head *) (_q))->next))
  45. #define bfa_q_next(_qe) (((struct list_head *) (_qe))->next)
  46. #define bfa_q_prev(_qe) (((struct list_head *) (_qe))->prev)
  47. /*
  48. * bfa_q_qe_init - to initialize a queue element
  49. */
  50. #define bfa_q_qe_init(_qe) { \
  51. bfa_q_next(_qe) = (struct list_head *) NULL; \
  52. bfa_q_prev(_qe) = (struct list_head *) NULL; \
  53. }
  54. /*
  55. * bfa_q_deq - dequeue an element from head of the queue
  56. */
  57. #define bfa_q_deq(_q, _qe) { \
  58. if (!list_empty(_q)) { \
  59. (*((struct list_head **) (_qe))) = bfa_q_next(_q); \
  60. bfa_q_prev(bfa_q_next(*((struct list_head **) _qe))) = \
  61. (struct list_head *) (_q); \
  62. bfa_q_next(_q) = bfa_q_next(*((struct list_head **) _qe)); \
  63. bfa_q_qe_init(*((struct list_head **) _qe)); \
  64. } else { \
  65. *((struct list_head **) (_qe)) = (struct list_head *) NULL; \
  66. } \
  67. }
  68. #endif /* __CNA_H__ */