xref: /linux/include/scsi/libfcoe.h (revision 6f6c2aa3)
185b4aa49SRobert Love /*
297c8389dSJoe Eykholt  * Copyright (c) 2008-2009 Cisco Systems, Inc.  All rights reserved.
385b4aa49SRobert Love  * Copyright (c) 2007-2008 Intel Corporation.  All rights reserved.
485b4aa49SRobert Love  *
585b4aa49SRobert Love  * This program is free software; you can redistribute it and/or modify it
685b4aa49SRobert Love  * under the terms and conditions of the GNU General Public License,
785b4aa49SRobert Love  * version 2, as published by the Free Software Foundation.
885b4aa49SRobert Love  *
985b4aa49SRobert Love  * This program is distributed in the hope it will be useful, but WITHOUT
1085b4aa49SRobert Love  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1185b4aa49SRobert Love  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
1285b4aa49SRobert Love  * more details.
1385b4aa49SRobert Love  *
1485b4aa49SRobert Love  * You should have received a copy of the GNU General Public License along with
1585b4aa49SRobert Love  * this program; if not, write to the Free Software Foundation, Inc.,
1685b4aa49SRobert Love  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
1785b4aa49SRobert Love  *
1885b4aa49SRobert Love  * Maintained at www.Open-FCoE.org
1985b4aa49SRobert Love  */
2085b4aa49SRobert Love 
2185b4aa49SRobert Love #ifndef _LIBFCOE_H
2285b4aa49SRobert Love #define _LIBFCOE_H
2385b4aa49SRobert Love 
2497c8389dSJoe Eykholt #include <linux/etherdevice.h>
2597c8389dSJoe Eykholt #include <linux/if_ether.h>
2685b4aa49SRobert Love #include <linux/netdevice.h>
2785b4aa49SRobert Love #include <linux/skbuff.h>
2897c8389dSJoe Eykholt #include <linux/workqueue.h>
29e10f8c66SJoe Eykholt #include <linux/random.h>
3085b4aa49SRobert Love #include <scsi/fc/fc_fcoe.h>
3185b4aa49SRobert Love #include <scsi/libfc.h>
3285b4aa49SRobert Love 
33da87bfabSVasu Dev #define FCOE_MAX_CMD_LEN	16	/* Supported CDB length */
34da87bfabSVasu Dev 
3597c8389dSJoe Eykholt /*
36f4d2b2b6SBhanu Prakash Gollapudi  * Max MTU for FCoE: 14 (FCoE header) + 24 (FC header) + 2112 (max FC payload)
37f4d2b2b6SBhanu Prakash Gollapudi  * + 4 (FC CRC) + 4 (FCoE trailer) =  2158 bytes
38f4d2b2b6SBhanu Prakash Gollapudi  */
39f4d2b2b6SBhanu Prakash Gollapudi #define FCOE_MTU	2158
40f4d2b2b6SBhanu Prakash Gollapudi 
41f4d2b2b6SBhanu Prakash Gollapudi /*
4297c8389dSJoe Eykholt  * FIP tunable parameters.
4397c8389dSJoe Eykholt  */
4497c8389dSJoe Eykholt #define FCOE_CTLR_START_DELAY	2000	/* mS after first adv. to choose FCF */
4597c8389dSJoe Eykholt #define FCOE_CTRL_SOL_TOV	2000	/* min. solicitation interval (mS) */
4697c8389dSJoe Eykholt #define FCOE_CTLR_FCF_LIMIT	20	/* max. number of FCF entries */
47e10f8c66SJoe Eykholt #define FCOE_CTLR_VN2VN_LOGIN_LIMIT 3	/* max. VN2VN rport login retries */
4897c8389dSJoe Eykholt 
4997c8389dSJoe Eykholt /**
5097c8389dSJoe Eykholt  * enum fip_state - internal state of FCoE controller.
5197c8389dSJoe Eykholt  * @FIP_ST_DISABLED: 	controller has been disabled or not yet enabled.
5297c8389dSJoe Eykholt  * @FIP_ST_LINK_WAIT:	the physical link is down or unusable.
5397c8389dSJoe Eykholt  * @FIP_ST_AUTO:	determining whether to use FIP or non-FIP mode.
5497c8389dSJoe Eykholt  * @FIP_ST_NON_FIP:	non-FIP mode selected.
5597c8389dSJoe Eykholt  * @FIP_ST_ENABLED:	FIP mode selected.
56e10f8c66SJoe Eykholt  * @FIP_ST_VNMP_START:	VN2VN multipath mode start, wait
57e10f8c66SJoe Eykholt  * @FIP_ST_VNMP_PROBE1:	VN2VN sent first probe, listening
58e10f8c66SJoe Eykholt  * @FIP_ST_VNMP_PROBE2:	VN2VN sent second probe, listening
59e10f8c66SJoe Eykholt  * @FIP_ST_VNMP_CLAIM:	VN2VN sent claim, waiting for responses
60e10f8c66SJoe Eykholt  * @FIP_ST_VNMP_UP:	VN2VN multipath mode operation
6197c8389dSJoe Eykholt  */
6297c8389dSJoe Eykholt enum fip_state {
6397c8389dSJoe Eykholt 	FIP_ST_DISABLED,
6497c8389dSJoe Eykholt 	FIP_ST_LINK_WAIT,
6597c8389dSJoe Eykholt 	FIP_ST_AUTO,
6697c8389dSJoe Eykholt 	FIP_ST_NON_FIP,
6797c8389dSJoe Eykholt 	FIP_ST_ENABLED,
68e10f8c66SJoe Eykholt 	FIP_ST_VNMP_START,
69e10f8c66SJoe Eykholt 	FIP_ST_VNMP_PROBE1,
70e10f8c66SJoe Eykholt 	FIP_ST_VNMP_PROBE2,
71e10f8c66SJoe Eykholt 	FIP_ST_VNMP_CLAIM,
72e10f8c66SJoe Eykholt 	FIP_ST_VNMP_UP,
7397c8389dSJoe Eykholt };
7497c8389dSJoe Eykholt 
753d902ac0SJoe Eykholt /*
763d902ac0SJoe Eykholt  * Modes:
773d902ac0SJoe Eykholt  * The mode is the state that is to be entered after link up.
783d902ac0SJoe Eykholt  * It must not change after fcoe_ctlr_init() sets it.
793d902ac0SJoe Eykholt  */
803d902ac0SJoe Eykholt #define FIP_MODE_AUTO		FIP_ST_AUTO
813d902ac0SJoe Eykholt #define FIP_MODE_NON_FIP	FIP_ST_NON_FIP
823d902ac0SJoe Eykholt #define FIP_MODE_FABRIC		FIP_ST_ENABLED
83e10f8c66SJoe Eykholt #define FIP_MODE_VN2VN		FIP_ST_VNMP_START
843d902ac0SJoe Eykholt 
8597c8389dSJoe Eykholt /**
8670b51aabSRobert Love  * struct fcoe_ctlr - FCoE Controller and FIP state
8797c8389dSJoe Eykholt  * @state:	   internal FIP state for network link and FIP or non-FIP mode.
8822bcd225SJoe Eykholt  * @mode:	   LLD-selected mode.
8997c8389dSJoe Eykholt  * @lp:		   &fc_lport: libfc local port.
9097c8389dSJoe Eykholt  * @sel_fcf:	   currently selected FCF, or NULL.
9197c8389dSJoe Eykholt  * @fcfs:	   list of discovered FCFs.
9297c8389dSJoe Eykholt  * @fcf_count:	   number of discovered FCF entries.
9397c8389dSJoe Eykholt  * @sol_time:	   time when a multicast solicitation was last sent.
9497c8389dSJoe Eykholt  * @sel_time:	   time after which to select an FCF.
9597c8389dSJoe Eykholt  * @port_ka_time:  time of next port keep-alive.
9697c8389dSJoe Eykholt  * @ctlr_ka_time:  time of next controller keep-alive.
9797c8389dSJoe Eykholt  * @timer:	   timer struct used for all delayed events.
9842913657SJoe Eykholt  * @timer_work:	   &work_struct for doing keep-alives and resets.
9997c8389dSJoe Eykholt  * @recv_work:	   &work_struct for receiving FIP frames.
10097c8389dSJoe Eykholt  * @fip_recv_list: list of received FIP frames.
101794d98e7SJoe Eykholt  * @flogi_req:	   clone of FLOGI request sent
102e10f8c66SJoe Eykholt  * @rnd_state:	   state for pseudo-random number generator.
103e10f8c66SJoe Eykholt  * @port_id:	   proposed or selected local-port ID.
10497c8389dSJoe Eykholt  * @user_mfs:	   configured maximum FC frame size, including FC header.
10597c8389dSJoe Eykholt  * @flogi_oxid:    exchange ID of most recent fabric login.
106794d98e7SJoe Eykholt  * @flogi_req_send: send of FLOGI requested
10797c8389dSJoe Eykholt  * @flogi_count:   number of FLOGI attempts in AUTO mode.
10897c8389dSJoe Eykholt  * @map_dest:	   use the FC_MAP mode for destination MAC addresses.
109184dd345SVasu Dev  * @spma:	   supports SPMA server-provided MACs mode
110e10f8c66SJoe Eykholt  * @probe_tries:   number of FC_IDs probed
11197c8389dSJoe Eykholt  * @dest_addr:	   MAC address of the selected FC forwarder.
11297c8389dSJoe Eykholt  * @ctl_src_addr:  the native MAC address of our local port.
11370b51aabSRobert Love  * @send:	   LLD-supplied function to handle sending FIP Ethernet frames
11497c8389dSJoe Eykholt  * @update_mac:    LLD-supplied function to handle changes to MAC addresses.
11511b56188SChris Leech  * @get_src_addr:  LLD-supplied function to supply a source MAC address.
116fdb068c6SJoe Eykholt  * @ctlr_mutex:	   lock protecting this structure.
117794d98e7SJoe Eykholt  * @ctlr_lock:     spinlock covering flogi_req
11897c8389dSJoe Eykholt  *
11997c8389dSJoe Eykholt  * This structure is used by all FCoE drivers.  It contains information
12097c8389dSJoe Eykholt  * needed by all FCoE low-level drivers (LLDs) as well as internal state
12197c8389dSJoe Eykholt  * for FIP, and fields shared with the LLDS.
12297c8389dSJoe Eykholt  */
12397c8389dSJoe Eykholt struct fcoe_ctlr {
12497c8389dSJoe Eykholt 	enum fip_state state;
12522bcd225SJoe Eykholt 	enum fip_state mode;
12697c8389dSJoe Eykholt 	struct fc_lport *lp;
12797c8389dSJoe Eykholt 	struct fcoe_fcf *sel_fcf;
12897c8389dSJoe Eykholt 	struct list_head fcfs;
12997c8389dSJoe Eykholt 	u16 fcf_count;
13097c8389dSJoe Eykholt 	unsigned long sol_time;
13197c8389dSJoe Eykholt 	unsigned long sel_time;
13297c8389dSJoe Eykholt 	unsigned long port_ka_time;
13397c8389dSJoe Eykholt 	unsigned long ctlr_ka_time;
13497c8389dSJoe Eykholt 	struct timer_list timer;
13542913657SJoe Eykholt 	struct work_struct timer_work;
13697c8389dSJoe Eykholt 	struct work_struct recv_work;
13797c8389dSJoe Eykholt 	struct sk_buff_head fip_recv_list;
138794d98e7SJoe Eykholt 	struct sk_buff *flogi_req;
139e10f8c66SJoe Eykholt 
140e10f8c66SJoe Eykholt 	struct rnd_state rnd_state;
141e10f8c66SJoe Eykholt 	u32 port_id;
142e10f8c66SJoe Eykholt 
14397c8389dSJoe Eykholt 	u16 user_mfs;
14497c8389dSJoe Eykholt 	u16 flogi_oxid;
145794d98e7SJoe Eykholt 	u8 flogi_req_send;
14697c8389dSJoe Eykholt 	u8 flogi_count;
14797c8389dSJoe Eykholt 	u8 map_dest;
148184dd345SVasu Dev 	u8 spma;
149e10f8c66SJoe Eykholt 	u8 probe_tries;
150*6f6c2aa3Sjohn fastabend 	u8 priority;
15197c8389dSJoe Eykholt 	u8 dest_addr[ETH_ALEN];
15297c8389dSJoe Eykholt 	u8 ctl_src_addr[ETH_ALEN];
15397c8389dSJoe Eykholt 
15497c8389dSJoe Eykholt 	void (*send)(struct fcoe_ctlr *, struct sk_buff *);
15511b56188SChris Leech 	void (*update_mac)(struct fc_lport *, u8 *addr);
15611b56188SChris Leech 	u8 * (*get_src_addr)(struct fc_lport *);
157fdb068c6SJoe Eykholt 	struct mutex ctlr_mutex;
158794d98e7SJoe Eykholt 	spinlock_t ctlr_lock;
15997c8389dSJoe Eykholt };
16097c8389dSJoe Eykholt 
16170b51aabSRobert Love /**
16270b51aabSRobert Love  * struct fcoe_fcf - Fibre-Channel Forwarder
16370b51aabSRobert Love  * @list:	 list linkage
16470b51aabSRobert Love  * @time:	 system time (jiffies) when an advertisement was last received
16570b51aabSRobert Love  * @switch_name: WWN of switch from advertisement
16670b51aabSRobert Love  * @fabric_name: WWN of fabric from advertisement
16770b51aabSRobert Love  * @fc_map:	 FC_MAP value from advertisement
16870b51aabSRobert Love  * @fcf_mac:	 Ethernet address of the FCF
16970b51aabSRobert Love  * @vfid:	 virtual fabric ID
17070b51aabSRobert Love  * @pri:	 selection priority, smaller values are better
171794d98e7SJoe Eykholt  * @flogi_sent:	 current FLOGI sent to this FCF
17270b51aabSRobert Love  * @flags:	 flags received from advertisement
17370b51aabSRobert Love  * @fka_period:	 keep-alive period, in jiffies
17497c8389dSJoe Eykholt  *
17597c8389dSJoe Eykholt  * A Fibre-Channel Forwarder (FCF) is the entity on the Ethernet that
17697c8389dSJoe Eykholt  * passes FCoE frames on to an FC fabric.  This structure represents
17797c8389dSJoe Eykholt  * one FCF from which advertisements have been received.
17897c8389dSJoe Eykholt  *
17997c8389dSJoe Eykholt  * When looking up an FCF, @switch_name, @fabric_name, @fc_map, @vfid, and
18097c8389dSJoe Eykholt  * @fcf_mac together form the lookup key.
18197c8389dSJoe Eykholt  */
18297c8389dSJoe Eykholt struct fcoe_fcf {
18397c8389dSJoe Eykholt 	struct list_head list;
18497c8389dSJoe Eykholt 	unsigned long time;
18597c8389dSJoe Eykholt 
18697c8389dSJoe Eykholt 	u64 switch_name;
18797c8389dSJoe Eykholt 	u64 fabric_name;
18897c8389dSJoe Eykholt 	u32 fc_map;
18997c8389dSJoe Eykholt 	u16 vfid;
19097c8389dSJoe Eykholt 	u8 fcf_mac[ETH_ALEN];
19197c8389dSJoe Eykholt 
19297c8389dSJoe Eykholt 	u8 pri;
193794d98e7SJoe Eykholt 	u8 flogi_sent;
19497c8389dSJoe Eykholt 	u16 flags;
19597c8389dSJoe Eykholt 	u32 fka_period;
1968cdffdccSYi Zou 	u8 fd_flags:1;
19797c8389dSJoe Eykholt };
19897c8389dSJoe Eykholt 
199e10f8c66SJoe Eykholt /**
200e10f8c66SJoe Eykholt  * struct fcoe_rport - VN2VN remote port
201e10f8c66SJoe Eykholt  * @time:	time of create or last beacon packet received from node
202e10f8c66SJoe Eykholt  * @fcoe_len:	max FCoE frame size, not including VLAN or Ethernet headers
203e10f8c66SJoe Eykholt  * @flags:	flags from probe or claim
204e10f8c66SJoe Eykholt  * @login_count: number of unsuccessful rport logins to this port
205e10f8c66SJoe Eykholt  * @enode_mac:	E_Node control MAC address
206e10f8c66SJoe Eykholt  * @vn_mac:	VN_Node assigned MAC address for data
207e10f8c66SJoe Eykholt  */
208e10f8c66SJoe Eykholt struct fcoe_rport {
209e10f8c66SJoe Eykholt 	unsigned long time;
210e10f8c66SJoe Eykholt 	u16 fcoe_len;
211e10f8c66SJoe Eykholt 	u16 flags;
212e10f8c66SJoe Eykholt 	u8 login_count;
213e10f8c66SJoe Eykholt 	u8 enode_mac[ETH_ALEN];
214e10f8c66SJoe Eykholt 	u8 vn_mac[ETH_ALEN];
215e10f8c66SJoe Eykholt };
216e10f8c66SJoe Eykholt 
21797c8389dSJoe Eykholt /* FIP API functions */
2183d902ac0SJoe Eykholt void fcoe_ctlr_init(struct fcoe_ctlr *, enum fip_state);
21997c8389dSJoe Eykholt void fcoe_ctlr_destroy(struct fcoe_ctlr *);
22097c8389dSJoe Eykholt void fcoe_ctlr_link_up(struct fcoe_ctlr *);
22197c8389dSJoe Eykholt int fcoe_ctlr_link_down(struct fcoe_ctlr *);
22211b56188SChris Leech int fcoe_ctlr_els_send(struct fcoe_ctlr *, struct fc_lport *, struct sk_buff *);
22397c8389dSJoe Eykholt void fcoe_ctlr_recv(struct fcoe_ctlr *, struct sk_buff *);
22470b51aabSRobert Love int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_lport *,
225386309ceSJoe Eykholt 			 struct fc_frame *);
22697c8389dSJoe Eykholt 
22785b4aa49SRobert Love /* libfcoe funcs */
228fdd78027SVasu Dev u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int);
229e10f8c66SJoe Eykholt int fcoe_libfc_config(struct fc_lport *, struct fcoe_ctlr *,
230e10f8c66SJoe Eykholt 		      const struct libfc_function_template *, int init_fcp);
2318597ae8bSBhanu Prakash Gollapudi u32 fcoe_fc_crc(struct fc_frame *fp);
2328597ae8bSBhanu Prakash Gollapudi int fcoe_start_io(struct sk_buff *skb);
233d834895cSBhanu Prakash Gollapudi int fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type);
234814740d5SBhanu Prakash Gollapudi void __fcoe_get_lesb(struct fc_lport *lport, struct fc_els_lesb *fc_lesb,
235814740d5SBhanu Prakash Gollapudi 		     struct net_device *netdev);
236d834895cSBhanu Prakash Gollapudi void fcoe_wwn_to_str(u64 wwn, char *buf, int len);
237d834895cSBhanu Prakash Gollapudi int fcoe_validate_vport_create(struct fc_vport *vport);
238fdd78027SVasu Dev 
239519e5135SVasu Dev /**
240519e5135SVasu Dev  * is_fip_mode() - returns true if FIP mode selected.
241519e5135SVasu Dev  * @fip:	FCoE controller.
242519e5135SVasu Dev  */
243519e5135SVasu Dev static inline bool is_fip_mode(struct fcoe_ctlr *fip)
244519e5135SVasu Dev {
245519e5135SVasu Dev 	return fip->state == FIP_ST_ENABLED;
246519e5135SVasu Dev }
247519e5135SVasu Dev 
2480ade7d29SYi Zou /* helper for FCoE SW HBA drivers, can include subven and subdev if needed. The
2490ade7d29SYi Zou  * modpost would use pci_device_id table to auto-generate formatted module alias
2500ade7d29SYi Zou  * into the corresponding .mod.c file, but there may or may not be a pci device
2510ade7d29SYi Zou  * id table for FCoE drivers so we use the following helper for build the fcoe
2520ade7d29SYi Zou  * driver module alias.
2530ade7d29SYi Zou  */
2540ade7d29SYi Zou #define MODULE_ALIAS_FCOE_PCI(ven, dev) \
2550ade7d29SYi Zou 	MODULE_ALIAS("fcoe-pci:"	\
2560ade7d29SYi Zou 		"v" __stringify(ven)	\
2570ade7d29SYi Zou 		"d" __stringify(dev) "sv*sd*bc*sc*i*")
2580ade7d29SYi Zou 
2590ade7d29SYi Zou /* the name of the default FCoE transport driver fcoe.ko */
2600ade7d29SYi Zou #define FCOE_TRANSPORT_DEFAULT	"fcoe"
2610ade7d29SYi Zou 
2620ade7d29SYi Zou /* struct fcoe_transport - The FCoE transport interface
2630ade7d29SYi Zou  * @name:	a vendor specific name for their FCoE transport driver
2640ade7d29SYi Zou  * @attached:	whether this transport is already attached
2650ade7d29SYi Zou  * @list:	list linkage to all attached transports
2660ade7d29SYi Zou  * @match:	handler to allow the transport driver to match up a given netdev
2670ade7d29SYi Zou  * @create:	handler to sysfs entry of create for FCoE instances
2680ade7d29SYi Zou  * @destroy:	handler to sysfs entry of destroy for FCoE instances
2690ade7d29SYi Zou  * @enable:	handler to sysfs entry of enable for FCoE instances
2700ade7d29SYi Zou  * @disable:	handler to sysfs entry of disable for FCoE instances
2710ade7d29SYi Zou  */
2720ade7d29SYi Zou struct fcoe_transport {
2730ade7d29SYi Zou 	char name[IFNAMSIZ];
2740ade7d29SYi Zou 	bool attached;
2750ade7d29SYi Zou 	struct list_head list;
2760ade7d29SYi Zou 	bool (*match) (struct net_device *device);
2770ade7d29SYi Zou 	int (*create) (struct net_device *device, enum fip_state fip_mode);
2780ade7d29SYi Zou 	int (*destroy) (struct net_device *device);
2790ade7d29SYi Zou 	int (*enable) (struct net_device *device);
2800ade7d29SYi Zou 	int (*disable) (struct net_device *device);
2810ade7d29SYi Zou };
2820ade7d29SYi Zou 
2830ade7d29SYi Zou /**
2848597ae8bSBhanu Prakash Gollapudi  * struct fcoe_percpu_s - The context for FCoE receive thread(s)
2858597ae8bSBhanu Prakash Gollapudi  * @thread:	    The thread context
2868597ae8bSBhanu Prakash Gollapudi  * @fcoe_rx_list:   The queue of pending packets to process
2878597ae8bSBhanu Prakash Gollapudi  * @page:	    The memory page for calculating frame trailer CRCs
2888597ae8bSBhanu Prakash Gollapudi  * @crc_eof_offset: The offset into the CRC page pointing to available
2898597ae8bSBhanu Prakash Gollapudi  *		    memory for a new trailer
2908597ae8bSBhanu Prakash Gollapudi  */
2918597ae8bSBhanu Prakash Gollapudi struct fcoe_percpu_s {
2928597ae8bSBhanu Prakash Gollapudi 	struct task_struct *thread;
2938597ae8bSBhanu Prakash Gollapudi 	struct sk_buff_head fcoe_rx_list;
2948597ae8bSBhanu Prakash Gollapudi 	struct page *crc_eof_page;
2958597ae8bSBhanu Prakash Gollapudi 	int crc_eof_offset;
2968597ae8bSBhanu Prakash Gollapudi };
2978597ae8bSBhanu Prakash Gollapudi 
2988597ae8bSBhanu Prakash Gollapudi /**
2998597ae8bSBhanu Prakash Gollapudi  * struct fcoe_port - The FCoE private structure
3008597ae8bSBhanu Prakash Gollapudi  * @priv:		       The associated fcoe interface. The structure is
3018597ae8bSBhanu Prakash Gollapudi  *			       defined by the low level driver
3028597ae8bSBhanu Prakash Gollapudi  * @lport:		       The associated local port
3038597ae8bSBhanu Prakash Gollapudi  * @fcoe_pending_queue:	       The pending Rx queue of skbs
3048597ae8bSBhanu Prakash Gollapudi  * @fcoe_pending_queue_active: Indicates if the pending queue is active
305*6f6c2aa3Sjohn fastabend  * @priority:		       Packet priority (DCB)
3068597ae8bSBhanu Prakash Gollapudi  * @max_queue_depth:	       Max queue depth of pending queue
3078597ae8bSBhanu Prakash Gollapudi  * @min_queue_depth:	       Min queue depth of pending queue
3088597ae8bSBhanu Prakash Gollapudi  * @timer:		       The queue timer
3098597ae8bSBhanu Prakash Gollapudi  * @destroy_work:	       Handle for work context
3108597ae8bSBhanu Prakash Gollapudi  *			       (to prevent RTNL deadlocks)
3118597ae8bSBhanu Prakash Gollapudi  * @data_srt_addr:	       Source address for data
3128597ae8bSBhanu Prakash Gollapudi  *
3138597ae8bSBhanu Prakash Gollapudi  * An instance of this structure is to be allocated along with the
3148597ae8bSBhanu Prakash Gollapudi  * Scsi_Host and libfc fc_lport structures.
3158597ae8bSBhanu Prakash Gollapudi  */
3168597ae8bSBhanu Prakash Gollapudi struct fcoe_port {
3178597ae8bSBhanu Prakash Gollapudi 	void		      *priv;
3188597ae8bSBhanu Prakash Gollapudi 	struct fc_lport	      *lport;
3198597ae8bSBhanu Prakash Gollapudi 	struct sk_buff_head   fcoe_pending_queue;
3208597ae8bSBhanu Prakash Gollapudi 	u8		      fcoe_pending_queue_active;
321*6f6c2aa3Sjohn fastabend 	u8		      priority;
3228597ae8bSBhanu Prakash Gollapudi 	u32		      max_queue_depth;
3238597ae8bSBhanu Prakash Gollapudi 	u32		      min_queue_depth;
3248597ae8bSBhanu Prakash Gollapudi 	struct timer_list     timer;
3258597ae8bSBhanu Prakash Gollapudi 	struct work_struct    destroy_work;
3268597ae8bSBhanu Prakash Gollapudi 	u8		      data_src_addr[ETH_ALEN];
3278597ae8bSBhanu Prakash Gollapudi };
3288597ae8bSBhanu Prakash Gollapudi void fcoe_clean_pending_queue(struct fc_lport *);
3298597ae8bSBhanu Prakash Gollapudi void fcoe_check_wait_queue(struct fc_lport *lport, struct sk_buff *skb);
3308597ae8bSBhanu Prakash Gollapudi void fcoe_queue_timer(ulong lport);
3318597ae8bSBhanu Prakash Gollapudi int fcoe_get_paged_crc_eof(struct sk_buff *skb, int tlen,
3328597ae8bSBhanu Prakash Gollapudi 			   struct fcoe_percpu_s *fps);
3338597ae8bSBhanu Prakash Gollapudi 
3348597ae8bSBhanu Prakash Gollapudi /**
3350ade7d29SYi Zou  * struct netdev_list
3360ade7d29SYi Zou  * A mapping from netdevice to fcoe_transport
3370ade7d29SYi Zou  */
3380ade7d29SYi Zou struct fcoe_netdev_mapping {
3390ade7d29SYi Zou 	struct list_head list;
3400ade7d29SYi Zou 	struct net_device *netdev;
3410ade7d29SYi Zou 	struct fcoe_transport *ft;
3420ade7d29SYi Zou };
3430ade7d29SYi Zou 
3440ade7d29SYi Zou /* fcoe transports registration and deregistration */
3450ade7d29SYi Zou int fcoe_transport_attach(struct fcoe_transport *ft);
3460ade7d29SYi Zou int fcoe_transport_detach(struct fcoe_transport *ft);
347519e5135SVasu Dev 
34885b4aa49SRobert Love #endif /* _LIBFCOE_H */
349