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> 329a74e884SRobert Love #include <scsi/fcoe_sysfs.h> 3385b4aa49SRobert Love 34da87bfabSVasu Dev #define FCOE_MAX_CMD_LEN 16 /* Supported CDB length */ 35da87bfabSVasu Dev 3697c8389dSJoe Eykholt /* 37f4d2b2b6SBhanu Prakash Gollapudi * Max MTU for FCoE: 14 (FCoE header) + 24 (FC header) + 2112 (max FC payload) 38f4d2b2b6SBhanu Prakash Gollapudi * + 4 (FC CRC) + 4 (FCoE trailer) = 2158 bytes 39f4d2b2b6SBhanu Prakash Gollapudi */ 40f4d2b2b6SBhanu Prakash Gollapudi #define FCOE_MTU 2158 41f4d2b2b6SBhanu Prakash Gollapudi 42f4d2b2b6SBhanu Prakash Gollapudi /* 4397c8389dSJoe Eykholt * FIP tunable parameters. 4497c8389dSJoe Eykholt */ 4597c8389dSJoe Eykholt #define FCOE_CTLR_START_DELAY 2000 /* mS after first adv. to choose FCF */ 4697c8389dSJoe Eykholt #define FCOE_CTRL_SOL_TOV 2000 /* min. solicitation interval (mS) */ 4797c8389dSJoe Eykholt #define FCOE_CTLR_FCF_LIMIT 20 /* max. number of FCF entries */ 48e10f8c66SJoe Eykholt #define FCOE_CTLR_VN2VN_LOGIN_LIMIT 3 /* max. VN2VN rport login retries */ 4997c8389dSJoe Eykholt 5097c8389dSJoe Eykholt /** 5197c8389dSJoe Eykholt * enum fip_state - internal state of FCoE controller. 5297c8389dSJoe Eykholt * @FIP_ST_DISABLED: controller has been disabled or not yet enabled. 5397c8389dSJoe Eykholt * @FIP_ST_LINK_WAIT: the physical link is down or unusable. 5497c8389dSJoe Eykholt * @FIP_ST_AUTO: determining whether to use FIP or non-FIP mode. 5597c8389dSJoe Eykholt * @FIP_ST_NON_FIP: non-FIP mode selected. 5697c8389dSJoe Eykholt * @FIP_ST_ENABLED: FIP mode selected. 57e10f8c66SJoe Eykholt * @FIP_ST_VNMP_START: VN2VN multipath mode start, wait 58e10f8c66SJoe Eykholt * @FIP_ST_VNMP_PROBE1: VN2VN sent first probe, listening 59e10f8c66SJoe Eykholt * @FIP_ST_VNMP_PROBE2: VN2VN sent second probe, listening 60e10f8c66SJoe Eykholt * @FIP_ST_VNMP_CLAIM: VN2VN sent claim, waiting for responses 61e10f8c66SJoe Eykholt * @FIP_ST_VNMP_UP: VN2VN multipath mode operation 6297c8389dSJoe Eykholt */ 6397c8389dSJoe Eykholt enum fip_state { 6497c8389dSJoe Eykholt FIP_ST_DISABLED, 6597c8389dSJoe Eykholt FIP_ST_LINK_WAIT, 6697c8389dSJoe Eykholt FIP_ST_AUTO, 6797c8389dSJoe Eykholt FIP_ST_NON_FIP, 6897c8389dSJoe Eykholt FIP_ST_ENABLED, 69e10f8c66SJoe Eykholt FIP_ST_VNMP_START, 70e10f8c66SJoe Eykholt FIP_ST_VNMP_PROBE1, 71e10f8c66SJoe Eykholt FIP_ST_VNMP_PROBE2, 72e10f8c66SJoe Eykholt FIP_ST_VNMP_CLAIM, 73e10f8c66SJoe Eykholt FIP_ST_VNMP_UP, 7497c8389dSJoe Eykholt }; 7597c8389dSJoe Eykholt 763d902ac0SJoe Eykholt /* 773d902ac0SJoe Eykholt * Modes: 783d902ac0SJoe Eykholt * The mode is the state that is to be entered after link up. 793d902ac0SJoe Eykholt * It must not change after fcoe_ctlr_init() sets it. 803d902ac0SJoe Eykholt */ 813d902ac0SJoe Eykholt #define FIP_MODE_AUTO FIP_ST_AUTO 823d902ac0SJoe Eykholt #define FIP_MODE_NON_FIP FIP_ST_NON_FIP 833d902ac0SJoe Eykholt #define FIP_MODE_FABRIC FIP_ST_ENABLED 84e10f8c66SJoe Eykholt #define FIP_MODE_VN2VN FIP_ST_VNMP_START 853d902ac0SJoe Eykholt 8697c8389dSJoe Eykholt /** 8770b51aabSRobert Love * struct fcoe_ctlr - FCoE Controller and FIP state 8897c8389dSJoe Eykholt * @state: internal FIP state for network link and FIP or non-FIP mode. 8922bcd225SJoe Eykholt * @mode: LLD-selected mode. 9097c8389dSJoe Eykholt * @lp: &fc_lport: libfc local port. 9197c8389dSJoe Eykholt * @sel_fcf: currently selected FCF, or NULL. 9297c8389dSJoe Eykholt * @fcfs: list of discovered FCFs. 9397c8389dSJoe Eykholt * @fcf_count: number of discovered FCF entries. 9497c8389dSJoe Eykholt * @sol_time: time when a multicast solicitation was last sent. 9597c8389dSJoe Eykholt * @sel_time: time after which to select an FCF. 9697c8389dSJoe Eykholt * @port_ka_time: time of next port keep-alive. 9797c8389dSJoe Eykholt * @ctlr_ka_time: time of next controller keep-alive. 9897c8389dSJoe Eykholt * @timer: timer struct used for all delayed events. 9942913657SJoe Eykholt * @timer_work: &work_struct for doing keep-alives and resets. 10097c8389dSJoe Eykholt * @recv_work: &work_struct for receiving FIP frames. 10197c8389dSJoe Eykholt * @fip_recv_list: list of received FIP frames. 102794d98e7SJoe Eykholt * @flogi_req: clone of FLOGI request sent 103e10f8c66SJoe Eykholt * @rnd_state: state for pseudo-random number generator. 104e10f8c66SJoe Eykholt * @port_id: proposed or selected local-port ID. 10597c8389dSJoe Eykholt * @user_mfs: configured maximum FC frame size, including FC header. 10697c8389dSJoe Eykholt * @flogi_oxid: exchange ID of most recent fabric login. 107794d98e7SJoe Eykholt * @flogi_req_send: send of FLOGI requested 10897c8389dSJoe Eykholt * @flogi_count: number of FLOGI attempts in AUTO mode. 10997c8389dSJoe Eykholt * @map_dest: use the FC_MAP mode for destination MAC addresses. 110184dd345SVasu Dev * @spma: supports SPMA server-provided MACs mode 111e10f8c66SJoe Eykholt * @probe_tries: number of FC_IDs probed 11297c8389dSJoe Eykholt * @dest_addr: MAC address of the selected FC forwarder. 11397c8389dSJoe Eykholt * @ctl_src_addr: the native MAC address of our local port. 11470b51aabSRobert Love * @send: LLD-supplied function to handle sending FIP Ethernet frames 11597c8389dSJoe Eykholt * @update_mac: LLD-supplied function to handle changes to MAC addresses. 11611b56188SChris Leech * @get_src_addr: LLD-supplied function to supply a source MAC address. 117fdb068c6SJoe Eykholt * @ctlr_mutex: lock protecting this structure. 118794d98e7SJoe Eykholt * @ctlr_lock: spinlock covering flogi_req 11997c8389dSJoe Eykholt * 12097c8389dSJoe Eykholt * This structure is used by all FCoE drivers. It contains information 12197c8389dSJoe Eykholt * needed by all FCoE low-level drivers (LLDs) as well as internal state 12297c8389dSJoe Eykholt * for FIP, and fields shared with the LLDS. 12397c8389dSJoe Eykholt */ 12497c8389dSJoe Eykholt struct fcoe_ctlr { 12597c8389dSJoe Eykholt enum fip_state state; 12622bcd225SJoe Eykholt enum fip_state mode; 12797c8389dSJoe Eykholt struct fc_lport *lp; 12897c8389dSJoe Eykholt struct fcoe_fcf *sel_fcf; 12997c8389dSJoe Eykholt struct list_head fcfs; 13097c8389dSJoe Eykholt u16 fcf_count; 13197c8389dSJoe Eykholt unsigned long sol_time; 13297c8389dSJoe Eykholt unsigned long sel_time; 13397c8389dSJoe Eykholt unsigned long port_ka_time; 13497c8389dSJoe Eykholt unsigned long ctlr_ka_time; 13597c8389dSJoe Eykholt struct timer_list timer; 13642913657SJoe Eykholt struct work_struct timer_work; 13797c8389dSJoe Eykholt struct work_struct recv_work; 13897c8389dSJoe Eykholt struct sk_buff_head fip_recv_list; 139794d98e7SJoe Eykholt struct sk_buff *flogi_req; 140e10f8c66SJoe Eykholt 141e10f8c66SJoe Eykholt struct rnd_state rnd_state; 142e10f8c66SJoe Eykholt u32 port_id; 143e10f8c66SJoe Eykholt 14497c8389dSJoe Eykholt u16 user_mfs; 14597c8389dSJoe Eykholt u16 flogi_oxid; 146794d98e7SJoe Eykholt u8 flogi_req_send; 14797c8389dSJoe Eykholt u8 flogi_count; 14897c8389dSJoe Eykholt u8 map_dest; 149184dd345SVasu Dev u8 spma; 150e10f8c66SJoe Eykholt u8 probe_tries; 1516f6c2aa3Sjohn fastabend u8 priority; 15297c8389dSJoe Eykholt u8 dest_addr[ETH_ALEN]; 15397c8389dSJoe Eykholt u8 ctl_src_addr[ETH_ALEN]; 15497c8389dSJoe Eykholt 15597c8389dSJoe Eykholt void (*send)(struct fcoe_ctlr *, struct sk_buff *); 15611b56188SChris Leech void (*update_mac)(struct fc_lport *, u8 *addr); 15711b56188SChris Leech u8 * (*get_src_addr)(struct fc_lport *); 158fdb068c6SJoe Eykholt struct mutex ctlr_mutex; 159794d98e7SJoe Eykholt spinlock_t ctlr_lock; 16097c8389dSJoe Eykholt }; 16197c8389dSJoe Eykholt 16270b51aabSRobert Love /** 163619fe4beSRobert Love * fcoe_ctlr_priv() - Return the private data from a fcoe_ctlr 164619fe4beSRobert Love * @cltr: The fcoe_ctlr whose private data will be returned 165619fe4beSRobert Love */ 166619fe4beSRobert Love static inline void *fcoe_ctlr_priv(const struct fcoe_ctlr *ctlr) 167619fe4beSRobert Love { 168619fe4beSRobert Love return (void *)(ctlr + 1); 169619fe4beSRobert Love } 170619fe4beSRobert Love 1718d55e507SRobert Love #define fcoe_ctlr_to_ctlr_dev(x) \ 1728d55e507SRobert Love (struct fcoe_ctlr_device *)(((struct fcoe_ctlr_device *)(x)) - 1) 1738d55e507SRobert Love 174619fe4beSRobert Love /** 17570b51aabSRobert Love * struct fcoe_fcf - Fibre-Channel Forwarder 17670b51aabSRobert Love * @list: list linkage 1778d55e507SRobert Love * @event_work: Work for FC Transport actions queue 1788d55e507SRobert Love * @event: The event to be processed 1798d55e507SRobert Love * @fip: The controller that the FCF was discovered on 1808d55e507SRobert Love * @fcf_dev: The associated fcoe_fcf_device instance 18170b51aabSRobert Love * @time: system time (jiffies) when an advertisement was last received 18270b51aabSRobert Love * @switch_name: WWN of switch from advertisement 18370b51aabSRobert Love * @fabric_name: WWN of fabric from advertisement 18470b51aabSRobert Love * @fc_map: FC_MAP value from advertisement 18581c11dd2SBhanu Prakash Gollapudi * @fcf_mac: Ethernet address of the FCF for FIP traffic 18681c11dd2SBhanu Prakash Gollapudi * @fcoe_mac: Ethernet address of the FCF for FCoE traffic 18770b51aabSRobert Love * @vfid: virtual fabric ID 18870b51aabSRobert Love * @pri: selection priority, smaller values are better 189794d98e7SJoe Eykholt * @flogi_sent: current FLOGI sent to this FCF 19070b51aabSRobert Love * @flags: flags received from advertisement 19170b51aabSRobert Love * @fka_period: keep-alive period, in jiffies 19297c8389dSJoe Eykholt * 19397c8389dSJoe Eykholt * A Fibre-Channel Forwarder (FCF) is the entity on the Ethernet that 19497c8389dSJoe Eykholt * passes FCoE frames on to an FC fabric. This structure represents 19597c8389dSJoe Eykholt * one FCF from which advertisements have been received. 19697c8389dSJoe Eykholt * 19797c8389dSJoe Eykholt * When looking up an FCF, @switch_name, @fabric_name, @fc_map, @vfid, and 19897c8389dSJoe Eykholt * @fcf_mac together form the lookup key. 19997c8389dSJoe Eykholt */ 20097c8389dSJoe Eykholt struct fcoe_fcf { 20197c8389dSJoe Eykholt struct list_head list; 2028d55e507SRobert Love struct work_struct event_work; 2038d55e507SRobert Love struct fcoe_ctlr *fip; 2048d55e507SRobert Love struct fcoe_fcf_device *fcf_dev; 20597c8389dSJoe Eykholt unsigned long time; 20697c8389dSJoe Eykholt 20797c8389dSJoe Eykholt u64 switch_name; 20897c8389dSJoe Eykholt u64 fabric_name; 20997c8389dSJoe Eykholt u32 fc_map; 21097c8389dSJoe Eykholt u16 vfid; 21197c8389dSJoe Eykholt u8 fcf_mac[ETH_ALEN]; 21281c11dd2SBhanu Prakash Gollapudi u8 fcoe_mac[ETH_ALEN]; 21397c8389dSJoe Eykholt 21497c8389dSJoe Eykholt u8 pri; 215794d98e7SJoe Eykholt u8 flogi_sent; 21697c8389dSJoe Eykholt u16 flags; 21797c8389dSJoe Eykholt u32 fka_period; 2188cdffdccSYi Zou u8 fd_flags:1; 21997c8389dSJoe Eykholt }; 22097c8389dSJoe Eykholt 2218d55e507SRobert Love #define fcoe_fcf_to_fcf_dev(x) \ 2228d55e507SRobert Love ((x)->fcf_dev) 2238d55e507SRobert Love 224e10f8c66SJoe Eykholt /** 225e10f8c66SJoe Eykholt * struct fcoe_rport - VN2VN remote port 226e10f8c66SJoe Eykholt * @time: time of create or last beacon packet received from node 227e10f8c66SJoe Eykholt * @fcoe_len: max FCoE frame size, not including VLAN or Ethernet headers 228e10f8c66SJoe Eykholt * @flags: flags from probe or claim 229e10f8c66SJoe Eykholt * @login_count: number of unsuccessful rport logins to this port 230e10f8c66SJoe Eykholt * @enode_mac: E_Node control MAC address 231e10f8c66SJoe Eykholt * @vn_mac: VN_Node assigned MAC address for data 232e10f8c66SJoe Eykholt */ 233e10f8c66SJoe Eykholt struct fcoe_rport { 234e10f8c66SJoe Eykholt unsigned long time; 235e10f8c66SJoe Eykholt u16 fcoe_len; 236e10f8c66SJoe Eykholt u16 flags; 237e10f8c66SJoe Eykholt u8 login_count; 238e10f8c66SJoe Eykholt u8 enode_mac[ETH_ALEN]; 239e10f8c66SJoe Eykholt u8 vn_mac[ETH_ALEN]; 240e10f8c66SJoe Eykholt }; 241e10f8c66SJoe Eykholt 24297c8389dSJoe Eykholt /* FIP API functions */ 2433d902ac0SJoe Eykholt void fcoe_ctlr_init(struct fcoe_ctlr *, enum fip_state); 24497c8389dSJoe Eykholt void fcoe_ctlr_destroy(struct fcoe_ctlr *); 24597c8389dSJoe Eykholt void fcoe_ctlr_link_up(struct fcoe_ctlr *); 24697c8389dSJoe Eykholt int fcoe_ctlr_link_down(struct fcoe_ctlr *); 24711b56188SChris Leech int fcoe_ctlr_els_send(struct fcoe_ctlr *, struct fc_lport *, struct sk_buff *); 24897c8389dSJoe Eykholt void fcoe_ctlr_recv(struct fcoe_ctlr *, struct sk_buff *); 24970b51aabSRobert Love int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_lport *, 250386309ceSJoe Eykholt struct fc_frame *); 25197c8389dSJoe Eykholt 25285b4aa49SRobert Love /* libfcoe funcs */ 253fdd78027SVasu Dev u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int); 254e10f8c66SJoe Eykholt int fcoe_libfc_config(struct fc_lport *, struct fcoe_ctlr *, 255e10f8c66SJoe Eykholt const struct libfc_function_template *, int init_fcp); 2568597ae8bSBhanu Prakash Gollapudi u32 fcoe_fc_crc(struct fc_frame *fp); 2578597ae8bSBhanu Prakash Gollapudi int fcoe_start_io(struct sk_buff *skb); 258d834895cSBhanu Prakash Gollapudi int fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type); 259814740d5SBhanu Prakash Gollapudi void __fcoe_get_lesb(struct fc_lport *lport, struct fc_els_lesb *fc_lesb, 260814740d5SBhanu Prakash Gollapudi struct net_device *netdev); 261d834895cSBhanu Prakash Gollapudi void fcoe_wwn_to_str(u64 wwn, char *buf, int len); 262d834895cSBhanu Prakash Gollapudi int fcoe_validate_vport_create(struct fc_vport *vport); 26303702689SYi Zou int fcoe_link_speed_update(struct fc_lport *); 264*57c2728fSYi Zou void fcoe_get_lesb(struct fc_lport *, struct fc_els_lesb *); 265*57c2728fSYi Zou void fcoe_ctlr_get_lesb(struct fcoe_ctlr_device *ctlr_dev); 266fdd78027SVasu Dev 267519e5135SVasu Dev /** 268519e5135SVasu Dev * is_fip_mode() - returns true if FIP mode selected. 269519e5135SVasu Dev * @fip: FCoE controller. 270519e5135SVasu Dev */ 271519e5135SVasu Dev static inline bool is_fip_mode(struct fcoe_ctlr *fip) 272519e5135SVasu Dev { 273519e5135SVasu Dev return fip->state == FIP_ST_ENABLED; 274519e5135SVasu Dev } 275519e5135SVasu Dev 2760ade7d29SYi Zou /* helper for FCoE SW HBA drivers, can include subven and subdev if needed. The 2770ade7d29SYi Zou * modpost would use pci_device_id table to auto-generate formatted module alias 2780ade7d29SYi Zou * into the corresponding .mod.c file, but there may or may not be a pci device 2790ade7d29SYi Zou * id table for FCoE drivers so we use the following helper for build the fcoe 2800ade7d29SYi Zou * driver module alias. 2810ade7d29SYi Zou */ 2820ade7d29SYi Zou #define MODULE_ALIAS_FCOE_PCI(ven, dev) \ 2830ade7d29SYi Zou MODULE_ALIAS("fcoe-pci:" \ 2840ade7d29SYi Zou "v" __stringify(ven) \ 2850ade7d29SYi Zou "d" __stringify(dev) "sv*sd*bc*sc*i*") 2860ade7d29SYi Zou 2870ade7d29SYi Zou /* the name of the default FCoE transport driver fcoe.ko */ 2880ade7d29SYi Zou #define FCOE_TRANSPORT_DEFAULT "fcoe" 2890ade7d29SYi Zou 2900ade7d29SYi Zou /* struct fcoe_transport - The FCoE transport interface 2910ade7d29SYi Zou * @name: a vendor specific name for their FCoE transport driver 2920ade7d29SYi Zou * @attached: whether this transport is already attached 2930ade7d29SYi Zou * @list: list linkage to all attached transports 2940ade7d29SYi Zou * @match: handler to allow the transport driver to match up a given netdev 2956a891b07SRobert Love * @alloc: handler to allocate per-instance FCoE structures 2966a891b07SRobert Love * (no discovery or login) 2970ade7d29SYi Zou * @create: handler to sysfs entry of create for FCoE instances 2986a891b07SRobert Love * @destroy: handler to delete per-instance FCoE structures 2996a891b07SRobert Love * (frees all memory) 3000ade7d29SYi Zou * @enable: handler to sysfs entry of enable for FCoE instances 3010ade7d29SYi Zou * @disable: handler to sysfs entry of disable for FCoE instances 3020ade7d29SYi Zou */ 3030ade7d29SYi Zou struct fcoe_transport { 3040ade7d29SYi Zou char name[IFNAMSIZ]; 3050ade7d29SYi Zou bool attached; 3060ade7d29SYi Zou struct list_head list; 3070ade7d29SYi Zou bool (*match) (struct net_device *device); 3086a891b07SRobert Love int (*alloc) (struct net_device *device); 3090ade7d29SYi Zou int (*create) (struct net_device *device, enum fip_state fip_mode); 3100ade7d29SYi Zou int (*destroy) (struct net_device *device); 3110ade7d29SYi Zou int (*enable) (struct net_device *device); 3120ade7d29SYi Zou int (*disable) (struct net_device *device); 3130ade7d29SYi Zou }; 3140ade7d29SYi Zou 3150ade7d29SYi Zou /** 3168597ae8bSBhanu Prakash Gollapudi * struct fcoe_percpu_s - The context for FCoE receive thread(s) 3178597ae8bSBhanu Prakash Gollapudi * @thread: The thread context 3188597ae8bSBhanu Prakash Gollapudi * @fcoe_rx_list: The queue of pending packets to process 3198597ae8bSBhanu Prakash Gollapudi * @page: The memory page for calculating frame trailer CRCs 3208597ae8bSBhanu Prakash Gollapudi * @crc_eof_offset: The offset into the CRC page pointing to available 3218597ae8bSBhanu Prakash Gollapudi * memory for a new trailer 3228597ae8bSBhanu Prakash Gollapudi */ 3238597ae8bSBhanu Prakash Gollapudi struct fcoe_percpu_s { 3248597ae8bSBhanu Prakash Gollapudi struct task_struct *thread; 3258597ae8bSBhanu Prakash Gollapudi struct sk_buff_head fcoe_rx_list; 3268597ae8bSBhanu Prakash Gollapudi struct page *crc_eof_page; 3278597ae8bSBhanu Prakash Gollapudi int crc_eof_offset; 3288597ae8bSBhanu Prakash Gollapudi }; 3298597ae8bSBhanu Prakash Gollapudi 3308597ae8bSBhanu Prakash Gollapudi /** 3318597ae8bSBhanu Prakash Gollapudi * struct fcoe_port - The FCoE private structure 3328597ae8bSBhanu Prakash Gollapudi * @priv: The associated fcoe interface. The structure is 3338597ae8bSBhanu Prakash Gollapudi * defined by the low level driver 3348597ae8bSBhanu Prakash Gollapudi * @lport: The associated local port 3358597ae8bSBhanu Prakash Gollapudi * @fcoe_pending_queue: The pending Rx queue of skbs 3368597ae8bSBhanu Prakash Gollapudi * @fcoe_pending_queue_active: Indicates if the pending queue is active 3378597ae8bSBhanu Prakash Gollapudi * @max_queue_depth: Max queue depth of pending queue 3388597ae8bSBhanu Prakash Gollapudi * @min_queue_depth: Min queue depth of pending queue 3398597ae8bSBhanu Prakash Gollapudi * @timer: The queue timer 3408597ae8bSBhanu Prakash Gollapudi * @destroy_work: Handle for work context 3418597ae8bSBhanu Prakash Gollapudi * (to prevent RTNL deadlocks) 3428597ae8bSBhanu Prakash Gollapudi * @data_srt_addr: Source address for data 3438597ae8bSBhanu Prakash Gollapudi * 3448597ae8bSBhanu Prakash Gollapudi * An instance of this structure is to be allocated along with the 3458597ae8bSBhanu Prakash Gollapudi * Scsi_Host and libfc fc_lport structures. 3468597ae8bSBhanu Prakash Gollapudi */ 3478597ae8bSBhanu Prakash Gollapudi struct fcoe_port { 3488597ae8bSBhanu Prakash Gollapudi void *priv; 3498597ae8bSBhanu Prakash Gollapudi struct fc_lport *lport; 3508597ae8bSBhanu Prakash Gollapudi struct sk_buff_head fcoe_pending_queue; 3518597ae8bSBhanu Prakash Gollapudi u8 fcoe_pending_queue_active; 3528597ae8bSBhanu Prakash Gollapudi u32 max_queue_depth; 3538597ae8bSBhanu Prakash Gollapudi u32 min_queue_depth; 3548597ae8bSBhanu Prakash Gollapudi struct timer_list timer; 3558597ae8bSBhanu Prakash Gollapudi struct work_struct destroy_work; 3568597ae8bSBhanu Prakash Gollapudi u8 data_src_addr[ETH_ALEN]; 3578106fb47SYi Zou struct net_device * (*get_netdev)(const struct fc_lport *lport); 3588597ae8bSBhanu Prakash Gollapudi }; 35966524ec9SYi Zou 36066524ec9SYi Zou /** 36166524ec9SYi Zou * fcoe_get_netdev() - Return the net device associated with a local port 36266524ec9SYi Zou * @lport: The local port to get the net device from 36366524ec9SYi Zou */ 36466524ec9SYi Zou static inline struct net_device *fcoe_get_netdev(const struct fc_lport *lport) 36566524ec9SYi Zou { 36666524ec9SYi Zou struct fcoe_port *port = ((struct fcoe_port *)lport_priv(lport)); 36766524ec9SYi Zou 36866524ec9SYi Zou return (port->get_netdev) ? port->get_netdev(lport) : NULL; 36966524ec9SYi Zou } 37066524ec9SYi Zou 3718597ae8bSBhanu Prakash Gollapudi void fcoe_clean_pending_queue(struct fc_lport *); 3728597ae8bSBhanu Prakash Gollapudi void fcoe_check_wait_queue(struct fc_lport *lport, struct sk_buff *skb); 3738597ae8bSBhanu Prakash Gollapudi void fcoe_queue_timer(ulong lport); 3748597ae8bSBhanu Prakash Gollapudi int fcoe_get_paged_crc_eof(struct sk_buff *skb, int tlen, 3758597ae8bSBhanu Prakash Gollapudi struct fcoe_percpu_s *fps); 3768597ae8bSBhanu Prakash Gollapudi 3778d55e507SRobert Love /* FCoE Sysfs helpers */ 3788d55e507SRobert Love void fcoe_fcf_get_selected(struct fcoe_fcf_device *); 3796a891b07SRobert Love void fcoe_ctlr_set_fip_mode(struct fcoe_ctlr_device *); 3808d55e507SRobert Love 3818597ae8bSBhanu Prakash Gollapudi /** 3820ade7d29SYi Zou * struct netdev_list 3830ade7d29SYi Zou * A mapping from netdevice to fcoe_transport 3840ade7d29SYi Zou */ 3850ade7d29SYi Zou struct fcoe_netdev_mapping { 3860ade7d29SYi Zou struct list_head list; 3870ade7d29SYi Zou struct net_device *netdev; 3880ade7d29SYi Zou struct fcoe_transport *ft; 3890ade7d29SYi Zou }; 3900ade7d29SYi Zou 3910ade7d29SYi Zou /* fcoe transports registration and deregistration */ 3920ade7d29SYi Zou int fcoe_transport_attach(struct fcoe_transport *ft); 3930ade7d29SYi Zou int fcoe_transport_detach(struct fcoe_transport *ft); 394519e5135SVasu Dev 3956a891b07SRobert Love /* sysfs store handler for ctrl_control interface */ 3966a891b07SRobert Love ssize_t fcoe_ctlr_create_store(struct bus_type *bus, 3976a891b07SRobert Love const char *buf, size_t count); 3986a891b07SRobert Love ssize_t fcoe_ctlr_destroy_store(struct bus_type *bus, 3996a891b07SRobert Love const char *buf, size_t count); 4006a891b07SRobert Love 40185b4aa49SRobert Love #endif /* _LIBFCOE_H */ 4026a891b07SRobert Love 4036a891b07SRobert Love 404