Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright(c) 2009 Intel Corporation. All rights reserved.
0004  *
0005  * Maintained at www.Open-FCoE.org
0006  */
0007 
0008 #ifndef _FCOE_H_
0009 #define _FCOE_H_
0010 
0011 #include <linux/skbuff.h>
0012 #include <linux/kthread.h>
0013 
0014 #define FCOE_MAX_QUEUE_DEPTH    256
0015 #define FCOE_MIN_QUEUE_DEPTH    32
0016 
0017 #define FCOE_WORD_TO_BYTE   4
0018 
0019 #define FCOE_VERSION    "0.1"
0020 #define FCOE_NAME   "fcoe"
0021 #define FCOE_VENDOR "Open-FCoE.org"
0022 
0023 #define FCOE_MAX_LUN        0xFFFF
0024 #define FCOE_MAX_FCP_TARGET 256
0025 
0026 #define FCOE_MAX_OUTSTANDING_COMMANDS   1024
0027 
0028 #define FCOE_MIN_XID        0x0000  /* the min xid supported by fcoe_sw */
0029 #define FCOE_MAX_XID        0x0FFF  /* the max xid supported by fcoe_sw */
0030 
0031 extern unsigned int fcoe_debug_logging;
0032 
0033 #define FCOE_LOGGING        0x01 /* General logging, not categorized */
0034 #define FCOE_NETDEV_LOGGING 0x02 /* Netdevice logging */
0035 
0036 #define FCOE_CHECK_LOGGING(LEVEL, CMD)                  \
0037 do {                                                                \
0038     if (unlikely(fcoe_debug_logging & LEVEL))           \
0039         do {                            \
0040             CMD;                        \
0041         } while (0);                        \
0042 } while (0)
0043 
0044 #define FCOE_DBG(fmt, args...)                      \
0045     FCOE_CHECK_LOGGING(FCOE_LOGGING,                \
0046                pr_info("fcoe: " fmt, ##args);)
0047 
0048 #define FCOE_NETDEV_DBG(netdev, fmt, args...)           \
0049     FCOE_CHECK_LOGGING(FCOE_NETDEV_LOGGING,         \
0050                pr_info("fcoe: %s: " fmt,        \
0051                    netdev->name, ##args);)
0052 
0053 /**
0054  * struct fcoe_interface - A FCoE interface
0055  * @list:         Handle for a list of FCoE interfaces
0056  * @netdev:       The associated net device
0057  * @fcoe_packet_type: FCoE packet type
0058  * @fip_packet_type:  FIP packet type
0059  * @oem:          The offload exchange manager for all local port
0060  *            instances associated with this port
0061  * @removed:          Indicates fcoe interface removed from net device
0062  * @priority:         Priority for the FCoE packet (DCB)
0063  * This structure is 1:1 with a net device.
0064  */
0065 struct fcoe_interface {
0066     struct list_head   list;
0067     struct net_device  *netdev;
0068     struct net_device  *realdev;
0069     struct packet_type fcoe_packet_type;
0070     struct packet_type fip_packet_type;
0071     struct packet_type fip_vlan_packet_type;
0072     struct fc_exch_mgr *oem;
0073     u8  removed;
0074     u8  priority;
0075 };
0076 
0077 #define fcoe_to_ctlr(x)                     \
0078     (struct fcoe_ctlr *)(((struct fcoe_ctlr *)(x)) - 1)
0079 
0080 #define fcoe_from_ctlr(x)           \
0081     ((struct fcoe_interface *)((x) + 1))
0082 
0083 /**
0084  * fcoe_netdev() - Return the net device associated with a local port
0085  * @lport: The local port to get the net device from
0086  */
0087 static inline struct net_device *fcoe_netdev(const struct fc_lport *lport)
0088 {
0089     return ((struct fcoe_interface *)
0090             ((struct fcoe_port *)lport_priv(lport))->priv)->netdev;
0091 }
0092 
0093 #endif /* _FCOE_H_ */