fcoe.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright(c) 2009 Intel Corporation. All rights reserved.
  4. *
  5. * Maintained at www.Open-FCoE.org
  6. */
  7. #ifndef _FCOE_H_
  8. #define _FCOE_H_
  9. #include <linux/skbuff.h>
  10. #include <linux/kthread.h>
  11. #define FCOE_MAX_QUEUE_DEPTH 256
  12. #define FCOE_MIN_QUEUE_DEPTH 32
  13. #define FCOE_WORD_TO_BYTE 4
  14. #define FCOE_VERSION "0.1"
  15. #define FCOE_NAME "fcoe"
  16. #define FCOE_VENDOR "Open-FCoE.org"
  17. #define FCOE_MAX_LUN 0xFFFF
  18. #define FCOE_MAX_FCP_TARGET 256
  19. #define FCOE_MAX_OUTSTANDING_COMMANDS 1024
  20. #define FCOE_MIN_XID 0x0000 /* the min xid supported by fcoe_sw */
  21. #define FCOE_MAX_XID 0x0FFF /* the max xid supported by fcoe_sw */
  22. extern unsigned int fcoe_debug_logging;
  23. #define FCOE_LOGGING 0x01 /* General logging, not categorized */
  24. #define FCOE_NETDEV_LOGGING 0x02 /* Netdevice logging */
  25. #define FCOE_CHECK_LOGGING(LEVEL, CMD) \
  26. do { \
  27. if (unlikely(fcoe_debug_logging & LEVEL)) \
  28. do { \
  29. CMD; \
  30. } while (0); \
  31. } while (0)
  32. #define FCOE_DBG(fmt, args...) \
  33. FCOE_CHECK_LOGGING(FCOE_LOGGING, \
  34. pr_info("fcoe: " fmt, ##args);)
  35. #define FCOE_NETDEV_DBG(netdev, fmt, args...) \
  36. FCOE_CHECK_LOGGING(FCOE_NETDEV_LOGGING, \
  37. pr_info("fcoe: %s: " fmt, \
  38. netdev->name, ##args);)
  39. /**
  40. * struct fcoe_interface - A FCoE interface
  41. * @list: Handle for a list of FCoE interfaces
  42. * @netdev: The associated net device
  43. * @fcoe_packet_type: FCoE packet type
  44. * @fip_packet_type: FIP packet type
  45. * @oem: The offload exchange manager for all local port
  46. * instances associated with this port
  47. * @removed: Indicates fcoe interface removed from net device
  48. * @priority: Priority for the FCoE packet (DCB)
  49. * This structure is 1:1 with a net device.
  50. */
  51. struct fcoe_interface {
  52. struct list_head list;
  53. struct net_device *netdev;
  54. struct net_device *realdev;
  55. struct packet_type fcoe_packet_type;
  56. struct packet_type fip_packet_type;
  57. struct packet_type fip_vlan_packet_type;
  58. struct fc_exch_mgr *oem;
  59. u8 removed;
  60. u8 priority;
  61. };
  62. #define fcoe_to_ctlr(x) \
  63. (struct fcoe_ctlr *)(((struct fcoe_ctlr *)(x)) - 1)
  64. #define fcoe_from_ctlr(x) \
  65. ((struct fcoe_interface *)((x) + 1))
  66. /**
  67. * fcoe_netdev() - Return the net device associated with a local port
  68. * @lport: The local port to get the net device from
  69. */
  70. static inline struct net_device *fcoe_netdev(const struct fc_lport *lport)
  71. {
  72. return ((struct fcoe_interface *)
  73. ((struct fcoe_port *)lport_priv(lport))->priv)->netdev;
  74. }
  75. #endif /* _FCOE_H_ */