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