Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
libfcoe.h File Reference
#include <linux/etherdevice.h>
#include <linux/if_ether.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/workqueue.h>
#include <linux/random.h>
#include <scsi/fc/fc_fcoe.h>
#include <scsi/libfc.h>
#include <scsi/fcoe_sysfs.h>

Go to the source code of this file.

Data Structures

struct  fcoe_ctlr
 
struct  fcoe_fcf
 
struct  fcoe_rport
 
struct  fcoe_transport
 
struct  fcoe_percpu_s
 
struct  fcoe_port
 
struct  fcoe_netdev_mapping
 

Macros

#define FCOE_MAX_CMD_LEN   16 /* Supported CDB length */
 
#define FCOE_MTU   2158
 
#define FCOE_CTLR_START_DELAY   2000 /* mS after first adv. to choose FCF */
 
#define FCOE_CTRL_SOL_TOV   2000 /* min. solicitation interval (mS) */
 
#define FCOE_CTLR_FCF_LIMIT   20 /* max. number of FCF entries */
 
#define FCOE_CTLR_VN2VN_LOGIN_LIMIT   3 /* max. VN2VN rport login retries */
 
#define FIP_MODE_AUTO   FIP_ST_AUTO
 
#define FIP_MODE_NON_FIP   FIP_ST_NON_FIP
 
#define FIP_MODE_FABRIC   FIP_ST_ENABLED
 
#define FIP_MODE_VN2VN   FIP_ST_VNMP_START
 
#define fcoe_ctlr_to_ctlr_dev(x)   (struct fcoe_ctlr_device *)(((struct fcoe_ctlr_device *)(x)) - 1)
 
#define fcoe_fcf_to_fcf_dev(x)   ((x)->fcf_dev)
 
#define MODULE_ALIAS_FCOE_PCI(ven, dev)
 
#define FCOE_TRANSPORT_DEFAULT   "fcoe"
 

Enumerations

enum  fip_state {
  FIP_ST_DISABLED, FIP_ST_LINK_WAIT, FIP_ST_AUTO, FIP_ST_NON_FIP,
  FIP_ST_ENABLED, FIP_ST_VNMP_START, FIP_ST_VNMP_PROBE1, FIP_ST_VNMP_PROBE2,
  FIP_ST_VNMP_CLAIM, FIP_ST_VNMP_UP
}
 

Functions

void fcoe_ctlr_init (struct fcoe_ctlr *, enum fip_state)
 
void fcoe_ctlr_destroy (struct fcoe_ctlr *)
 
void fcoe_ctlr_link_up (struct fcoe_ctlr *)
 
int fcoe_ctlr_link_down (struct fcoe_ctlr *)
 
int fcoe_ctlr_els_send (struct fcoe_ctlr *, struct fc_lport *, struct sk_buff *)
 
void fcoe_ctlr_recv (struct fcoe_ctlr *, struct sk_buff *)
 
int fcoe_ctlr_recv_flogi (struct fcoe_ctlr *, struct fc_lport *, struct fc_frame *)
 
u64 fcoe_wwn_from_mac (unsigned char mac[], unsigned int, unsigned int)
 
int fcoe_libfc_config (struct fc_lport *, struct fcoe_ctlr *, const struct libfc_function_template *, int init_fcp)
 
u32 fcoe_fc_crc (struct fc_frame *fp)
 
int fcoe_start_io (struct sk_buff *skb)
 
int fcoe_get_wwn (struct net_device *netdev, u64 *wwn, int type)
 
void __fcoe_get_lesb (struct fc_lport *lport, struct fc_els_lesb *fc_lesb, struct net_device *netdev)
 
void fcoe_wwn_to_str (u64 wwn, char *buf, int len)
 
int fcoe_validate_vport_create (struct fc_vport *vport)
 
void fcoe_clean_pending_queue (struct fc_lport *)
 
void fcoe_check_wait_queue (struct fc_lport *lport, struct sk_buff *skb)
 
void fcoe_queue_timer (ulong lport)
 
int fcoe_get_paged_crc_eof (struct sk_buff *skb, int tlen, struct fcoe_percpu_s *fps)
 
void fcoe_fcf_get_selected (struct fcoe_fcf_device *)
 
void fcoe_ctlr_get_fip_mode (struct fcoe_ctlr_device *)
 
int fcoe_transport_attach (struct fcoe_transport *ft)
 
int fcoe_transport_detach (struct fcoe_transport *ft)
 

Macro Definition Documentation

#define FCOE_CTLR_FCF_LIMIT   20 /* max. number of FCF entries */

Definition at line 47 of file libfcoe.h.

#define FCOE_CTLR_START_DELAY   2000 /* mS after first adv. to choose FCF */

Definition at line 45 of file libfcoe.h.

#define fcoe_ctlr_to_ctlr_dev (   x)    (struct fcoe_ctlr_device *)(((struct fcoe_ctlr_device *)(x)) - 1)

Definition at line 171 of file libfcoe.h.

#define FCOE_CTLR_VN2VN_LOGIN_LIMIT   3 /* max. VN2VN rport login retries */

Definition at line 48 of file libfcoe.h.

#define FCOE_CTRL_SOL_TOV   2000 /* min. solicitation interval (mS) */

Definition at line 46 of file libfcoe.h.

#define fcoe_fcf_to_fcf_dev (   x)    ((x)->fcf_dev)

Definition at line 221 of file libfcoe.h.

#define FCOE_MAX_CMD_LEN   16 /* Supported CDB length */

Definition at line 34 of file libfcoe.h.

#define FCOE_MTU   2158

Definition at line 40 of file libfcoe.h.

#define FCOE_TRANSPORT_DEFAULT   "fcoe"

Definition at line 285 of file libfcoe.h.

#define FIP_MODE_AUTO   FIP_ST_AUTO

Definition at line 81 of file libfcoe.h.

#define FIP_MODE_FABRIC   FIP_ST_ENABLED

Definition at line 83 of file libfcoe.h.

#define FIP_MODE_NON_FIP   FIP_ST_NON_FIP

Definition at line 82 of file libfcoe.h.

#define FIP_MODE_VN2VN   FIP_ST_VNMP_START

Definition at line 84 of file libfcoe.h.

#define MODULE_ALIAS_FCOE_PCI (   ven,
  dev 
)
Value:
MODULE_ALIAS("fcoe-pci:" \
"v" __stringify(ven) \
"d" __stringify(dev) "sv*sd*bc*sc*i*")

Definition at line 279 of file libfcoe.h.

Enumeration Type Documentation

enum fip_state

enum fip_state - internal state of FCoE controller. : controller has been disabled or not yet enabled. : the physical link is down or unusable. : determining whether to use FIP or non-FIP mode. : non-FIP mode selected. : FIP mode selected. : VN2VN multipath mode start, wait : VN2VN sent first probe, listening : VN2VN sent second probe, listening : VN2VN sent claim, waiting for responses : VN2VN multipath mode operation

Enumerator:
FIP_ST_DISABLED 
FIP_ST_LINK_WAIT 
FIP_ST_AUTO 
FIP_ST_NON_FIP 
FIP_ST_ENABLED 
FIP_ST_VNMP_START 
FIP_ST_VNMP_PROBE1 
FIP_ST_VNMP_PROBE2 
FIP_ST_VNMP_CLAIM 
FIP_ST_VNMP_UP 

Definition at line 63 of file libfcoe.h.

Function Documentation

void __fcoe_get_lesb ( struct fc_lport lport,
struct fc_els_lesb fc_lesb,
struct net_device netdev 
)

Definition at line 86 of file fcoe_transport.c.

void fcoe_check_wait_queue ( struct fc_lport lport,
struct sk_buff skb 
)

fcoe_check_wait_queue() - Attempt to clear the transmit backlog : The local port whose backlog is to be cleared

This empties the wait_queue, dequeues the head of the wait_queue queue and calls fcoe_start_io() for each packet. If all skb have been transmitted it returns the qlen. If an error occurs it restores wait_queue (to try again later) and returns -1.

The wait_queue is used when the skb transmit fails. The failed skb will go in the wait_queue which will be emptied by the timer function or by the next skb transmit.

Definition at line 282 of file fcoe_transport.c.

void fcoe_clean_pending_queue ( struct fc_lport lport)

fcoe_clean_pending_queue() - Dequeue a skb and free it : The local port to dequeue a skb on

Definition at line 254 of file fcoe_transport.c.

void fcoe_ctlr_destroy ( struct fcoe_ctlr fip)

fcoe_ctlr_destroy() - Disable and tear down a FCoE controller : The FCoE controller to tear down

This is called by FCoE drivers before freeing the &fcoe_ctlr.

The receive handler will have been deleted before this to guarantee that no more recv_work will be scheduled.

The timer routine will simply return once we set FIP_ST_DISABLED. This guarantees that no further timeouts or work will be scheduled.

Definition at line 265 of file fcoe_ctlr.c.

int fcoe_ctlr_els_send ( struct fcoe_ctlr fip,
struct fc_lport lport,
struct sk_buff skb 
)

fcoe_ctlr_els_send() - Send an ELS frame encapsulated by FIP if appropriate. : FCoE controller. : libfc fc_lport to send from : FCoE ELS frame including FC header but no FCoE headers.

Returns a non-zero error code if the frame should not be sent. Returns zero if the caller should send the frame with FCoE encapsulation.

The caller must check that the length is a multiple of 4. The SKB must have enough headroom (28 bytes) and tailroom (8 bytes). The the skb must also be an fc_frame.

This is called from the lower-level driver with spinlocks held, so we must not take a mutex here.

Definition at line 663 of file fcoe_ctlr.c.

void fcoe_ctlr_get_fip_mode ( struct fcoe_ctlr_device )

Definition at line 2867 of file fcoe_ctlr.c.

void fcoe_ctlr_init ( struct fcoe_ctlr fip,
enum fip_state  mode 
)

fcoe_ctlr_init() - Initialize the FCoE Controller instance : The FCoE controller to initialize

Definition at line 148 of file fcoe_ctlr.c.

int fcoe_ctlr_link_down ( struct fcoe_ctlr fip)

fcoe_ctlr_link_down() - Stop a FCoE controller : The FCoE controller to be stopped

Returns non-zero if the link was up and now isn't.

Called from the LLD when the network link is not ready. There may be multiple calls while the link is down.

Definition at line 464 of file fcoe_ctlr.c.

void fcoe_ctlr_link_up ( struct fcoe_ctlr fip)

fcoe_ctlr_link_up() - Start FCoE controller : The FCoE controller to start

Called from the LLD when the network link is ready.

Definition at line 408 of file fcoe_ctlr.c.

void fcoe_ctlr_recv ( struct fcoe_ctlr fip,
struct sk_buff skb 
)

fcoe_ctlr_recv() - Receive a FIP packet : The FCoE controller that received the packet : The received FIP packet

This may be called from either NET_RX_SOFTIRQ or IRQ.

Definition at line 1446 of file fcoe_ctlr.c.

int fcoe_ctlr_recv_flogi ( struct fcoe_ctlr fip,
struct fc_lport lport,
struct fc_frame fp 
)

fcoe_ctlr_recv_flogi() - Snoop pre-FIP receipt of FLOGI response : The FCoE controller : The FC frame to snoop

Snoop potential response to FLOGI or even incoming FLOGI.

The caller has checked that we are waiting for login as indicated by fip->flogi_oxid != FC_XID_UNKNOWN.

The caller is responsible for freeing the frame. Fill in the granted_mac address.

Return non-zero if the frame should not be delivered to libfc.

Definition at line 1825 of file fcoe_ctlr.c.

u32 fcoe_fc_crc ( struct fc_frame fp)

fcoe_fc_crc() - Calculates the CRC for a given frame : The frame to be checksumed

This uses crc32() routine to calculate the CRC for a frame

Return: The 32 bit CRC value

Definition at line 195 of file fcoe_transport.c.

void fcoe_fcf_get_selected ( struct fcoe_fcf_device )

Definition at line 2847 of file fcoe_ctlr.c.

int fcoe_get_paged_crc_eof ( struct sk_buff skb,
int  tlen,
struct fcoe_percpu_s fps 
)

fcoe_get_paged_crc_eof() - Allocate a page to be used for the trailer CRC : The packet to be transmitted : The total length of the trailer : The fcoe context

This routine allocates a page for frame trailers. The page is re-used if there is enough room left on it for the current trailer. If there isn't enough buffer left a new page is allocated for the trailer. Reference to the page from this function as well as the skbs using the page fragments ensure that the page is freed at the appropriate time.

Returns: 0 for success

Definition at line 353 of file fcoe_transport.c.

int fcoe_get_wwn ( struct net_device netdev,
u64 wwn,
int  type 
)

fcoe_get_wwn() - Get the world wide name from LLD if it supports it : the associated net device : the output WWN : the type of WWN (WWPN or WWNN)

Returns: 0 for success

Definition at line 177 of file fcoe_transport.c.

int fcoe_libfc_config ( struct fc_lport lport,
struct fcoe_ctlr fip,
const struct libfc_function_template tt,
int  init_fcp 
)

fcoe_libfc_config() - Sets up libfc related properties for local port : The local port to configure libfc for : The FCoE controller in use by the local port : The libfc function template : If non-zero, the FCP portion of libfc should be initialized

Returns : 0 for success

Definition at line 2818 of file fcoe_ctlr.c.

void fcoe_queue_timer ( ulong  lport)

fcoe_queue_timer() - The fcoe queue timer : The local port

Calls fcoe_check_wait_queue on timeout

Definition at line 333 of file fcoe_transport.c.

int fcoe_start_io ( struct sk_buff skb)

fcoe_start_io() - Start FCoE I/O : The packet to be transmitted

This routine is called from the net device to start transmitting FCoE packets.

Returns: 0 for success

Definition at line 233 of file fcoe_transport.c.

int fcoe_transport_attach ( struct fcoe_transport ft)

fcoe_transport_attach - Attaches an FCoE transport : The fcoe transport to be attached

Returns : 0 for success

Definition at line 411 of file fcoe_transport.c.

int fcoe_transport_detach ( struct fcoe_transport ft)

fcoe_transport_detach - Detaches an FCoE transport : The fcoe transport to be attached

Returns : 0 for success

Definition at line 444 of file fcoe_transport.c.

int fcoe_validate_vport_create ( struct fc_vport vport)

fcoe_validate_vport_create() - Validate a vport before creating it : NPIV port to be created

This routine is meant to add validation for a vport before creating it via fcoe_vport_create(). Current validations are:

  • WWPN supplied is unique for given lport

Definition at line 135 of file fcoe_transport.c.

u64 fcoe_wwn_from_mac ( unsigned char  mac[],
unsigned  int,
unsigned  int 
)
void fcoe_wwn_to_str ( u64  wwn,
char buf,
int  len 
)

Definition at line 115 of file fcoe_transport.c.