iPXE
Data Structures | Macros | Enumerations | Functions | Variables
fcoe.c File Reference

FCoE protocol. More...

#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <byteswap.h>
#include <ipxe/if_ether.h>
#include <ipxe/if_arp.h>
#include <ipxe/iobuf.h>
#include <ipxe/interface.h>
#include <ipxe/xfer.h>
#include <ipxe/netdevice.h>
#include <ipxe/ethernet.h>
#include <ipxe/vlan.h>
#include <ipxe/features.h>
#include <ipxe/errortab.h>
#include <ipxe/device.h>
#include <ipxe/crc32.h>
#include <ipxe/retry.h>
#include <ipxe/timer.h>
#include <ipxe/fc.h>
#include <ipxe/fip.h>
#include <ipxe/fcoe.h>

Go to the source code of this file.

Data Structures

struct  fcoe_port
 An FCoE port. More...
 
struct  fip_handler
 A FIP handler. More...
 

Macros

#define EINVAL_UNDERLENGTH   __einfo_error ( EINFO_EINVAL_UNDERLENGTH )
 
#define EINFO_EINVAL_UNDERLENGTH   __einfo_uniqify ( EINFO_EINVAL, 0x01, "Underlength packet" )
 
#define EINVAL_SOF   __einfo_error ( EINFO_EINVAL_SOF )
 
#define EINFO_EINVAL_SOF   __einfo_uniqify ( EINFO_EINVAL, 0x02, "Invalid SoF delimiter" )
 
#define EINVAL_CRC   __einfo_error ( EINFO_EINVAL_CRC )
 
#define EINFO_EINVAL_CRC   __einfo_uniqify ( EINFO_EINVAL, 0x03, "Invalid CRC (not stripped?)" )
 
#define EINVAL_EOF   __einfo_error ( EINFO_EINVAL_EOF )
 
#define EINFO_EINVAL_EOF   __einfo_uniqify ( EINFO_EINVAL, 0x04, "Invalid EoF delimiter" )
 
#define FCOE_MAX_VLAN_REQUESTS   2
 Maximum number of VLAN requests before giving up on VLAN discovery. More...
 
#define FCOE_VLAN_RETRY_DELAY   ( TICKS_PER_SEC )
 Delay between retrying VLAN requests. More...
 
#define FCOE_VLAN_POLL_DELAY   ( 30 * TICKS_PER_SEC )
 Delay between retrying polling VLAN requests. More...
 
#define FCOE_MAX_FIP_SOLICITATIONS   2
 Maximum number of FIP solicitations before giving up on FIP. More...
 
#define FCOE_FIP_RETRY_DELAY   ( TICKS_PER_SEC )
 Delay between retrying FIP solicitations. More...
 
#define FCOE_MAX_FIP_MISSING_KEEPALIVES   4
 Maximum number of missing discovery advertisements. More...
 

Enumerations

enum  fcoe_flags {
  FCOE_HAVE_NETWORK = 0x0001, FCOE_HAVE_FCF = 0x0002, FCOE_HAVE_FIP_FCF = 0x0004, FCOE_FCF_ALLOWS_SPMA = 0x0008,
  FCOE_VLAN_FOUND = 0x0010, FCOE_VLAN_TIMED_OUT = 0x0020
}
 FCoE flags. More...
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
 FEATURE (FEATURE_PROTOCOL, "FCoE", DHCP_EB_FEATURE_FCOE, 1)
 
static void fcoe_reset (struct fcoe_port *fcoe)
 Reset FCoE port. More...
 
static int fcoe_deliver (struct fcoe_port *fcoe, struct io_buffer *iobuf, struct xfer_metadata *meta __unused)
 Transmit FCoE packet. More...
 
static struct io_bufferfcoe_alloc_iob (struct fcoe_port *fcoe __unused, size_t len)
 Allocate FCoE I/O buffer. More...
 
static int fcoe_rx (struct io_buffer *iobuf, struct net_device *netdev, const void *ll_dest, const void *ll_source, unsigned int flags __unused)
 Process incoming FCoE packets. More...
 
static size_t fcoe_window (struct fcoe_port *fcoe)
 Check FCoE flow control window. More...
 
static void fcoe_close (struct fcoe_port *fcoe, int rc)
 Close FCoE port. More...
 
static struct devicefcoe_identify_device (struct fcoe_port *fcoe)
 Identify device underlying FCoE port. More...
 
static int fcoe_fip_parse (struct fcoe_port *fcoe, struct fip_header *fiphdr, size_t len, struct fip_descriptors *descs)
 Parse FIP packet into descriptor set. More...
 
static int fcoe_fip_tx_vlan (struct fcoe_port *fcoe)
 Send FIP VLAN request. More...
 
static int fcoe_fip_rx_vlan (struct fcoe_port *fcoe, struct fip_descriptors *descs, unsigned int flags __unused)
 Handle received FIP VLAN notification. More...
 
static int fcoe_fip_tx_solicitation (struct fcoe_port *fcoe)
 Send FIP discovery solicitation. More...
 
static int fcoe_fip_rx_advertisement (struct fcoe_port *fcoe, struct fip_descriptors *descs, unsigned int flags)
 Handle received FIP discovery advertisement. More...
 
static int fcoe_fip_rx_els_response (struct fcoe_port *fcoe, struct fip_descriptors *descs, unsigned int flags __unused)
 Handle received FIP ELS response. More...
 
static int fcoe_fip_tx_keepalive (struct fcoe_port *fcoe)
 Send FIP keepalive. More...
 
static int fcoe_fip_rx (struct io_buffer *iobuf, struct net_device *netdev, const void *ll_dest, const void *ll_source __unused, unsigned int flags __unused)
 Process incoming FIP packets. More...
 
static void fcoe_expired (struct retry_timer *timer, int over __unused)
 Handle FCoE timer expiry. More...
 
static int fcoe_probe (struct net_device *netdev, void *priv)
 Create FCoE port. More...
 
static void fcoe_notify (struct net_device *netdev, void *priv)
 Handle FCoE port device or link state change. More...
 
static void fcoe_remove (struct net_device *netdev __unused, void *priv)
 Destroy FCoE port. More...
 

Variables

struct net_driver fcoe_driver __net_driver
 FCoE driver. More...
 
struct net_protocol fcoe_protocol __net_protocol
 FCoE protocol. More...
 
static uint8_t all_fcoe_macs [ETH_ALEN]
 FCoE All-FCoE-MACs address. More...
 
static uint8_t all_enode_macs [ETH_ALEN]
 FCoE All-ENode-MACs address. More...
 
static uint8_t all_fcf_macs [ETH_ALEN]
 FCoE All-FCF-MACs address. More...
 
static uint8_t default_fcf_mac [ETH_ALEN]
 Default FCoE forwarded MAC address. More...
 
static struct interface_operation fcoe_transport_op []
 FCoE transport interface operations. More...
 
static struct interface_descriptor fcoe_transport_desc
 FCoE transport interface descriptor. More...
 
static struct fip_handler fip_handlers []
 FIP handlers. More...
 
struct errortab fcoe_errors [] __errortab
 Human-readable message for CRC errors. More...
 

Detailed Description

FCoE protocol.

Definition in file fcoe.c.

Macro Definition Documentation

◆ EINVAL_UNDERLENGTH

#define EINVAL_UNDERLENGTH   __einfo_error ( EINFO_EINVAL_UNDERLENGTH )

Definition at line 58 of file fcoe.c.

◆ EINFO_EINVAL_UNDERLENGTH

#define EINFO_EINVAL_UNDERLENGTH   __einfo_uniqify ( EINFO_EINVAL, 0x01, "Underlength packet" )

Definition at line 59 of file fcoe.c.

◆ EINVAL_SOF

#define EINVAL_SOF   __einfo_error ( EINFO_EINVAL_SOF )

Definition at line 61 of file fcoe.c.

◆ EINFO_EINVAL_SOF

#define EINFO_EINVAL_SOF   __einfo_uniqify ( EINFO_EINVAL, 0x02, "Invalid SoF delimiter" )

Definition at line 62 of file fcoe.c.

◆ EINVAL_CRC

#define EINVAL_CRC   __einfo_error ( EINFO_EINVAL_CRC )

Definition at line 64 of file fcoe.c.

◆ EINFO_EINVAL_CRC

#define EINFO_EINVAL_CRC   __einfo_uniqify ( EINFO_EINVAL, 0x03, "Invalid CRC (not stripped?)" )

Definition at line 65 of file fcoe.c.

◆ EINVAL_EOF

#define EINVAL_EOF   __einfo_error ( EINFO_EINVAL_EOF )

Definition at line 67 of file fcoe.c.

◆ EINFO_EINVAL_EOF

#define EINFO_EINVAL_EOF   __einfo_uniqify ( EINFO_EINVAL, 0x04, "Invalid EoF delimiter" )

Definition at line 68 of file fcoe.c.

◆ FCOE_MAX_VLAN_REQUESTS

#define FCOE_MAX_VLAN_REQUESTS   2

Maximum number of VLAN requests before giving up on VLAN discovery.

Definition at line 136 of file fcoe.c.

◆ FCOE_VLAN_RETRY_DELAY

#define FCOE_VLAN_RETRY_DELAY   ( TICKS_PER_SEC )

Delay between retrying VLAN requests.

Definition at line 139 of file fcoe.c.

◆ FCOE_VLAN_POLL_DELAY

#define FCOE_VLAN_POLL_DELAY   ( 30 * TICKS_PER_SEC )

Delay between retrying polling VLAN requests.

Definition at line 142 of file fcoe.c.

◆ FCOE_MAX_FIP_SOLICITATIONS

#define FCOE_MAX_FIP_SOLICITATIONS   2

Maximum number of FIP solicitations before giving up on FIP.

Definition at line 145 of file fcoe.c.

◆ FCOE_FIP_RETRY_DELAY

#define FCOE_FIP_RETRY_DELAY   ( TICKS_PER_SEC )

Delay between retrying FIP solicitations.

Definition at line 148 of file fcoe.c.

◆ FCOE_MAX_FIP_MISSING_KEEPALIVES

#define FCOE_MAX_FIP_MISSING_KEEPALIVES   4

Maximum number of missing discovery advertisements.

Definition at line 151 of file fcoe.c.

Enumeration Type Documentation

◆ fcoe_flags

enum fcoe_flags

FCoE flags.

Enumerator
FCOE_HAVE_NETWORK 

Underlying network device is available.

FCOE_HAVE_FCF 

We have selected an FCoE forwarder to use.

FCOE_HAVE_FIP_FCF 

We have a FIP-capable FCoE forwarder available to be used.

FCOE_FCF_ALLOWS_SPMA 

FCoE forwarder supports server-provided MAC addresses.

FCOE_VLAN_FOUND 

An alternative VLAN has been found.

FCOE_VLAN_TIMED_OUT 

VLAN discovery has timed out.

Definition at line 100 of file fcoe.c.

100  {
101  /** Underlying network device is available */
102  FCOE_HAVE_NETWORK = 0x0001,
103  /** We have selected an FCoE forwarder to use */
104  FCOE_HAVE_FCF = 0x0002,
105  /** We have a FIP-capable FCoE forwarder available to be used */
106  FCOE_HAVE_FIP_FCF = 0x0004,
107  /** FCoE forwarder supports server-provided MAC addresses */
108  FCOE_FCF_ALLOWS_SPMA = 0x0008,
109  /** An alternative VLAN has been found */
110  FCOE_VLAN_FOUND = 0x0010,
111  /** VLAN discovery has timed out */
112  FCOE_VLAN_TIMED_OUT = 0x0020,
113 };
An alternative VLAN has been found.
Definition: fcoe.c:110
Underlying network device is available.
Definition: fcoe.c:102
We have a FIP-capable FCoE forwarder available to be used.
Definition: fcoe.c:106
FCoE forwarder supports server-provided MAC addresses.
Definition: fcoe.c:108
VLAN discovery has timed out.
Definition: fcoe.c:112
We have selected an FCoE forwarder to use.
Definition: fcoe.c:104

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ FEATURE()

FEATURE ( FEATURE_PROTOCOL  ,
"FCoE"  ,
DHCP_EB_FEATURE_FCOE  ,
 
)

◆ fcoe_reset()

static void fcoe_reset ( struct fcoe_port fcoe)
static

Reset FCoE port.

Parameters
fcoeFCoE port

Definition at line 165 of file fcoe.c.

165  {
166 
167  /* Detach FC port, if any */
168  intf_restart ( &fcoe->transport, -ECANCELED );
169 
170  /* Reset any FIP state */
171  stop_timer ( &fcoe->timer );
172  fcoe->timeouts = 0;
173  fcoe->flags = 0;
174  fcoe->priority = ( FIP_LOWEST_PRIORITY + 1 );
175  fcoe->keepalive = 0;
176  memcpy ( fcoe->fcf_mac, default_fcf_mac,
177  sizeof ( fcoe->fcf_mac ) );
178  memcpy ( fcoe->local_mac, fcoe->netdev->ll_addr,
179  sizeof ( fcoe->local_mac ) );
180 
181  /* Start FIP solicitation if network is available */
182  if ( netdev_is_open ( fcoe->netdev ) &&
183  netdev_link_ok ( fcoe->netdev ) ) {
184  fcoe->flags |= FCOE_HAVE_NETWORK;
185  start_timer_nodelay ( &fcoe->timer );
186  DBGC ( fcoe, "FCoE %s starting %s\n", fcoe->netdev->name,
187  ( vlan_can_be_trunk ( fcoe->netdev ) ?
188  "VLAN discovery" : "FIP solicitation" ) );
189  }
190 
191  /* Send notification of window change */
192  xfer_window_changed ( &fcoe->transport );
193 }
void xfer_window_changed(struct interface *intf)
Report change of flow control window.
Definition: xfer.c:146
void intf_restart(struct interface *intf, int rc)
Shut down and restart an object interface.
Definition: interface.c:343
unsigned int priority
FCoE forwarder priority.
Definition: fcoe.c:90
#define FIP_LOWEST_PRIORITY
Lowest FIP priority.
Definition: fip.h:142
static void start_timer_nodelay(struct retry_timer *timer)
Start timer with no delay.
Definition: retry.h:99
unsigned int flags
Flags.
Definition: fcoe.c:88
struct net_device * netdev
Network device.
Definition: fcoe.c:76
unsigned int timeouts
FIP timeout counter.
Definition: fcoe.c:86
#define DBGC(...)
Definition: compiler.h:505
Underlying network device is available.
Definition: fcoe.c:102
uint8_t local_mac[ETH_ALEN]
Local MAC address.
Definition: fcoe.c:96
#define ECANCELED
Operation canceled.
Definition: errno.h:343
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static int netdev_is_open(struct net_device *netdev)
Check whether or not network device is open.
Definition: netdevice.h:661
static int netdev_link_ok(struct net_device *netdev)
Check link state of network device.
Definition: netdevice.h:639
struct retry_timer timer
FIP retransmission timer.
Definition: fcoe.c:84
void stop_timer(struct retry_timer *timer)
Stop timer.
Definition: retry.c:117
int vlan_can_be_trunk(struct net_device *trunk)
Check if network device can be used as a VLAN trunk device.
Definition: vlan.c:329
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
unsigned int keepalive
Keepalive delay (in ms)
Definition: fcoe.c:92
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
Definition: netdevice.h:387
static uint8_t default_fcf_mac[ETH_ALEN]
Default FCoE forwarded MAC address.
Definition: fcoe.c:132
uint8_t fcf_mac[ETH_ALEN]
FCoE forwarder MAC address.
Definition: fcoe.c:94
struct interface transport
Transport interface.
Definition: fcoe.c:74

References DBGC, default_fcf_mac, ECANCELED, fcoe_port::fcf_mac, FCOE_HAVE_NETWORK, FIP_LOWEST_PRIORITY, fcoe_port::flags, intf_restart(), fcoe_port::keepalive, net_device::ll_addr, fcoe_port::local_mac, memcpy(), net_device::name, fcoe_port::netdev, netdev_is_open(), netdev_link_ok(), fcoe_port::priority, start_timer_nodelay(), stop_timer(), fcoe_port::timeouts, fcoe_port::timer, fcoe_port::transport, vlan_can_be_trunk(), and xfer_window_changed().

Referenced by fcoe_expired(), fcoe_fip_rx_advertisement(), and fcoe_notify().

◆ fcoe_deliver()

static int fcoe_deliver ( struct fcoe_port fcoe,
struct io_buffer iobuf,
struct xfer_metadata *meta  __unused 
)
static

Transmit FCoE packet.

Parameters
fcoeFCoE port
iobufI/O buffer
metaData transfer metadata
Return values
rcReturn status code

Definition at line 203 of file fcoe.c.

205  {
206  struct fc_frame_header *fchdr = iobuf->data;
207  struct fc_els_frame_common *els = ( iobuf->data + sizeof ( *fchdr ) );
208  struct fcoe_header *fcoehdr;
209  struct fcoe_footer *fcoeftr;
210  struct fip_header *fiphdr;
211  struct fip_login *fipflogi;
212  struct fip_mac_address *fipmac;
213  uint32_t crc;
214  struct net_protocol *net_protocol;
215  void *ll_source;
216  int rc;
217 
218  /* Send as FIP or FCoE as appropriate */
219  if ( ( fchdr->r_ctl == ( FC_R_CTL_ELS | FC_R_CTL_UNSOL_CTRL ) ) &&
220  ( els->command == FC_ELS_FLOGI ) &&
221  ( fcoe->flags & FCOE_HAVE_FIP_FCF ) ) {
222 
223  /* Create FIP FLOGI descriptor */
224  fipflogi = iob_push ( iobuf,
225  offsetof ( typeof ( *fipflogi ), fc ) );
226  memset ( fipflogi, 0, offsetof ( typeof ( *fipflogi ), fc ) );
227  fipflogi->type = FIP_FLOGI;
228  fipflogi->len = ( iob_len ( iobuf ) / 4 );
229 
230  /* Create FIP MAC address descriptor */
231  fipmac = iob_put ( iobuf, sizeof ( *fipmac ) );
232  memset ( fipmac, 0, sizeof ( *fipmac ) );
233  fipmac->type = FIP_MAC_ADDRESS;
234  fipmac->len = ( sizeof ( *fipmac ) / 4 );
235  if ( fcoe->flags & FCOE_FCF_ALLOWS_SPMA ) {
236  memcpy ( fipmac->mac, fcoe->netdev->ll_addr,
237  sizeof ( fipmac->mac ) );
238  }
239 
240  /* Create FIP header */
241  fiphdr = iob_push ( iobuf, sizeof ( *fiphdr ) );
242  memset ( fiphdr, 0, sizeof ( *fiphdr ) );
243  fiphdr->version = FIP_VERSION;
244  fiphdr->code = htons ( FIP_CODE_ELS );
245  fiphdr->subcode = FIP_ELS_REQUEST;
246  fiphdr->len =
247  htons ( ( iob_len ( iobuf ) - sizeof ( *fiphdr ) ) / 4);
248  fiphdr->flags = ( ( fcoe->flags & FCOE_FCF_ALLOWS_SPMA ) ?
249  htons ( FIP_SP ) : htons ( FIP_FP ) );
250 
251  /* Send as FIP packet from netdev's own MAC address */
252  net_protocol = &fip_protocol;
253  ll_source = fcoe->netdev->ll_addr;
254 
255  } else {
256 
257  /* Calculate CRC */
258  crc = crc32_le ( ~((uint32_t)0), iobuf->data,
259  iob_len ( iobuf ) );
260 
261  /* Create FCoE header */
262  fcoehdr = iob_push ( iobuf, sizeof ( *fcoehdr ) );
263  memset ( fcoehdr, 0, sizeof ( *fcoehdr ) );
264  fcoehdr->sof = ( ( fchdr->seq_cnt == ntohs ( 0 ) ) ?
266 
267  /* Create FCoE footer */
268  fcoeftr = iob_put ( iobuf, sizeof ( *fcoeftr ) );
269  memset ( fcoeftr, 0, sizeof ( *fcoeftr ) );
270  fcoeftr->crc = cpu_to_le32 ( crc ^ ~((uint32_t)0) );
271  fcoeftr->eof = ( ( fchdr->f_ctl_es & FC_F_CTL_ES_END ) ?
273 
274  /* Send as FCoE packet from FCoE MAC address */
275  net_protocol = &fcoe_protocol;
276  ll_source = fcoe->local_mac;
277  }
278 
279  /* Transmit packet */
280  if ( ( rc = net_tx ( iob_disown ( iobuf ), fcoe->netdev, net_protocol,
281  fcoe->fcf_mac, ll_source ) ) != 0 ) {
282  DBGC ( fcoe, "FCoE %s could not transmit: %s\n",
283  fcoe->netdev->name, strerror ( rc ) );
284  goto done;
285  }
286 
287  done:
288  free_iob ( iobuf );
289  return rc;
290 }
A FIP descriptor containing an encapsulated login frame.
Definition: fip.h:219
Fibre Channel ELS frame common parameters.
Definition: fcels.h:22
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define iob_put(iobuf, len)
Definition: iobuf.h:124
unsigned int flags
Flags.
Definition: fcoe.c:88
Fabric Login.
Definition: fcels.h:34
struct net_device * netdev
Network device.
Definition: fcoe.c:76
uint16_t seq_cnt
Sequence count.
Definition: fc.h:146
#define iob_push(iobuf, len)
Definition: iobuf.h:88
u16 fc
802.11 Frame Control field
Definition: ieee80211.h:14
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:152
#define FIP_VERSION
FIP frame version.
Definition: fip.h:47
uint8_t command
ELS command code.
Definition: fcels.h:24
#define DBGC(...)
Definition: compiler.h:505
MAC address.
Definition: fip.h:104
FLOGI.
Definition: fip.h:109
Extended Link Services.
Definition: fc.h:162
#define ntohs(value)
Definition: byteswap.h:136
#define offsetof(type, field)
Get offset of a field within a structure.
Definition: stddef.h:24
uint8_t local_mac[ETH_ALEN]
Local MAC address.
Definition: fcoe.c:96
An FCoE header.
Definition: fcoe.h:50
Last Data Frame of Sequence.
Definition: fc.h:203
uint8_t type
Type.
Definition: fip.h:147
Unsolicited Control.
Definition: fc.h:178
uint8_t len
Length in 32-bit words.
Definition: fip.h:223
End of Frame Terminate.
Definition: fcoe.h:84
u32 crc32_le(u32 seed, const void *data, size_t len)
Calculate 32-bit little-endian CRC checksum.
Definition: crc32.c:39
uint16_t code
Protocol code.
Definition: fip.h:35
A FIP frame header.
Definition: fip.h:29
#define iob_disown(iobuf)
Disown an I/O buffer.
Definition: iobuf.h:216
void * memcpy(void *dest, const void *src, size_t len) __nonnull
uint16_t flags
Flags.
Definition: fip.h:43
We have a FIP-capable FCoE forwarder available to be used.
Definition: fcoe.c:106
uint8_t version
Frame version.
Definition: fip.h:31
#define cpu_to_le32(value)
Definition: byteswap.h:107
FCoE forwarder supports server-provided MAC addresses.
Definition: fcoe.c:108
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
uint8_t len
Length in 32-bit words.
Definition: fip.h:149
uint8_t r_ctl
Routing control.
Definition: fc.h:126
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:159
uint16_t len
Descriptor list length in 32-bit words.
Definition: fip.h:41
A FIP MAC address descriptor.
Definition: fip.h:145
unsigned int uint32_t
Definition: stdint.h:12
A network-layer protocol.
Definition: netdevice.h:64
uint8_t f_ctl_es
Frame control - exchange and sequence.
Definition: fc.h:136
Start of Frame Initiate Class 3.
Definition: fcoe.h:67
Extended link services.
Definition: fip.h:52
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
int net_tx(struct io_buffer *iobuf, struct net_device *netdev, struct net_protocol *net_protocol, const void *ll_dest, const void *ll_source)
Transmit network-layer packet.
Definition: netdevice.c:1073
void * data
Start of data.
Definition: iobuf.h:52
uint8_t mac[ETH_ALEN]
MAC address.
Definition: fip.h:151
typeof(acpi_finder=acpi_find)
ACPI table finder.
Definition: acpi.c:47
uint8_t sof
Start of Frame marker.
Definition: fcoe.h:56
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
Definition: netdevice.h:387
Fabric-provided MAC address.
Definition: fip.h:83
uint8_t subcode
Subcode.
Definition: fip.h:39
ELS request.
Definition: fip.h:65
uint8_t type
Type.
Definition: fip.h:221
Start of Frame Normal Class 3.
Definition: fcoe.h:68
#define htons(value)
Definition: byteswap.h:135
struct bofm_section_header done
Definition: bofm_test.c:46
uint8_t fcf_mac[ETH_ALEN]
FCoE forwarder MAC address.
Definition: fcoe.c:94
Server-provided MAC address.
Definition: fip.h:84
End of Frame Normal.
Definition: fcoe.h:83
A Fibre Channel Frame Header.
Definition: fc.h:120
void * memset(void *dest, int character, size_t len) __nonnull

References fip_header::code, fc_els_frame_common::command, cpu_to_le32, fcoe_footer::crc, crc32_le(), io_buffer::data, DBGC, done, fcoe_footer::eof, fc_frame_header::f_ctl_es, fc, FC_ELS_FLOGI, FC_F_CTL_ES_END, FC_R_CTL_ELS, FC_R_CTL_UNSOL_CTRL, fcoe_port::fcf_mac, FCOE_EOF_N, FCOE_EOF_T, FCOE_FCF_ALLOWS_SPMA, FCOE_HAVE_FIP_FCF, FCOE_SOF_I3, FCOE_SOF_N3, FIP_CODE_ELS, FIP_ELS_REQUEST, FIP_FLOGI, FIP_FP, FIP_MAC_ADDRESS, FIP_SP, FIP_VERSION, fip_header::flags, fcoe_port::flags, free_iob(), htons, iob_disown, iob_len(), iob_push, iob_put, fip_header::len, fip_mac_address::len, fip_login::len, net_device::ll_addr, fcoe_port::local_mac, fip_mac_address::mac, memcpy(), memset(), net_device::name, net_tx(), fcoe_port::netdev, ntohs, offsetof, fc_frame_header::r_ctl, rc, fc_frame_header::seq_cnt, fcoe_header::sof, strerror(), fip_header::subcode, fip_mac_address::type, fip_login::type, typeof(), and fip_header::version.

◆ fcoe_alloc_iob()

static struct io_buffer* fcoe_alloc_iob ( struct fcoe_port *fcoe  __unused,
size_t  len 
)
static

Allocate FCoE I/O buffer.

Parameters
lenPayload length
Return values
iobufI/O buffer, or NULL

Definition at line 298 of file fcoe.c.

299  {
300  struct io_buffer *iobuf;
301 
302  iobuf = alloc_iob ( MAX_LL_HEADER_LEN + sizeof ( struct fcoe_header ) +
303  len + sizeof ( struct fcoe_footer ) );
304  if ( iobuf ) {
305  iob_reserve ( iobuf, ( MAX_LL_HEADER_LEN +
306  sizeof ( struct fcoe_header ) ) );
307  }
308  return iobuf;
309 }
An FCoE header.
Definition: fcoe.h:50
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
Definition: iobuf.c:130
ring len
Length.
Definition: dwmac.h:231
#define MAX_LL_HEADER_LEN
Maximum length of a link-layer header.
Definition: netdevice.h:45
#define iob_reserve(iobuf, len)
Definition: iobuf.h:71
A persistent I/O buffer.
Definition: iobuf.h:37

References alloc_iob(), iob_reserve, len, and MAX_LL_HEADER_LEN.

◆ fcoe_rx()

static int fcoe_rx ( struct io_buffer iobuf,
struct net_device netdev,
const void *  ll_dest,
const void *  ll_source,
unsigned int flags  __unused 
)
static

Process incoming FCoE packets.

Parameters
iobufI/O buffer
netdevNetwork device
ll_destLink-layer destination address
ll_sourceLink-layer source address
flagsPacket flags
Return values
rcReturn status code

Definition at line 321 of file fcoe.c.

323  {
324  struct fcoe_header *fcoehdr;
325  struct fcoe_footer *fcoeftr;
326  struct fcoe_port *fcoe;
327  int rc;
328 
329  /* Identify FCoE port */
330  fcoe = netdev_priv ( netdev, &fcoe_driver );
331  if ( ! fcoe->netdev ) {
332  DBG ( "FCoE received frame for net device %s missing FCoE "
333  "port\n", netdev->name );
334  rc = -ENOTCONN;
335  goto done;
336  }
337 
338  /* Discard packets not destined for us */
339  if ( ( memcmp ( fcoe->local_mac, ll_dest,
340  sizeof ( fcoe->local_mac ) ) != 0 ) &&
341  ( memcmp ( default_fcf_mac, ll_dest,
342  sizeof ( default_fcf_mac ) ) != 0 ) ) {
343  DBGC2 ( fcoe, "FCoE %s ignoring packet for %s\n",
344  fcoe->netdev->name, eth_ntoa ( ll_dest ) );
345  rc = -ENOTCONN;
346  goto done;
347  }
348 
349  /* Sanity check */
350  if ( iob_len ( iobuf ) < ( sizeof ( *fcoehdr ) + sizeof ( *fcoeftr ) )){
351  DBGC ( fcoe, "FCoE %s received under-length frame (%zd "
352  "bytes)\n", fcoe->netdev->name, iob_len ( iobuf ) );
354  goto done;
355  }
356 
357  /* Strip header and footer */
358  fcoehdr = iobuf->data;
359  iob_pull ( iobuf, sizeof ( *fcoehdr ) );
360  fcoeftr = ( iobuf->data + iob_len ( iobuf ) - sizeof ( *fcoeftr ) );
361  iob_unput ( iobuf, sizeof ( *fcoeftr ) );
362 
363  /* Validity checks */
364  if ( fcoehdr->version != FCOE_FRAME_VER ) {
365  DBGC ( fcoe, "FCoE %s received unsupported frame version "
366  "%02x\n", fcoe->netdev->name, fcoehdr->version );
367  rc = -EPROTONOSUPPORT;
368  goto done;
369  }
370  if ( ! ( ( fcoehdr->sof == FCOE_SOF_I3 ) ||
371  ( fcoehdr->sof == FCOE_SOF_N3 ) ) ) {
372  DBGC ( fcoe, "FCoE %s received unsupported start-of-frame "
373  "delimiter %02x\n", fcoe->netdev->name, fcoehdr->sof );
374  rc = -EINVAL_SOF;
375  goto done;
376  }
377  if ( ( le32_to_cpu ( fcoeftr->crc ) ^ ~((uint32_t)0) ) !=
378  crc32_le ( ~((uint32_t)0), iobuf->data, iob_len ( iobuf ) ) ) {
379  DBGC ( fcoe, "FCoE %s received invalid CRC\n",
380  fcoe->netdev->name );
381  rc = -EINVAL_CRC;
382  goto done;
383  }
384  if ( ! ( ( fcoeftr->eof == FCOE_EOF_N ) ||
385  ( fcoeftr->eof == FCOE_EOF_T ) ) ) {
386  DBGC ( fcoe, "FCoE %s received unsupported end-of-frame "
387  "delimiter %02x\n", fcoe->netdev->name, fcoeftr->eof );
388  rc = -EINVAL_EOF;
389  goto done;
390  }
391 
392  /* Record FCF address if applicable */
393  if ( ( fcoe->flags & FCOE_HAVE_FCF ) &&
394  ( ! ( fcoe->flags & FCOE_HAVE_FIP_FCF ) ) ) {
395  memcpy ( &fcoe->fcf_mac, ll_source, sizeof ( fcoe->fcf_mac ) );
396  }
397 
398  /* Hand off via transport interface */
399  if ( ( rc = xfer_deliver_iob ( &fcoe->transport,
400  iob_disown ( iobuf ) ) ) != 0 ) {
401  DBGC ( fcoe, "FCoE %s could not deliver frame: %s\n",
402  fcoe->netdev->name, strerror ( rc ) );
403  goto done;
404  }
405 
406  done:
407  free_iob ( iobuf );
408  return rc;
409 }
#define iob_pull(iobuf, len)
Definition: iobuf.h:106
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define EINVAL_UNDERLENGTH
Definition: fcoe.c:58
int xfer_deliver_iob(struct interface *intf, struct io_buffer *iobuf)
Deliver datagram as I/O buffer without metadata.
Definition: xfer.c:255
unsigned int flags
Flags.
Definition: fcoe.c:88
#define le32_to_cpu(value)
Definition: byteswap.h:113
struct net_device * netdev
Network device.
Definition: fcoe.c:76
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:152
#define DBGC(...)
Definition: compiler.h:505
uint8_t version
FCoE frame version.
Definition: fcoe.h:52
uint8_t local_mac[ETH_ALEN]
Local MAC address.
Definition: fcoe.c:96
An FCoE header.
Definition: fcoe.h:50
End of Frame Terminate.
Definition: fcoe.h:84
u32 crc32_le(u32 seed, const void *data, size_t len)
Calculate 32-bit little-endian CRC checksum.
Definition: crc32.c:39
#define iob_disown(iobuf)
Disown an I/O buffer.
Definition: iobuf.h:216
void * memcpy(void *dest, const void *src, size_t len) __nonnull
void * netdev_priv(struct net_device *netdev, struct net_driver *driver)
Get network device driver private data.
Definition: netdevice.c:152
static struct net_device * netdev
Definition: gdbudp.c:52
We have a FIP-capable FCoE forwarder available to be used.
Definition: fcoe.c:106
#define ENOTCONN
The socket is not connected.
Definition: errno.h:569
#define iob_unput(iobuf, len)
Definition: iobuf.h:139
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:159
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
Definition: ethernet.c:175
An FCoE port.
Definition: fcoe.c:72
unsigned int uint32_t
Definition: stdint.h:12
#define EINVAL_CRC
Definition: fcoe.c:64
#define EINVAL_EOF
Definition: fcoe.c:67
Start of Frame Initiate Class 3.
Definition: fcoe.h:67
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
#define DBGC2(...)
Definition: compiler.h:522
#define EPROTONOSUPPORT
Protocol not supported.
Definition: errno.h:629
#define EINVAL_SOF
Definition: fcoe.c:61
void * data
Start of data.
Definition: iobuf.h:52
We have selected an FCoE forwarder to use.
Definition: fcoe.c:104
uint8_t sof
Start of Frame marker.
Definition: fcoe.h:56
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
#define FCOE_FRAME_VER
FCoE frame version.
Definition: fcoe.h:60
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
Definition: string.c:114
static uint8_t default_fcf_mac[ETH_ALEN]
Default FCoE forwarded MAC address.
Definition: fcoe.c:132
Start of Frame Normal Class 3.
Definition: fcoe.h:68
struct bofm_section_header done
Definition: bofm_test.c:46
uint8_t fcf_mac[ETH_ALEN]
FCoE forwarder MAC address.
Definition: fcoe.c:94
struct interface transport
Transport interface.
Definition: fcoe.c:74
End of Frame Normal.
Definition: fcoe.h:83

References fcoe_footer::crc, crc32_le(), io_buffer::data, DBG, DBGC, DBGC2, default_fcf_mac, done, EINVAL_CRC, EINVAL_EOF, EINVAL_SOF, EINVAL_UNDERLENGTH, ENOTCONN, fcoe_footer::eof, EPROTONOSUPPORT, eth_ntoa(), fcoe_port::fcf_mac, FCOE_EOF_N, FCOE_EOF_T, FCOE_FRAME_VER, FCOE_HAVE_FCF, FCOE_HAVE_FIP_FCF, FCOE_SOF_I3, FCOE_SOF_N3, fcoe_port::flags, free_iob(), iob_disown, iob_len(), iob_pull, iob_unput, le32_to_cpu, fcoe_port::local_mac, memcmp(), memcpy(), net_device::name, netdev, fcoe_port::netdev, netdev_priv(), rc, fcoe_header::sof, strerror(), fcoe_port::transport, fcoe_header::version, and xfer_deliver_iob().

◆ fcoe_window()

static size_t fcoe_window ( struct fcoe_port fcoe)
static

Check FCoE flow control window.

Parameters
fcoeFCoE port
Return values
lenLength of window

Definition at line 417 of file fcoe.c.

417  {
418  return ( ( fcoe->flags & FCOE_HAVE_FCF ) ? ~( ( size_t ) 0 ) : 0 );
419 }
unsigned int flags
Flags.
Definition: fcoe.c:88
We have selected an FCoE forwarder to use.
Definition: fcoe.c:104

References FCOE_HAVE_FCF, and fcoe_port::flags.

◆ fcoe_close()

static void fcoe_close ( struct fcoe_port fcoe,
int  rc 
)
static

Close FCoE port.

Parameters
fcoeFCoE port
rcReason for close

Definition at line 427 of file fcoe.c.

427  {
428 
429  stop_timer ( &fcoe->timer );
430  intf_shutdown ( &fcoe->transport, rc );
431 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
Definition: interface.c:278
struct retry_timer timer
FIP retransmission timer.
Definition: fcoe.c:84
void stop_timer(struct retry_timer *timer)
Stop timer.
Definition: retry.c:117
struct interface transport
Transport interface.
Definition: fcoe.c:74

References intf_shutdown(), rc, stop_timer(), fcoe_port::timer, and fcoe_port::transport.

Referenced by fcoe_remove().

◆ fcoe_identify_device()

static struct device* fcoe_identify_device ( struct fcoe_port fcoe)
static

Identify device underlying FCoE port.

Parameters
fcoeFCoE port
Return values
deviceUnderlying device

Definition at line 439 of file fcoe.c.

439  {
440  return fcoe->netdev->dev;
441 }
struct net_device * netdev
Network device.
Definition: fcoe.c:76
struct device * dev
Underlying hardware device.
Definition: netdevice.h:364

References net_device::dev, and fcoe_port::netdev.

◆ fcoe_fip_parse()

static int fcoe_fip_parse ( struct fcoe_port fcoe,
struct fip_header fiphdr,
size_t  len,
struct fip_descriptors descs 
)
static

Parse FIP packet into descriptor set.

Parameters
fcoeFCoE port
fiphdrFIP header
lenLength of FIP packet
descsDescriptor set to fill in
Return values
rcReturn status code

Definition at line 473 of file fcoe.c.

474  {
475  union fip_descriptor *desc;
476  size_t descs_len;
477  size_t desc_len;
478  size_t desc_offset;
479  unsigned int desc_type;
480 
481  /* Check FIP version */
482  if ( fiphdr->version != FIP_VERSION ) {
483  DBGC ( fcoe, "FCoE %s received unsupported FIP version %02x\n",
484  fcoe->netdev->name, fiphdr->version );
485  return -EINVAL;
486  }
487 
488  /* Check length */
489  descs_len = ( ntohs ( fiphdr->len ) * 4 );
490  if ( ( sizeof ( *fiphdr ) + descs_len ) > len ) {
491  DBGC ( fcoe, "FCoE %s received bad descriptor list length\n",
492  fcoe->netdev->name );
493  return -EINVAL;
494  }
495 
496  /* Parse descriptor list */
497  memset ( descs, 0, sizeof ( *descs ) );
498  for ( desc_offset = 0 ;
499  desc_offset <= ( descs_len - sizeof ( desc->common ) ) ;
500  desc_offset += desc_len ) {
501 
502  /* Find descriptor and validate length */
503  desc = ( ( ( void * ) ( fiphdr + 1 ) ) + desc_offset );
504  desc_type = desc->common.type;
505  desc_len = ( desc->common.len * 4 );
506  if ( desc_len == 0 ) {
507  DBGC ( fcoe, "FCoE %s received zero-length "
508  "descriptor\n", fcoe->netdev->name );
509  return -EINVAL;
510  }
511  if ( ( desc_offset + desc_len ) > descs_len ) {
512  DBGC ( fcoe, "FCoE %s descriptor overrun\n",
513  fcoe->netdev->name );
514  return -EINVAL;
515  }
516 
517  /* Handle descriptors that we understand */
518  if ( ( desc_type > FIP_RESERVED ) &&
519  ( desc_type < FIP_NUM_DESCRIPTOR_TYPES ) ) {
520  /* Use only the first instance of a descriptor */
521  if ( descs->desc[desc_type] == NULL )
522  descs->desc[desc_type] = desc;
523  continue;
524  }
525 
526  /* Abort if we cannot understand a critical descriptor */
527  if ( FIP_IS_CRITICAL ( desc_type ) ) {
528  DBGC ( fcoe, "FCoE %s cannot understand critical "
529  "descriptor type %02x\n",
530  fcoe->netdev->name, desc_type );
531  return -ENOTSUP;
532  }
533 
534  /* Ignore non-critical descriptors that we cannot understand */
535  }
536 
537  return 0;
538 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
Reserved.
Definition: fip.h:102
struct net_device * netdev
Network device.
Definition: fcoe.c:76
#define FIP_VERSION
FIP frame version.
Definition: fip.h:47
#define DBGC(...)
Definition: compiler.h:505
#define ntohs(value)
Definition: byteswap.h:136
#define ENOTSUP
Operation not supported.
Definition: errno.h:589
struct ena_llq_option desc
Descriptor counts.
Definition: ena.h:20
ring len
Length.
Definition: dwmac.h:231
uint8_t version
Frame version.
Definition: fip.h:31
uint16_t len
Descriptor list length in 32-bit words.
Definition: fip.h:41
union fip_descriptor * desc[FIP_NUM_DESCRIPTOR_TYPES]
Descriptors, indexed by type.
Definition: fip.h:408
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
A FIP descriptor.
Definition: fip.h:348
#define FIP_IS_CRITICAL(type)
FIP descriptor type is critical.
Definition: fip.h:121
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
void * memset(void *dest, int character, size_t len) __nonnull

References DBGC, desc, fip_descriptors::desc, EINVAL, ENOTSUP, FIP_IS_CRITICAL, FIP_NUM_DESCRIPTOR_TYPES, FIP_RESERVED, FIP_VERSION, fip_header::len, len, memset(), net_device::name, fcoe_port::netdev, ntohs, NULL, and fip_header::version.

Referenced by fcoe_fip_rx().

◆ fcoe_fip_tx_vlan()

static int fcoe_fip_tx_vlan ( struct fcoe_port fcoe)
static

Send FIP VLAN request.

Parameters
fcoeFCoE port
Return values
rcReturn status code

Definition at line 546 of file fcoe.c.

546  {
547  struct io_buffer *iobuf;
548  struct {
549  struct fip_header hdr;
550  struct fip_mac_address mac_address;
551  } __attribute__ (( packed )) *request;
552  int rc;
553 
554  /* Allocate I/O buffer */
555  iobuf = alloc_iob ( MAX_LL_HEADER_LEN + sizeof ( *request ) );
556  if ( ! iobuf )
557  return -ENOMEM;
558  iob_reserve ( iobuf, MAX_LL_HEADER_LEN );
559 
560  /* Construct VLAN request */
561  request = iob_put ( iobuf, sizeof ( *request ) );
562  memset ( request, 0, sizeof ( *request ) );
563  request->hdr.version = FIP_VERSION;
564  request->hdr.code = htons ( FIP_CODE_VLAN );
565  request->hdr.subcode = FIP_VLAN_REQUEST;
566  request->hdr.len = htons ( ( sizeof ( *request ) -
567  sizeof ( request->hdr ) ) / 4 );
568  request->mac_address.type = FIP_MAC_ADDRESS;
569  request->mac_address.len =
570  ( sizeof ( request->mac_address ) / 4 );
571  memcpy ( request->mac_address.mac, fcoe->netdev->ll_addr,
572  sizeof ( request->mac_address.mac ) );
573 
574  /* Send VLAN request */
575  if ( ( rc = net_tx ( iob_disown ( iobuf ), fcoe->netdev,
576  &fip_protocol, all_fcf_macs,
577  fcoe->netdev->ll_addr ) ) != 0 ) {
578  DBGC ( fcoe, "FCoE %s could not send VLAN request: "
579  "%s\n", fcoe->netdev->name, strerror ( rc ) );
580  return rc;
581  }
582 
583  return 0;
584 }
#define __attribute__(x)
Definition: compiler.h:10
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define iob_put(iobuf, len)
Definition: iobuf.h:124
struct net_device * netdev
Network device.
Definition: fcoe.c:76
struct golan_inbox_hdr hdr
Message header.
Definition: CIB_PRM.h:28
#define FIP_VERSION
FIP frame version.
Definition: fip.h:47
#define DBGC(...)
Definition: compiler.h:505
MAC address.
Definition: fip.h:104
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
Definition: iobuf.c:130
A FIP frame header.
Definition: fip.h:29
#define ENOMEM
Not enough space.
Definition: errno.h:534
#define iob_disown(iobuf)
Disown an I/O buffer.
Definition: iobuf.h:216
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static uint8_t all_fcf_macs[ETH_ALEN]
FCoE All-FCF-MACs address.
Definition: fcoe.c:128
#define MAX_LL_HEADER_LEN
Maximum length of a link-layer header.
Definition: netdevice.h:45
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
VLAN.
Definition: fip.h:54
A FIP MAC address descriptor.
Definition: fip.h:145
#define iob_reserve(iobuf, len)
Definition: iobuf.h:71
VLAN request.
Definition: fip.h:77
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
int net_tx(struct io_buffer *iobuf, struct net_device *netdev, struct net_protocol *net_protocol, const void *ll_dest, const void *ll_source)
Transmit network-layer packet.
Definition: netdevice.c:1073
u8 request[0]
List of IEs requested.
Definition: ieee80211.h:16
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
Definition: netdevice.h:387
#define htons(value)
Definition: byteswap.h:135
void * memset(void *dest, int character, size_t len) __nonnull
A persistent I/O buffer.
Definition: iobuf.h:37

References __attribute__, all_fcf_macs, alloc_iob(), DBGC, ENOMEM, FIP_CODE_VLAN, FIP_MAC_ADDRESS, FIP_VERSION, FIP_VLAN_REQUEST, hdr, htons, iob_disown, iob_put, iob_reserve, net_device::ll_addr, MAX_LL_HEADER_LEN, memcpy(), memset(), net_device::name, net_tx(), fcoe_port::netdev, rc, request, and strerror().

Referenced by fcoe_expired().

◆ fcoe_fip_rx_vlan()

static int fcoe_fip_rx_vlan ( struct fcoe_port fcoe,
struct fip_descriptors descs,
unsigned int flags  __unused 
)
static

Handle received FIP VLAN notification.

Parameters
fcoeFCoE port
descsDescriptor list
flagsFlags
Return values
rcReturn status code

Definition at line 594 of file fcoe.c.

596  {
597  struct fip_mac_address *mac_address = fip_mac_address ( descs );
598  struct fip_vlan *vlan = fip_vlan ( descs );
599  unsigned int tag;
600  int rc;
601 
602  /* Sanity checks */
603  if ( ! mac_address ) {
604  DBGC ( fcoe, "FCoE %s received VLAN notification missing MAC "
605  "address\n", fcoe->netdev->name );
606  return -EINVAL;
607  }
608  if ( ! vlan ) {
609  DBGC ( fcoe, "FCoE %s received VLAN notification missing VLAN "
610  "tag\n", fcoe->netdev->name );
611  return -EINVAL;
612  }
613 
614  /* Create VLAN */
615  tag = ntohs ( vlan->vlan );
616  DBGC ( fcoe, "FCoE %s creating VLAN %d for FCF %s\n",
617  fcoe->netdev->name, tag, eth_ntoa ( mac_address->mac ) );
618  if ( ( rc = vlan_create ( fcoe->netdev, tag,
619  FCOE_VLAN_PRIORITY ) ) != 0 ) {
620  DBGC ( fcoe, "FCoE %s could not create VLAN %d: %s\n",
621  fcoe->netdev->name, tag, strerror ( rc ) );
622  return rc;
623  }
624 
625  /* Record that a VLAN was found. This FCoE port will play no
626  * further active role; the real FCoE traffic will use the
627  * port automatically created for the new VLAN device.
628  */
629  fcoe->flags |= FCOE_VLAN_FOUND;
630 
631  return 0;
632 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
An alternative VLAN has been found.
Definition: fcoe.c:110
unsigned int flags
Flags.
Definition: fcoe.c:88
struct net_device * netdev
Network device.
Definition: fcoe.c:76
#define FCOE_VLAN_PRIORITY
FCoE VLAN priority.
Definition: fcoe.h:90
#define DBGC(...)
Definition: compiler.h:505
#define ntohs(value)
Definition: byteswap.h:136
int vlan_create(struct net_device *trunk, unsigned int tag, unsigned int priority)
Create VLAN device.
Definition: vlan.c:343
A FIP VLAN descriptor.
Definition: fip.h:338
uint16_t vlan
VLAN ID.
Definition: fip.h:344
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
Definition: ethernet.c:175
A FIP MAC address descriptor.
Definition: fip.h:145
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
uint8_t mac[ETH_ALEN]
MAC address.
Definition: fip.h:151
uint64_t tag
Identity tag.
Definition: edd.h:30

References DBGC, EINVAL, eth_ntoa(), FCOE_VLAN_FOUND, FCOE_VLAN_PRIORITY, fcoe_port::flags, fip_mac_address::mac, net_device::name, fcoe_port::netdev, ntohs, rc, strerror(), tag, fip_vlan::vlan, and vlan_create().

◆ fcoe_fip_tx_solicitation()

static int fcoe_fip_tx_solicitation ( struct fcoe_port fcoe)
static

Send FIP discovery solicitation.

Parameters
fcoeFCoE port
Return values
rcReturn status code

Definition at line 640 of file fcoe.c.

640  {
641  struct io_buffer *iobuf;
642  struct {
643  struct fip_header hdr;
644  struct fip_mac_address mac_address;
645  struct fip_name_id name_id;
646  struct fip_max_fcoe_size max_fcoe_size;
647  } __attribute__ (( packed )) *solicitation;
648  int rc;
649 
650  /* Allocate I/O buffer */
651  iobuf = alloc_iob ( MAX_LL_HEADER_LEN + sizeof ( *solicitation ) );
652  if ( ! iobuf )
653  return -ENOMEM;
654  iob_reserve ( iobuf, MAX_LL_HEADER_LEN );
655 
656  /* Construct discovery solicitation */
657  solicitation = iob_put ( iobuf, sizeof ( *solicitation ) );
658  memset ( solicitation, 0, sizeof ( *solicitation ) );
659  solicitation->hdr.version = FIP_VERSION;
660  solicitation->hdr.code = htons ( FIP_CODE_DISCOVERY );
661  solicitation->hdr.subcode = FIP_DISCOVERY_SOLICIT;
662  solicitation->hdr.len = htons ( ( sizeof ( *solicitation ) -
663  sizeof ( solicitation->hdr ) ) / 4 );
664  solicitation->hdr.flags = htons ( FIP_FP | FIP_SP );
665  solicitation->mac_address.type = FIP_MAC_ADDRESS;
666  solicitation->mac_address.len =
667  ( sizeof ( solicitation->mac_address ) / 4 );
668  memcpy ( solicitation->mac_address.mac, fcoe->netdev->ll_addr,
669  sizeof ( solicitation->mac_address.mac ) );
670  solicitation->name_id.type = FIP_NAME_ID;
671  solicitation->name_id.len = ( sizeof ( solicitation->name_id ) / 4 );
672  memcpy ( &solicitation->name_id.name, &fcoe->node_wwn.fc,
673  sizeof ( solicitation->name_id.name ) );
674  solicitation->max_fcoe_size.type = FIP_MAX_FCOE_SIZE;
675  solicitation->max_fcoe_size.len =
676  ( sizeof ( solicitation->max_fcoe_size ) / 4 );
677  solicitation->max_fcoe_size.mtu =
678  htons ( ETH_MAX_MTU - sizeof ( struct fcoe_header ) -
679  sizeof ( struct fcoe_footer ) );
680 
681  /* Send discovery solicitation */
682  if ( ( rc = net_tx ( iob_disown ( iobuf ), fcoe->netdev,
683  &fip_protocol, all_fcf_macs,
684  fcoe->netdev->ll_addr ) ) != 0 ) {
685  DBGC ( fcoe, "FCoE %s could not send discovery solicitation: "
686  "%s\n", fcoe->netdev->name, strerror ( rc ) );
687  return rc;
688  }
689 
690  return 0;
691 }
#define __attribute__(x)
Definition: compiler.h:10
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define iob_put(iobuf, len)
Definition: iobuf.h:124
struct net_device * netdev
Network device.
Definition: fcoe.c:76
struct golan_inbox_hdr hdr
Message header.
Definition: CIB_PRM.h:28
#define FIP_VERSION
FIP frame version.
Definition: fip.h:47
#define DBGC(...)
Definition: compiler.h:505
MAC address.
Definition: fip.h:104
Max FCoE size.
Definition: fip.h:108
#define ETH_MAX_MTU
Definition: if_ether.h:14
An FCoE header.
Definition: fcoe.h:50
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
Definition: iobuf.c:130
A FIP frame header.
Definition: fip.h:29
#define ENOMEM
Not enough space.
Definition: errno.h:534
#define iob_disown(iobuf)
Disown an I/O buffer.
Definition: iobuf.h:216
void * memcpy(void *dest, const void *src, size_t len) __nonnull
Discovery solicitation.
Definition: fip.h:59
static uint8_t all_fcf_macs[ETH_ALEN]
FCoE All-FCF-MACs address.
Definition: fcoe.c:128
#define MAX_LL_HEADER_LEN
Maximum length of a link-layer header.
Definition: netdevice.h:45
union fcoe_name node_wwn
Node WWN.
Definition: fcoe.c:79
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
Name identifier.
Definition: fip.h:106
A FIP MAC address descriptor.
Definition: fip.h:145
A FIP max FCoE size descriptor.
Definition: fip.h:195
struct fc_name fc
Fibre Channel name.
Definition: fcoe.h:20
#define iob_reserve(iobuf, len)
Definition: iobuf.h:71
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
int net_tx(struct io_buffer *iobuf, struct net_device *netdev, struct net_protocol *net_protocol, const void *ll_dest, const void *ll_source)
Transmit network-layer packet.
Definition: netdevice.c:1073
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
Definition: netdevice.h:387
Fabric-provided MAC address.
Definition: fip.h:83
A FIP name identifier descriptor.
Definition: fip.h:167
Discovery.
Definition: fip.h:51
#define htons(value)
Definition: byteswap.h:135
Server-provided MAC address.
Definition: fip.h:84
void * memset(void *dest, int character, size_t len) __nonnull
A persistent I/O buffer.
Definition: iobuf.h:37

References __attribute__, all_fcf_macs, alloc_iob(), DBGC, ENOMEM, ETH_MAX_MTU, fcoe_name::fc, FIP_CODE_DISCOVERY, FIP_DISCOVERY_SOLICIT, FIP_FP, FIP_MAC_ADDRESS, FIP_MAX_FCOE_SIZE, FIP_NAME_ID, FIP_SP, FIP_VERSION, hdr, htons, iob_disown, iob_put, iob_reserve, net_device::ll_addr, MAX_LL_HEADER_LEN, memcpy(), memset(), net_device::name, net_tx(), fcoe_port::netdev, fcoe_port::node_wwn, rc, and strerror().

Referenced by fcoe_expired().

◆ fcoe_fip_rx_advertisement()

static int fcoe_fip_rx_advertisement ( struct fcoe_port fcoe,
struct fip_descriptors descs,
unsigned int  flags 
)
static

Handle received FIP discovery advertisement.

Parameters
fcoeFCoE port
descsDescriptor list
flagsFlags
Return values
rcReturn status code

Definition at line 701 of file fcoe.c.

703  {
704  struct fip_priority *priority = fip_priority ( descs );
705  struct fip_mac_address *mac_address = fip_mac_address ( descs );
706  struct fip_fka_adv_p *fka_adv_p = fip_fka_adv_p ( descs );
707 
708  /* Sanity checks */
709  if ( ! priority ) {
710  DBGC ( fcoe, "FCoE %s received advertisement missing "
711  "priority\n", fcoe->netdev->name );
712  return -EINVAL;
713  }
714  if ( ! mac_address ) {
715  DBGC ( fcoe, "FCoE %s received advertisement missing MAC "
716  "address\n", fcoe->netdev->name );
717  return -EINVAL;
718  }
719  if ( ! fka_adv_p ) {
720  DBGC ( fcoe, "FCoE %s received advertisement missing FKA ADV "
721  "period\n", fcoe->netdev->name );
722  return -EINVAL;
723  }
724 
725  if ( ! ( fcoe->flags & FCOE_HAVE_FCF ) ) {
726 
727  /* We are soliciting for an FCF. Store the highest
728  * (i.e. lowest-valued) priority solicited
729  * advertisement that we receive.
730  */
731  if ( ( ( flags & ( FIP_A | FIP_S | FIP_F ) ) ==
732  ( FIP_A | FIP_S | FIP_F ) ) &&
733  ( priority->priority < fcoe->priority ) ) {
734 
735  fcoe->flags |= FCOE_HAVE_FIP_FCF;
736  fcoe->priority = priority->priority;
737  if ( fka_adv_p->flags & FIP_NO_KEEPALIVE ) {
738  fcoe->keepalive = 0;
739  } else {
740  fcoe->keepalive = ntohl ( fka_adv_p->period );
741  }
742  fcoe->flags &= ~FCOE_FCF_ALLOWS_SPMA;
743  if ( flags & FIP_SP )
744  fcoe->flags |= FCOE_FCF_ALLOWS_SPMA;
745  memcpy ( fcoe->fcf_mac, mac_address->mac,
746  sizeof ( fcoe->fcf_mac ) );
747  DBGC ( fcoe, "FCoE %s selected FCF %s (pri %d",
748  fcoe->netdev->name, eth_ntoa ( fcoe->fcf_mac ),
749  fcoe->priority );
750  if ( fcoe->keepalive ) {
751  DBGC ( fcoe, ", FKA ADV %dms",
752  fcoe->keepalive );
753  }
754  DBGC ( fcoe, ", %cPMA)\n",
755  ( ( fcoe->flags & FCOE_FCF_ALLOWS_SPMA ) ?
756  'S' : 'F' ) );
757  }
758 
759  } else if ( fcoe->flags & FCOE_HAVE_FIP_FCF ) {
760 
761  /* We are checking that the FCF remains alive. Reset
762  * the timeout counter if this is an advertisement
763  * from our forwarder.
764  */
765  if ( memcmp ( fcoe->fcf_mac, mac_address->mac,
766  sizeof ( fcoe->fcf_mac ) ) == 0 ) {
767  fcoe->timeouts = 0;
768  }
769 
770  } else {
771 
772  /* We are operating in non-FIP mode and have received
773  * a FIP advertisement. Reset the link in order to
774  * attempt FIP.
775  */
776  fcoe_reset ( fcoe );
777 
778  }
779 
780  return 0;
781 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
unsigned int priority
FCoE forwarder priority.
Definition: fcoe.c:90
unsigned int flags
Flags.
Definition: fcoe.c:88
A FIP priority descriptor.
Definition: fip.h:124
struct net_device * netdev
Network device.
Definition: fcoe.c:76
uint8_t flags
Flags.
Definition: fip.h:315
unsigned int timeouts
FIP timeout counter.
Definition: fcoe.c:86
#define DBGC(...)
Definition: compiler.h:505
#define ntohl(value)
Definition: byteswap.h:134
Forwarder.
Definition: fip.h:87
Available for login.
Definition: fip.h:85
void * memcpy(void *dest, const void *src, size_t len) __nonnull
We have a FIP-capable FCoE forwarder available to be used.
Definition: fcoe.c:106
static void fcoe_reset(struct fcoe_port *fcoe)
Reset FCoE port.
Definition: fcoe.c:165
FCoE forwarder supports server-provided MAC addresses.
Definition: fcoe.c:108
uint8_t flags
Flags.
Definition: ena.h:18
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
Definition: ethernet.c:175
A FIP MAC address descriptor.
Definition: fip.h:145
A FIP FKA ADV period descriptor.
Definition: fip.h:307
Solicited.
Definition: fip.h:86
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
unsigned int keepalive
Keepalive delay (in ms)
Definition: fcoe.c:92
uint16_t priority
Priotity.
Definition: stp.h:12
We have selected an FCoE forwarder to use.
Definition: fcoe.c:104
uint8_t mac[ETH_ALEN]
MAC address.
Definition: fip.h:151
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
Definition: string.c:114
Do not send keepalives.
Definition: fip.h:322
uint8_t fcf_mac[ETH_ALEN]
FCoE forwarder MAC address.
Definition: fcoe.c:94
uint32_t period
Keep alive advertisement period in milliseconds.
Definition: fip.h:317
Server-provided MAC address.
Definition: fip.h:84

References DBGC, EINVAL, eth_ntoa(), fcoe_port::fcf_mac, FCOE_FCF_ALLOWS_SPMA, FCOE_HAVE_FCF, FCOE_HAVE_FIP_FCF, fcoe_reset(), FIP_A, FIP_F, FIP_NO_KEEPALIVE, FIP_S, FIP_SP, flags, fcoe_port::flags, fip_fka_adv_p::flags, fcoe_port::keepalive, fip_mac_address::mac, memcmp(), memcpy(), net_device::name, fcoe_port::netdev, ntohl, fip_fka_adv_p::period, priority, fcoe_port::priority, and fcoe_port::timeouts.

◆ fcoe_fip_rx_els_response()

static int fcoe_fip_rx_els_response ( struct fcoe_port fcoe,
struct fip_descriptors descs,
unsigned int flags  __unused 
)
static

Handle received FIP ELS response.

Parameters
fcoeFCoE port
descsDescriptor list
flagsFlags
Return values
rcReturn status code

Definition at line 791 of file fcoe.c.

793  {
794  struct fip_els *flogi = fip_flogi ( descs );
795  struct fip_mac_address *mac_address = fip_mac_address ( descs );
796  void *frame;
797  size_t frame_len;
798  int rc;
799 
800  /* Sanity checks */
801  if ( ! flogi ) {
802  DBGC ( fcoe, "FCoE %s received ELS response missing FLOGI\n",
803  fcoe->netdev->name );
804  return -EINVAL;
805  }
806  if ( ! mac_address ) {
807  DBGC ( fcoe, "FCoE %s received ELS response missing MAC "
808  "address\n", fcoe->netdev->name );
809  return -EINVAL;
810  }
811 
812  /* Record local MAC address */
813  memcpy ( fcoe->local_mac, mac_address->mac, sizeof ( fcoe->local_mac ));
814  DBGC ( fcoe, "FCoE %s using local MAC %s\n",
815  fcoe->netdev->name, eth_ntoa ( fcoe->local_mac ) );
816 
817  /* Hand off via transport interface */
818  frame = &flogi->fc;
819  frame_len = ( ( flogi->len * 4 ) - offsetof ( typeof ( *flogi ), fc ) );
820  if ( ( rc = xfer_deliver_raw ( &fcoe->transport, frame,
821  frame_len ) ) != 0 ) {
822  DBGC ( fcoe, "FCoE %s could not deliver FIP FLOGI frame: %s\n",
823  fcoe->netdev->name, strerror ( rc ) );
824  return rc;
825  }
826 
827  return 0;
828 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
struct net_device * netdev
Network device.
Definition: fcoe.c:76
u16 fc
802.11 Frame Control field
Definition: ieee80211.h:14
#define DBGC(...)
Definition: compiler.h:505
#define offsetof(type, field)
Get offset of a field within a structure.
Definition: stddef.h:24
uint8_t local_mac[ETH_ALEN]
Local MAC address.
Definition: fcoe.c:96
int xfer_deliver_raw(struct interface *intf, const void *data, size_t len)
Deliver datagram as raw data without metadata.
Definition: xfer.c:288
unsigned long frame
Definition: xengrant.h:179
void * memcpy(void *dest, const void *src, size_t len) __nonnull
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
Definition: ethernet.c:175
A FIP MAC address descriptor.
Definition: fip.h:145
A FIP descriptor containing an encapsulated ELS frame.
Definition: fip.h:205
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
uint8_t mac[ETH_ALEN]
MAC address.
Definition: fip.h:151
typeof(acpi_finder=acpi_find)
ACPI table finder.
Definition: acpi.c:47
struct fc_frame_header fc
Fibre Channel frame header.
Definition: fip.h:213
uint8_t len
Length in 32-bit words.
Definition: fip.h:209
struct interface transport
Transport interface.
Definition: fcoe.c:74

References DBGC, EINVAL, eth_ntoa(), fc, fip_els::fc, frame, fip_els::len, fcoe_port::local_mac, fip_mac_address::mac, memcpy(), net_device::name, fcoe_port::netdev, offsetof, rc, strerror(), fcoe_port::transport, typeof(), and xfer_deliver_raw().

◆ fcoe_fip_tx_keepalive()

static int fcoe_fip_tx_keepalive ( struct fcoe_port fcoe)
static

Send FIP keepalive.

Parameters
fcoeFCoE port
Return values
rcReturn status code

Definition at line 836 of file fcoe.c.

836  {
837  struct io_buffer *iobuf;
838  struct {
839  struct fip_header hdr;
840  struct fip_mac_address mac_address;
841  } __attribute__ (( packed )) *keepalive;
842  int rc;
843 
844  /* Allocate I/O buffer */
845  iobuf = alloc_iob ( MAX_LL_HEADER_LEN + sizeof ( *keepalive ) );
846  if ( ! iobuf )
847  return -ENOMEM;
848  iob_reserve ( iobuf, MAX_LL_HEADER_LEN );
849 
850  /* Construct keepalive */
851  keepalive = iob_put ( iobuf, sizeof ( *keepalive ) );
852  memset ( keepalive, 0, sizeof ( *keepalive ) );
853  keepalive->hdr.version = FIP_VERSION;
854  keepalive->hdr.code = htons ( FIP_CODE_MAINTAIN );
855  keepalive->hdr.subcode = FIP_MAINTAIN_KEEP_ALIVE;
856  keepalive->hdr.len = htons ( ( sizeof ( *keepalive ) -
857  sizeof ( keepalive->hdr ) ) / 4 );
858  keepalive->mac_address.type = FIP_MAC_ADDRESS;
859  keepalive->mac_address.len =
860  ( sizeof ( keepalive->mac_address ) / 4 );
861  memcpy ( keepalive->mac_address.mac, fcoe->netdev->ll_addr,
862  sizeof ( keepalive->mac_address.mac ) );
863 
864  /* Send keepalive */
865  if ( ( rc = net_tx ( iob_disown ( iobuf ), fcoe->netdev,
866  &fip_protocol, fcoe->fcf_mac,
867  fcoe->netdev->ll_addr ) ) != 0 ) {
868  DBGC ( fcoe, "FCoE %s could not send keepalive: %s\n",
869  fcoe->netdev->name, strerror ( rc ) );
870  return rc;
871  }
872 
873  return 0;
874 }
#define __attribute__(x)
Definition: compiler.h:10
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define iob_put(iobuf, len)
Definition: iobuf.h:124
struct net_device * netdev
Network device.
Definition: fcoe.c:76
struct golan_inbox_hdr hdr
Message header.
Definition: CIB_PRM.h:28
#define FIP_VERSION
FIP frame version.
Definition: fip.h:47
#define DBGC(...)
Definition: compiler.h:505
MAC address.
Definition: fip.h:104
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
Definition: iobuf.c:130
Keep alive.
Definition: fip.h:71
A FIP frame header.
Definition: fip.h:29
#define ENOMEM
Not enough space.
Definition: errno.h:534
#define iob_disown(iobuf)
Disown an I/O buffer.
Definition: iobuf.h:216
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define MAX_LL_HEADER_LEN
Maximum length of a link-layer header.
Definition: netdevice.h:45
Maintain virtual links.
Definition: fip.h:53
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
A FIP MAC address descriptor.
Definition: fip.h:145
#define iob_reserve(iobuf, len)
Definition: iobuf.h:71
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
int net_tx(struct io_buffer *iobuf, struct net_device *netdev, struct net_protocol *net_protocol, const void *ll_dest, const void *ll_source)
Transmit network-layer packet.
Definition: netdevice.c:1073
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
Definition: netdevice.h:387
#define htons(value)
Definition: byteswap.h:135
uint8_t fcf_mac[ETH_ALEN]
FCoE forwarder MAC address.
Definition: fcoe.c:94
void * memset(void *dest, int character, size_t len) __nonnull
A persistent I/O buffer.
Definition: iobuf.h:37

References __attribute__, alloc_iob(), DBGC, ENOMEM, fcoe_port::fcf_mac, FIP_CODE_MAINTAIN, FIP_MAC_ADDRESS, FIP_MAINTAIN_KEEP_ALIVE, FIP_VERSION, hdr, htons, iob_disown, iob_put, iob_reserve, net_device::ll_addr, MAX_LL_HEADER_LEN, memcpy(), memset(), net_device::name, net_tx(), fcoe_port::netdev, rc, and strerror().

Referenced by fcoe_expired().

◆ fcoe_fip_rx()

static int fcoe_fip_rx ( struct io_buffer iobuf,
struct net_device netdev,
const void *  ll_dest,
const void *ll_source  __unused,
unsigned int flags  __unused 
)
static

Process incoming FIP packets.

Parameters
iobufI/O buffer
netdevNetwork device
ll_destLink-layer destination address
ll_sourceLink-layer source address
flagsPacket flags
Return values
rcReturn status code

Definition at line 914 of file fcoe.c.

918  {
919  struct fip_header *fiphdr = iobuf->data;
920  struct fip_descriptors descs;
921  struct fip_handler *handler;
922  struct fcoe_port *fcoe;
923  unsigned int i;
924  int rc;
925 
926  /* Identify FCoE port */
927  fcoe = netdev_priv ( netdev, &fcoe_driver );
928  if ( ! fcoe->netdev ) {
929  DBG ( "FCoE received FIP frame for net device %s missing FCoE "
930  "port\n", netdev->name );
931  rc = -ENOTCONN;
932  goto done;
933  }
934 
935  /* Discard packets not destined for us */
936  if ( ( memcmp ( fcoe->netdev->ll_addr, ll_dest, ETH_ALEN ) != 0 ) &&
937  ( memcmp ( all_fcoe_macs, ll_dest,
938  sizeof ( all_fcoe_macs ) ) != 0 ) &&
939  ( memcmp ( all_enode_macs, ll_dest,
940  sizeof ( all_enode_macs ) ) != 0 ) ) {
941  DBGC2 ( fcoe, "FCoE %s ignoring FIP packet for %s\n",
942  fcoe->netdev->name, eth_ntoa ( ll_dest ) );
943  rc = -ENOTCONN;
944  goto done;
945  }
946 
947  /* Parse FIP packet */
948  if ( ( rc = fcoe_fip_parse ( fcoe, fiphdr, iob_len ( iobuf ),
949  &descs ) ) != 0 )
950  goto done;
951 
952  /* Find a suitable handler */
953  for ( i = 0 ; i < ( sizeof ( fip_handlers ) /
954  sizeof ( fip_handlers[0] ) ) ; i++ ) {
955  handler = &fip_handlers[i];
956  if ( ( handler->code == ntohs ( fiphdr->code ) ) &&
957  ( handler->subcode == fiphdr->subcode ) ) {
958  rc = handler->rx ( fcoe, &descs,
959  ntohs ( fiphdr->flags ) );
960  goto done;
961  }
962  }
963  DBGC ( fcoe, "FCoE %s received unsupported FIP code %04x.%02x\n",
964  fcoe->netdev->name, ntohs ( fiphdr->code ), fiphdr->subcode );
965  rc = -ENOTSUP;
966 
967  done:
968  free_iob ( iobuf );
969  return rc;
970 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
struct net_device * netdev
Network device.
Definition: fcoe.c:76
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:152
static struct fip_handler fip_handlers[]
FIP handlers.
Definition: fcoe.c:895
A FIP handler.
Definition: fcoe.c:877
#define DBGC(...)
Definition: compiler.h:505
#define ntohs(value)
Definition: byteswap.h:136
static int fcoe_fip_parse(struct fcoe_port *fcoe, struct fip_header *fiphdr, size_t len, struct fip_descriptors *descs)
Parse FIP packet into descriptor set.
Definition: fcoe.c:473
#define ENOTSUP
Operation not supported.
Definition: errno.h:589
static uint8_t all_enode_macs[ETH_ALEN]
FCoE All-ENode-MACs address.
Definition: fcoe.c:124
uint16_t code
Protocol code.
Definition: fip.h:35
A FIP frame header.
Definition: fip.h:29
void * netdev_priv(struct net_device *netdev, struct net_driver *driver)
Get network device driver private data.
Definition: netdevice.c:152
static struct net_device * netdev
Definition: gdbudp.c:52
uint16_t flags
Flags.
Definition: fip.h:43
#define ENOTCONN
The socket is not connected.
Definition: errno.h:569
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:159
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
Definition: ethernet.c:175
A FIP descriptor set.
Definition: fip.h:406
An FCoE port.
Definition: fcoe.c:72
#define ETH_ALEN
Definition: if_ether.h:8
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
#define DBGC2(...)
Definition: compiler.h:522
uint8_t subcode
Protocol subcode.
Definition: fcoe.c:881
uint16_t code
Protocol code.
Definition: fcoe.c:879
void * data
Start of data.
Definition: iobuf.h:52
int(* rx)(struct fcoe_port *fcoe, struct fip_descriptors *descs, unsigned int flags)
Receive FIP packet.
Definition: fcoe.c:890
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
Definition: netdevice.h:387
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
uint8_t subcode
Subcode.
Definition: fip.h:39
static uint8_t all_fcoe_macs[ETH_ALEN]
FCoE All-FCoE-MACs address.
Definition: fcoe.c:120
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
Definition: string.c:114
struct bofm_section_header done
Definition: bofm_test.c:46

References all_enode_macs, all_fcoe_macs, fip_header::code, fip_handler::code, io_buffer::data, DBG, DBGC, DBGC2, done, ENOTCONN, ENOTSUP, ETH_ALEN, eth_ntoa(), fcoe_fip_parse(), fip_handlers, fip_header::flags, free_iob(), iob_len(), net_device::ll_addr, memcmp(), net_device::name, netdev, fcoe_port::netdev, netdev_priv(), ntohs, rc, fip_handler::rx, fip_header::subcode, and fip_handler::subcode.

◆ fcoe_expired()

static void fcoe_expired ( struct retry_timer timer,
int over  __unused 
)
static

Handle FCoE timer expiry.

Parameters
timerFIP timer
overTimer expired

Definition at line 985 of file fcoe.c.

985  {
986  struct fcoe_port *fcoe =
987  container_of ( timer, struct fcoe_port, timer );
988  int rc;
989 
990  /* Sanity check */
991  assert ( fcoe->flags & FCOE_HAVE_NETWORK );
992 
993  /* Increment the timeout counter */
994  fcoe->timeouts++;
995 
996  if ( vlan_can_be_trunk ( fcoe->netdev ) &&
997  ! ( fcoe->flags & FCOE_VLAN_TIMED_OUT ) ) {
998 
999  /* If we have already found a VLAN, send infrequent
1000  * VLAN requests, in case VLAN information changes.
1001  */
1002  if ( fcoe->flags & FCOE_VLAN_FOUND ) {
1003  fcoe->flags &= ~FCOE_VLAN_FOUND;
1004  fcoe->timeouts = 0;
1005  start_timer_fixed ( &fcoe->timer,
1007  fcoe_fip_tx_vlan ( fcoe );
1008  return;
1009  }
1010 
1011  /* If we have not yet found a VLAN, and we have not
1012  * yet timed out and given up on finding one, then
1013  * send a VLAN request and wait.
1014  */
1015  if ( fcoe->timeouts <= FCOE_MAX_VLAN_REQUESTS ) {
1016  start_timer_fixed ( &fcoe->timer,
1018  fcoe_fip_tx_vlan ( fcoe );
1019  return;
1020  }
1021 
1022  /* We have timed out waiting for a VLAN; proceed to
1023  * FIP discovery.
1024  */
1025  fcoe->flags |= FCOE_VLAN_TIMED_OUT;
1026  fcoe->timeouts = 0;
1027  DBGC ( fcoe, "FCoE %s giving up on VLAN discovery\n",
1028  fcoe->netdev->name );
1029  start_timer_nodelay ( &fcoe->timer );
1030 
1031  } else if ( ! ( fcoe->flags & FCOE_HAVE_FCF ) ) {
1032 
1033  /* If we have not yet found a FIP-capable forwarder,
1034  * and we have not yet timed out and given up on
1035  * finding one, then send a FIP solicitation and wait.
1036  */
1038  if ( ( ! ( fcoe->flags & FCOE_HAVE_FIP_FCF ) ) &&
1039  ( fcoe->timeouts <= FCOE_MAX_FIP_SOLICITATIONS ) ) {
1040  fcoe_fip_tx_solicitation ( fcoe );
1041  return;
1042  }
1043 
1044  /* Attach Fibre Channel port */
1045  if ( ( rc = fc_port_open ( &fcoe->transport, &fcoe->node_wwn.fc,
1046  &fcoe->port_wwn.fc,
1047  fcoe->netdev->name ) ) != 0 ) {
1048  DBGC ( fcoe, "FCoE %s could not create FC port: %s\n",
1049  fcoe->netdev->name, strerror ( rc ) );
1050  /* We will try again on the next timer expiry */
1051  return;
1052  }
1053  stop_timer ( &fcoe->timer );
1054 
1055  /* Either we have found a FIP-capable forwarder, or we
1056  * have timed out and will fall back to pre-FIP mode.
1057  */
1058  fcoe->flags |= FCOE_HAVE_FCF;
1059  fcoe->timeouts = 0;
1060  DBGC ( fcoe, "FCoE %s using %sFIP FCF %s\n", fcoe->netdev->name,
1061  ( ( fcoe->flags & FCOE_HAVE_FIP_FCF ) ? "" : "non-" ),
1062  eth_ntoa ( fcoe->fcf_mac ) );
1063 
1064  /* Start sending keepalives if applicable */
1065  if ( fcoe->keepalive )
1066  start_timer_nodelay ( &fcoe->timer );
1067 
1068  /* Send notification of window change */
1069  xfer_window_changed ( &fcoe->transport );
1070 
1071  } else {
1072 
1073  /* Send keepalive */
1074  start_timer_fixed ( &fcoe->timer,
1075  ( fcoe->keepalive * TICKS_PER_MS ) );
1076  fcoe_fip_tx_keepalive ( fcoe );
1077 
1078  /* Abandon FCF if we have not seen its advertisements */
1079  if ( fcoe->timeouts > FCOE_MAX_FIP_MISSING_KEEPALIVES ) {
1080  DBGC ( fcoe, "FCoE %s abandoning FCF %s\n",
1081  fcoe->netdev->name, eth_ntoa ( fcoe->fcf_mac ));
1082  fcoe_reset ( fcoe );
1083  }
1084  }
1085 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
void xfer_window_changed(struct interface *intf)
Report change of flow control window.
Definition: xfer.c:146
#define FCOE_VLAN_POLL_DELAY
Delay between retrying polling VLAN requests.
Definition: fcoe.c:142
An alternative VLAN has been found.
Definition: fcoe.c:110
static void start_timer_nodelay(struct retry_timer *timer)
Start timer with no delay.
Definition: retry.h:99
static int fcoe_fip_tx_keepalive(struct fcoe_port *fcoe)
Send FIP keepalive.
Definition: fcoe.c:836
unsigned int flags
Flags.
Definition: fcoe.c:88
struct net_device * netdev
Network device.
Definition: fcoe.c:76
#define FCOE_VLAN_RETRY_DELAY
Delay between retrying VLAN requests.
Definition: fcoe.c:139
unsigned int timeouts
FIP timeout counter.
Definition: fcoe.c:86
#define DBGC(...)
Definition: compiler.h:505
Underlying network device is available.
Definition: fcoe.c:102
#define FCOE_FIP_RETRY_DELAY
Delay between retrying FIP solicitations.
Definition: fcoe.c:148
static int fcoe_fip_tx_vlan(struct fcoe_port *fcoe)
Send FIP VLAN request.
Definition: fcoe.c:546
#define FCOE_MAX_VLAN_REQUESTS
Maximum number of VLAN requests before giving up on VLAN discovery.
Definition: fcoe.c:136
A timer.
Definition: timer.h:28
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define container_of(ptr, type, field)
Get containing structure.
Definition: stddef.h:35
union fcoe_name node_wwn
Node WWN.
Definition: fcoe.c:79
We have a FIP-capable FCoE forwarder available to be used.
Definition: fcoe.c:106
#define FCOE_MAX_FIP_MISSING_KEEPALIVES
Maximum number of missing discovery advertisements.
Definition: fcoe.c:151
static void fcoe_reset(struct fcoe_port *fcoe)
Reset FCoE port.
Definition: fcoe.c:165
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
static int fcoe_fip_tx_solicitation(struct fcoe_port *fcoe)
Send FIP discovery solicitation.
Definition: fcoe.c:640
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
Definition: ethernet.c:175
int fc_port_open(struct interface *transport, const struct fc_name *node_wwn, const struct fc_name *port_wwn, const char *name)
Create Fibre Channel port.
Definition: fc.c:1189
#define FCOE_MAX_FIP_SOLICITATIONS
Maximum number of FIP solicitations before giving up on FIP.
Definition: fcoe.c:145
An FCoE port.
Definition: fcoe.c:72
struct retry_timer timer
FIP retransmission timer.
Definition: fcoe.c:84
struct fc_name fc
Fibre Channel name.
Definition: fcoe.h:20
void start_timer_fixed(struct retry_timer *timer, unsigned long timeout)
Start timer with a specified timeout.
Definition: retry.c:64
VLAN discovery has timed out.
Definition: fcoe.c:112
void stop_timer(struct retry_timer *timer)
Stop timer.
Definition: retry.c:117
int vlan_can_be_trunk(struct net_device *trunk)
Check if network device can be used as a VLAN trunk device.
Definition: vlan.c:329
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
unsigned int keepalive
Keepalive delay (in ms)
Definition: fcoe.c:92
We have selected an FCoE forwarder to use.
Definition: fcoe.c:104
union fcoe_name port_wwn
Port WWN.
Definition: fcoe.c:81
uint8_t fcf_mac[ETH_ALEN]
FCoE forwarder MAC address.
Definition: fcoe.c:94
#define TICKS_PER_MS
Number of ticks per millisecond.
Definition: timer.h:25
struct interface transport
Transport interface.
Definition: fcoe.c:74

References assert(), container_of, DBGC, eth_ntoa(), fcoe_name::fc, fc_port_open(), fcoe_port::fcf_mac, FCOE_FIP_RETRY_DELAY, fcoe_fip_tx_keepalive(), fcoe_fip_tx_solicitation(), fcoe_fip_tx_vlan(), FCOE_HAVE_FCF, FCOE_HAVE_FIP_FCF, FCOE_HAVE_NETWORK, FCOE_MAX_FIP_MISSING_KEEPALIVES, FCOE_MAX_FIP_SOLICITATIONS, FCOE_MAX_VLAN_REQUESTS, fcoe_reset(), FCOE_VLAN_FOUND, FCOE_VLAN_POLL_DELAY, FCOE_VLAN_RETRY_DELAY, FCOE_VLAN_TIMED_OUT, fcoe_port::flags, fcoe_port::keepalive, net_device::name, fcoe_port::netdev, fcoe_port::node_wwn, fcoe_port::port_wwn, rc, start_timer_fixed(), start_timer_nodelay(), stop_timer(), strerror(), TICKS_PER_MS, fcoe_port::timeouts, fcoe_port::timer, fcoe_port::transport, vlan_can_be_trunk(), and xfer_window_changed().

Referenced by fcoe_probe().

◆ fcoe_probe()

static int fcoe_probe ( struct net_device netdev,
void *  priv 
)
static

Create FCoE port.

Parameters
netdevNetwork device
privPrivate data
Return values
rcReturn status code

Definition at line 1094 of file fcoe.c.

1094  {
1096  struct fcoe_port *fcoe = priv;
1097 
1098  /* Sanity check */
1099  if ( ll_protocol->ll_proto != htons ( ARPHRD_ETHER ) ) {
1100  /* Not an error; simply skip this net device */
1101  DBG ( "FCoE skipping non-Ethernet device %s\n", netdev->name );
1102  return 0;
1103  }
1104 
1105  /* Initialise structure */
1107  timer_init ( &fcoe->timer, fcoe_expired, &netdev->refcnt );
1108  fcoe->netdev = netdev;
1109 
1110  /* Construct node and port names */
1112  memcpy ( &fcoe->node_wwn.fcoe.mac, netdev->ll_addr,
1113  sizeof ( fcoe->node_wwn.fcoe.mac ) );
1115  memcpy ( &fcoe->port_wwn.fcoe.mac, netdev->ll_addr,
1116  sizeof ( fcoe->port_wwn.fcoe.mac ) );
1117 
1118  DBGC ( fcoe, "FCoE %s is %s", fcoe->netdev->name,
1119  fc_ntoa ( &fcoe->node_wwn.fc ) );
1120  DBGC ( fcoe, " port %s\n", fc_ntoa ( &fcoe->port_wwn.fc ) );
1121 
1122  return 0;
1123 }
#define FCOE_AUTHORITY_IEEE
IEEE 48-bit address.
Definition: fcoe.h:31
struct net_device * netdev
Network device.
Definition: fcoe.c:76
uint8_t mac[ETH_ALEN]
MAC address.
Definition: fcoe.h:26
static struct interface_descriptor fcoe_transport_desc
FCoE transport interface descriptor.
Definition: fcoe.c:454
#define DBGC(...)
Definition: compiler.h:505
const char * fc_ntoa(const struct fc_name *wwn)
Format Fibre Channel WWN.
Definition: fc.c:127
A link-layer protocol.
Definition: netdevice.h:114
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static struct net_device * netdev
Definition: gdbudp.c:52
union fcoe_name node_wwn
Node WWN.
Definition: fcoe.c:79
uint16_t authority
Naming authority.
Definition: fcoe.h:24
struct refcnt refcnt
Reference counter.
Definition: netdevice.h:354
An FCoE port.
Definition: fcoe.c:72
uint16_t ll_proto
Link-layer protocol.
Definition: netdevice.h:194
struct retry_timer timer
FIP retransmission timer.
Definition: fcoe.c:84
struct fc_name fc
Fibre Channel name.
Definition: fcoe.h:20
static void fcoe_expired(struct retry_timer *timer, int over __unused)
Handle FCoE timer expiry.
Definition: fcoe.c:985
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
static struct tlan_private * priv
Definition: tlan.c:225
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
Definition: netdevice.h:387
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
Definition: interface.h:203
#define ARPHRD_ETHER
Ethernet 10Mbps.
Definition: if_arp.h:16
struct fcoe_name::@614 fcoe
FCoE name.
#define FCOE_AUTHORITY_IEEE_EXTENDED
IEEE extended.
Definition: fcoe.h:34
union fcoe_name port_wwn
Port WWN.
Definition: fcoe.c:81
#define htons(value)
Definition: byteswap.h:135
struct ll_protocol * ll_protocol
Link-layer protocol.
Definition: netdevice.h:372
struct interface transport
Transport interface.
Definition: fcoe.c:74

References ARPHRD_ETHER, fcoe_name::authority, DBG, DBGC, fcoe_name::fc, fc_ntoa(), fcoe_name::fcoe, FCOE_AUTHORITY_IEEE, FCOE_AUTHORITY_IEEE_EXTENDED, fcoe_expired(), fcoe_transport_desc, htons, intf_init(), net_device::ll_addr, ll_protocol::ll_proto, net_device::ll_protocol, fcoe_name::mac, memcpy(), net_device::name, netdev, fcoe_port::netdev, fcoe_port::node_wwn, fcoe_port::port_wwn, priv, net_device::refcnt, fcoe_port::timer, and fcoe_port::transport.

◆ fcoe_notify()

static void fcoe_notify ( struct net_device netdev,
void *  priv 
)
static

Handle FCoE port device or link state change.

Parameters
netdevNetwork device
privPrivate data

Definition at line 1131 of file fcoe.c.

1131  {
1132  struct fcoe_port *fcoe = priv;
1133 
1134  /* Skip non-FCoE net devices */
1135  if ( ! fcoe->netdev )
1136  return;
1137 
1138  /* Reset the FCoE link if necessary */
1139  if ( ! ( netdev_is_open ( netdev ) &&
1140  netdev_link_ok ( netdev ) &&
1141  ( fcoe->flags & FCOE_HAVE_NETWORK ) ) ) {
1142  fcoe_reset ( fcoe );
1143  }
1144 }
unsigned int flags
Flags.
Definition: fcoe.c:88
struct net_device * netdev
Network device.
Definition: fcoe.c:76
Underlying network device is available.
Definition: fcoe.c:102
static int netdev_is_open(struct net_device *netdev)
Check whether or not network device is open.
Definition: netdevice.h:661
static int netdev_link_ok(struct net_device *netdev)
Check link state of network device.
Definition: netdevice.h:639
static struct net_device * netdev
Definition: gdbudp.c:52
static void fcoe_reset(struct fcoe_port *fcoe)
Reset FCoE port.
Definition: fcoe.c:165
An FCoE port.
Definition: fcoe.c:72
static struct tlan_private * priv
Definition: tlan.c:225

References FCOE_HAVE_NETWORK, fcoe_reset(), fcoe_port::flags, netdev, fcoe_port::netdev, netdev_is_open(), netdev_link_ok(), and priv.

◆ fcoe_remove()

static void fcoe_remove ( struct net_device *netdev  __unused,
void *  priv 
)
static

Destroy FCoE port.

Parameters
netdevNetwork device
privPrivate data

Definition at line 1152 of file fcoe.c.

1152  {
1153  struct fcoe_port *fcoe = priv;
1154 
1155  /* Skip non-FCoE net devices */
1156  if ( ! fcoe->netdev )
1157  return;
1158 
1159  /* Close FCoE device */
1160  fcoe_close ( fcoe, 0 );
1161 }
struct net_device * netdev
Network device.
Definition: fcoe.c:76
static void fcoe_close(struct fcoe_port *fcoe, int rc)
Close FCoE port.
Definition: fcoe.c:427
An FCoE port.
Definition: fcoe.c:72
static struct tlan_private * priv
Definition: tlan.c:225

References fcoe_close(), fcoe_port::netdev, and priv.

Variable Documentation

◆ __net_driver

struct net_driver fcoe_driver __net_driver
Initial value:
= {
.name = "FCoE",
.priv_len = sizeof ( struct fcoe_port ),
.probe = fcoe_probe,
.notify = fcoe_notify,
.remove = fcoe_remove,
}
static int fcoe_probe(struct net_device *netdev, void *priv)
Create FCoE port.
Definition: fcoe.c:1094
static void fcoe_notify(struct net_device *netdev, void *priv)
Handle FCoE port device or link state change.
Definition: fcoe.c:1131
An FCoE port.
Definition: fcoe.c:72
static void fcoe_remove(struct net_device *netdev __unused, void *priv)
Destroy FCoE port.
Definition: fcoe.c:1152

FCoE driver.

Definition at line 115 of file fcoe.c.

◆ __net_protocol

struct net_protocol fip_protocol __net_protocol
Initial value:
= {
.name = "FCoE",
.net_proto = htons ( ETH_P_FCOE ),
.rx = fcoe_rx,
}
static int fcoe_rx(struct io_buffer *iobuf, struct net_device *netdev, const void *ll_dest, const void *ll_source, unsigned int flags __unused)
Process incoming FCoE packets.
Definition: fcoe.c:321
#define htons(value)
Definition: byteswap.h:135
#define ETH_P_FCOE
Definition: if_ether.h:27

FCoE protocol.

AoE protocol.

FIP protocol.

Definition at line 116 of file fcoe.c.

◆ all_fcoe_macs

uint8_t all_fcoe_macs[ETH_ALEN]
static
Initial value:
=
{ 0x01, 0x10, 0x18, 0x01, 0x00, 0x00 }

FCoE All-FCoE-MACs address.

Definition at line 120 of file fcoe.c.

Referenced by fcoe_fip_rx().

◆ all_enode_macs

uint8_t all_enode_macs[ETH_ALEN]
static
Initial value:
=
{ 0x01, 0x10, 0x18, 0x01, 0x00, 0x01 }

FCoE All-ENode-MACs address.

Definition at line 124 of file fcoe.c.

Referenced by fcoe_fip_rx().

◆ all_fcf_macs

uint8_t all_fcf_macs[ETH_ALEN]
static
Initial value:
=
{ 0x01, 0x10, 0x18, 0x01, 0x00, 0x02 }

FCoE All-FCF-MACs address.

Definition at line 128 of file fcoe.c.

Referenced by fcoe_fip_tx_solicitation(), and fcoe_fip_tx_vlan().

◆ default_fcf_mac

uint8_t default_fcf_mac[ETH_ALEN]
static
Initial value:
=
{ 0x0e, 0xfc, 0x00, 0xff, 0xff, 0xfe }

Default FCoE forwarded MAC address.

Definition at line 132 of file fcoe.c.

Referenced by fcoe_reset(), and fcoe_rx().

◆ fcoe_transport_op

struct interface_operation fcoe_transport_op[]
static
Initial value:
= {
}
void intf_close(struct interface *intf, int rc)
Close an object interface.
Definition: interface.c:249
struct io_buffer * xfer_alloc_iob(struct interface *intf, size_t len)
Allocate I/O buffer.
Definition: xfer.c:158
static void fcoe_close(struct fcoe_port *fcoe, int rc)
Close FCoE port.
Definition: fcoe.c:427
size_t xfer_window(struct interface *intf)
Check flow control window.
Definition: xfer.c:116
static int fcoe_deliver(struct fcoe_port *fcoe, struct io_buffer *iobuf, struct xfer_metadata *meta __unused)
Transmit FCoE packet.
Definition: fcoe.c:203
static struct io_buffer * fcoe_alloc_iob(struct fcoe_port *fcoe __unused, size_t len)
Allocate FCoE I/O buffer.
Definition: fcoe.c:298
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
Definition: interface.h:32
int xfer_deliver(struct interface *intf, struct io_buffer *iobuf, struct xfer_metadata *meta)
Deliver datagram.
Definition: xfer.c:194
An FCoE port.
Definition: fcoe.c:72
static struct device * fcoe_identify_device(struct fcoe_port *fcoe)
Identify device underlying FCoE port.
Definition: fcoe.c:439
static size_t fcoe_window(struct fcoe_port *fcoe)
Check FCoE flow control window.
Definition: fcoe.c:417
struct device * identify_device(struct interface *intf)
Identify a device behind an interface.
Definition: device.c:125

FCoE transport interface operations.

Definition at line 444 of file fcoe.c.

◆ fcoe_transport_desc

struct interface_descriptor fcoe_transport_desc
static
Initial value:
=
static struct interface_operation fcoe_transport_op[]
FCoE transport interface operations.
Definition: fcoe.c:444
An FCoE port.
Definition: fcoe.c:72
#define INTF_DESC(object_type, intf, operations)
Define an object interface descriptor.
Definition: interface.h:80
struct interface transport
Transport interface.
Definition: fcoe.c:74

FCoE transport interface descriptor.

Definition at line 454 of file fcoe.c.

Referenced by fcoe_probe().

◆ fip_handlers

struct fip_handler fip_handlers[]
static
Initial value:
= {
}
Discovery advertisement.
Definition: fip.h:60
static int fcoe_fip_rx_advertisement(struct fcoe_port *fcoe, struct fip_descriptors *descs, unsigned int flags)
Handle received FIP discovery advertisement.
Definition: fcoe.c:701
VLAN.
Definition: fip.h:54
ELS response.
Definition: fip.h:66
static int fcoe_fip_rx_vlan(struct fcoe_port *fcoe, struct fip_descriptors *descs, unsigned int flags __unused)
Handle received FIP VLAN notification.
Definition: fcoe.c:594
Extended link services.
Definition: fip.h:52
VLAN notification.
Definition: fip.h:78
static int fcoe_fip_rx_els_response(struct fcoe_port *fcoe, struct fip_descriptors *descs, unsigned int flags __unused)
Handle received FIP ELS response.
Definition: fcoe.c:791
Discovery.
Definition: fip.h:51

FIP handlers.

Definition at line 895 of file fcoe.c.

Referenced by fcoe_fip_rx().

◆ __errortab

struct errortab fcoe_errors [] __errortab
Initial value:
= {
}
#define __einfo_errortab(einfo)
Definition: errortab.h:23
#define EINFO_EINVAL_CRC
Definition: fcoe.c:65

Human-readable message for CRC errors.

It seems as though several drivers neglect to strip the Ethernet CRC, which will cause the FCoE footer to be misplaced and result (coincidentally) in an "invalid CRC" error from FCoE.

Definition at line 1192 of file fcoe.c.