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

FCoE protocol. More...

#include <stddef.h>
#include <stdlib.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 57 of file fcoe.c.

◆ EINFO_EINVAL_UNDERLENGTH

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

Definition at line 58 of file fcoe.c.

◆ EINVAL_SOF

#define EINVAL_SOF   __einfo_error ( EINFO_EINVAL_SOF )

Definition at line 60 of file fcoe.c.

◆ EINFO_EINVAL_SOF

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

Definition at line 61 of file fcoe.c.

◆ EINVAL_CRC

#define EINVAL_CRC   __einfo_error ( EINFO_EINVAL_CRC )

Definition at line 63 of file fcoe.c.

◆ EINFO_EINVAL_CRC

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

Definition at line 64 of file fcoe.c.

◆ EINVAL_EOF

#define EINVAL_EOF   __einfo_error ( EINFO_EINVAL_EOF )

Definition at line 66 of file fcoe.c.

◆ EINFO_EINVAL_EOF

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

Definition at line 67 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 135 of file fcoe.c.

◆ FCOE_VLAN_RETRY_DELAY

#define FCOE_VLAN_RETRY_DELAY   ( TICKS_PER_SEC )

Delay between retrying VLAN requests.

Definition at line 138 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 141 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 144 of file fcoe.c.

◆ FCOE_FIP_RETRY_DELAY

#define FCOE_FIP_RETRY_DELAY   ( TICKS_PER_SEC )

Delay between retrying FIP solicitations.

Definition at line 147 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 150 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 99 of file fcoe.c.

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

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 164 of file fcoe.c.

164  {
165 
166  /* Detach FC port, if any */
167  intf_restart ( &fcoe->transport, -ECANCELED );
168 
169  /* Reset any FIP state */
170  stop_timer ( &fcoe->timer );
171  fcoe->timeouts = 0;
172  fcoe->flags = 0;
173  fcoe->priority = ( FIP_LOWEST_PRIORITY + 1 );
174  fcoe->keepalive = 0;
175  memcpy ( fcoe->fcf_mac, default_fcf_mac,
176  sizeof ( fcoe->fcf_mac ) );
177  memcpy ( fcoe->local_mac, fcoe->netdev->ll_addr,
178  sizeof ( fcoe->local_mac ) );
179 
180  /* Start FIP solicitation if network is available */
181  if ( netdev_is_open ( fcoe->netdev ) &&
182  netdev_link_ok ( fcoe->netdev ) ) {
183  fcoe->flags |= FCOE_HAVE_NETWORK;
184  start_timer_nodelay ( &fcoe->timer );
185  DBGC ( fcoe, "FCoE %s starting %s\n", fcoe->netdev->name,
186  ( vlan_can_be_trunk ( fcoe->netdev ) ?
187  "VLAN discovery" : "FIP solicitation" ) );
188  }
189 
190  /* Send notification of window change */
191  xfer_window_changed ( &fcoe->transport );
192 }
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:89
#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:87
struct net_device * netdev
Network device.
Definition: fcoe.c:75
unsigned int timeouts
FIP timeout counter.
Definition: fcoe.c:85
#define DBGC(...)
Definition: compiler.h:505
Underlying network device is available.
Definition: fcoe.c:101
uint8_t local_mac[ETH_ALEN]
Local MAC address.
Definition: fcoe.c:95
#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:658
static int netdev_link_ok(struct net_device *netdev)
Check link state of network device.
Definition: netdevice.h:636
struct retry_timer timer
FIP retransmission timer.
Definition: fcoe.c:83
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:91
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:131
uint8_t fcf_mac[ETH_ALEN]
FCoE forwarder MAC address.
Definition: fcoe.c:93
struct interface transport
Transport interface.
Definition: fcoe.c:73

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 202 of file fcoe.c.

204  {
205  struct fc_frame_header *fchdr = iobuf->data;
206  struct fc_els_frame_common *els = ( iobuf->data + sizeof ( *fchdr ) );
207  struct fcoe_header *fcoehdr;
208  struct fcoe_footer *fcoeftr;
209  struct fip_header *fiphdr;
210  struct fip_login *fipflogi;
211  struct fip_mac_address *fipmac;
212  uint32_t crc;
213  struct net_protocol *net_protocol;
214  void *ll_source;
215  int rc;
216 
217  /* Send as FIP or FCoE as appropriate */
218  if ( ( fchdr->r_ctl == ( FC_R_CTL_ELS | FC_R_CTL_UNSOL_CTRL ) ) &&
219  ( els->command == FC_ELS_FLOGI ) &&
220  ( fcoe->flags & FCOE_HAVE_FIP_FCF ) ) {
221 
222  /* Create FIP FLOGI descriptor */
223  fipflogi = iob_push ( iobuf,
224  offsetof ( typeof ( *fipflogi ), fc ) );
225  memset ( fipflogi, 0, offsetof ( typeof ( *fipflogi ), fc ) );
226  fipflogi->type = FIP_FLOGI;
227  fipflogi->len = ( iob_len ( iobuf ) / 4 );
228 
229  /* Create FIP MAC address descriptor */
230  fipmac = iob_put ( iobuf, sizeof ( *fipmac ) );
231  memset ( fipmac, 0, sizeof ( *fipmac ) );
232  fipmac->type = FIP_MAC_ADDRESS;
233  fipmac->len = ( sizeof ( *fipmac ) / 4 );
234  if ( fcoe->flags & FCOE_FCF_ALLOWS_SPMA ) {
235  memcpy ( fipmac->mac, fcoe->netdev->ll_addr,
236  sizeof ( fipmac->mac ) );
237  }
238 
239  /* Create FIP header */
240  fiphdr = iob_push ( iobuf, sizeof ( *fiphdr ) );
241  memset ( fiphdr, 0, sizeof ( *fiphdr ) );
242  fiphdr->version = FIP_VERSION;
243  fiphdr->code = htons ( FIP_CODE_ELS );
244  fiphdr->subcode = FIP_ELS_REQUEST;
245  fiphdr->len =
246  htons ( ( iob_len ( iobuf ) - sizeof ( *fiphdr ) ) / 4);
247  fiphdr->flags = ( ( fcoe->flags & FCOE_FCF_ALLOWS_SPMA ) ?
248  htons ( FIP_SP ) : htons ( FIP_FP ) );
249 
250  /* Send as FIP packet from netdev's own MAC address */
251  net_protocol = &fip_protocol;
252  ll_source = fcoe->netdev->ll_addr;
253 
254  } else {
255 
256  /* Calculate CRC */
257  crc = crc32_le ( ~((uint32_t)0), iobuf->data,
258  iob_len ( iobuf ) );
259 
260  /* Create FCoE header */
261  fcoehdr = iob_push ( iobuf, sizeof ( *fcoehdr ) );
262  memset ( fcoehdr, 0, sizeof ( *fcoehdr ) );
263  fcoehdr->sof = ( ( fchdr->seq_cnt == ntohs ( 0 ) ) ?
265 
266  /* Create FCoE footer */
267  fcoeftr = iob_put ( iobuf, sizeof ( *fcoeftr ) );
268  memset ( fcoeftr, 0, sizeof ( *fcoeftr ) );
269  fcoeftr->crc = cpu_to_le32 ( crc ^ ~((uint32_t)0) );
270  fcoeftr->eof = ( ( fchdr->f_ctl_es & FC_F_CTL_ES_END ) ?
272 
273  /* Send as FCoE packet from FCoE MAC address */
274  net_protocol = &fcoe_protocol;
275  ll_source = fcoe->local_mac;
276  }
277 
278  /* Transmit packet */
279  if ( ( rc = net_tx ( iob_disown ( iobuf ), fcoe->netdev, net_protocol,
280  fcoe->fcf_mac, ll_source ) ) != 0 ) {
281  DBGC ( fcoe, "FCoE %s could not transmit: %s\n",
282  fcoe->netdev->name, strerror ( rc ) );
283  goto done;
284  }
285 
286  done:
287  free_iob ( iobuf );
288  return rc;
289 }
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:120
unsigned int flags
Flags.
Definition: fcoe.c:87
Fabric Login.
Definition: fcels.h:34
struct net_device * netdev
Network device.
Definition: fcoe.c:75
uint16_t seq_cnt
Sequence count.
Definition: fc.h:146
#define iob_push(iobuf, len)
Definition: iobuf.h:84
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:146
#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:95
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:212
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:105
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:107
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:155
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:48
uint8_t mac[ETH_ALEN]
MAC address.
Definition: fip.h:151
typeof(acpi_finder=acpi_find)
ACPI table finder.
Definition: acpi.c:45
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:93
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 297 of file fcoe.c.

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

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 320 of file fcoe.c.

322  {
323  struct fcoe_header *fcoehdr;
324  struct fcoe_footer *fcoeftr;
325  struct fcoe_port *fcoe;
326  int rc;
327 
328  /* Identify FCoE port */
329  fcoe = netdev_priv ( netdev, &fcoe_driver );
330  if ( ! fcoe->netdev ) {
331  DBG ( "FCoE received frame for net device %s missing FCoE "
332  "port\n", netdev->name );
333  rc = -ENOTCONN;
334  goto done;
335  }
336 
337  /* Discard packets not destined for us */
338  if ( ( memcmp ( fcoe->local_mac, ll_dest,
339  sizeof ( fcoe->local_mac ) ) != 0 ) &&
340  ( memcmp ( default_fcf_mac, ll_dest,
341  sizeof ( default_fcf_mac ) ) != 0 ) ) {
342  DBGC2 ( fcoe, "FCoE %s ignoring packet for %s\n",
343  fcoe->netdev->name, eth_ntoa ( ll_dest ) );
344  rc = -ENOTCONN;
345  goto done;
346  }
347 
348  /* Sanity check */
349  if ( iob_len ( iobuf ) < ( sizeof ( *fcoehdr ) + sizeof ( *fcoeftr ) )){
350  DBGC ( fcoe, "FCoE %s received under-length frame (%zd "
351  "bytes)\n", fcoe->netdev->name, iob_len ( iobuf ) );
353  goto done;
354  }
355 
356  /* Strip header and footer */
357  fcoehdr = iobuf->data;
358  iob_pull ( iobuf, sizeof ( *fcoehdr ) );
359  fcoeftr = ( iobuf->data + iob_len ( iobuf ) - sizeof ( *fcoeftr ) );
360  iob_unput ( iobuf, sizeof ( *fcoeftr ) );
361 
362  /* Validity checks */
363  if ( fcoehdr->version != FCOE_FRAME_VER ) {
364  DBGC ( fcoe, "FCoE %s received unsupported frame version "
365  "%02x\n", fcoe->netdev->name, fcoehdr->version );
366  rc = -EPROTONOSUPPORT;
367  goto done;
368  }
369  if ( ! ( ( fcoehdr->sof == FCOE_SOF_I3 ) ||
370  ( fcoehdr->sof == FCOE_SOF_N3 ) ) ) {
371  DBGC ( fcoe, "FCoE %s received unsupported start-of-frame "
372  "delimiter %02x\n", fcoe->netdev->name, fcoehdr->sof );
373  rc = -EINVAL_SOF;
374  goto done;
375  }
376  if ( ( le32_to_cpu ( fcoeftr->crc ) ^ ~((uint32_t)0) ) !=
377  crc32_le ( ~((uint32_t)0), iobuf->data, iob_len ( iobuf ) ) ) {
378  DBGC ( fcoe, "FCoE %s received invalid CRC\n",
379  fcoe->netdev->name );
380  rc = -EINVAL_CRC;
381  goto done;
382  }
383  if ( ! ( ( fcoeftr->eof == FCOE_EOF_N ) ||
384  ( fcoeftr->eof == FCOE_EOF_T ) ) ) {
385  DBGC ( fcoe, "FCoE %s received unsupported end-of-frame "
386  "delimiter %02x\n", fcoe->netdev->name, fcoeftr->eof );
387  rc = -EINVAL_EOF;
388  goto done;
389  }
390 
391  /* Record FCF address if applicable */
392  if ( ( fcoe->flags & FCOE_HAVE_FCF ) &&
393  ( ! ( fcoe->flags & FCOE_HAVE_FIP_FCF ) ) ) {
394  memcpy ( &fcoe->fcf_mac, ll_source, sizeof ( fcoe->fcf_mac ) );
395  }
396 
397  /* Hand off via transport interface */
398  if ( ( rc = xfer_deliver_iob ( &fcoe->transport,
399  iob_disown ( iobuf ) ) ) != 0 ) {
400  DBGC ( fcoe, "FCoE %s could not deliver frame: %s\n",
401  fcoe->netdev->name, strerror ( rc ) );
402  goto done;
403  }
404 
405  done:
406  free_iob ( iobuf );
407  return rc;
408 }
#define iob_pull(iobuf, len)
Definition: iobuf.h:102
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define EINVAL_UNDERLENGTH
Definition: fcoe.c:57
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:87
#define le32_to_cpu(value)
Definition: byteswap.h:113
struct net_device * netdev
Network device.
Definition: fcoe.c:75
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:146
#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:95
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:212
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:105
#define ENOTCONN
The socket is not connected.
Definition: errno.h:569
#define iob_unput(iobuf, len)
Definition: iobuf.h:135
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:155
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
Definition: ethernet.c:175
An FCoE port.
Definition: fcoe.c:71
unsigned int uint32_t
Definition: stdint.h:12
#define EINVAL_CRC
Definition: fcoe.c:63
#define EINVAL_EOF
Definition: fcoe.c:66
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:60
void * data
Start of data.
Definition: iobuf.h:48
We have selected an FCoE forwarder to use.
Definition: fcoe.c:103
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:131
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:93
struct interface transport
Transport interface.
Definition: fcoe.c:73
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 416 of file fcoe.c.

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

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 426 of file fcoe.c.

426  {
427 
428  stop_timer ( &fcoe->timer );
429  intf_shutdown ( &fcoe->transport, rc );
430 }
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:83
void stop_timer(struct retry_timer *timer)
Stop timer.
Definition: retry.c:117
struct interface transport
Transport interface.
Definition: fcoe.c:73

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 438 of file fcoe.c.

438  {
439  return fcoe->netdev->dev;
440 }
struct net_device * netdev
Network device.
Definition: fcoe.c:75
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 472 of file fcoe.c.

473  {
474  union fip_descriptor *desc;
475  size_t descs_len;
476  size_t desc_len;
477  size_t desc_offset;
478  unsigned int desc_type;
479 
480  /* Check FIP version */
481  if ( fiphdr->version != FIP_VERSION ) {
482  DBGC ( fcoe, "FCoE %s received unsupported FIP version %02x\n",
483  fcoe->netdev->name, fiphdr->version );
484  return -EINVAL;
485  }
486 
487  /* Check length */
488  descs_len = ( ntohs ( fiphdr->len ) * 4 );
489  if ( ( sizeof ( *fiphdr ) + descs_len ) > len ) {
490  DBGC ( fcoe, "FCoE %s received bad descriptor list length\n",
491  fcoe->netdev->name );
492  return -EINVAL;
493  }
494 
495  /* Parse descriptor list */
496  memset ( descs, 0, sizeof ( *descs ) );
497  for ( desc_offset = 0 ;
498  desc_offset <= ( descs_len - sizeof ( desc->common ) ) ;
499  desc_offset += desc_len ) {
500 
501  /* Find descriptor and validate length */
502  desc = ( ( ( void * ) ( fiphdr + 1 ) ) + desc_offset );
503  desc_type = desc->common.type;
504  desc_len = ( desc->common.len * 4 );
505  if ( desc_len == 0 ) {
506  DBGC ( fcoe, "FCoE %s received zero-length "
507  "descriptor\n", fcoe->netdev->name );
508  return -EINVAL;
509  }
510  if ( ( desc_offset + desc_len ) > descs_len ) {
511  DBGC ( fcoe, "FCoE %s descriptor overrun\n",
512  fcoe->netdev->name );
513  return -EINVAL;
514  }
515 
516  /* Handle descriptors that we understand */
517  if ( ( desc_type > FIP_RESERVED ) &&
518  ( desc_type < FIP_NUM_DESCRIPTOR_TYPES ) ) {
519  /* Use only the first instance of a descriptor */
520  if ( descs->desc[desc_type] == NULL )
521  descs->desc[desc_type] = desc;
522  continue;
523  }
524 
525  /* Abort if we cannot understand a critical descriptor */
526  if ( FIP_IS_CRITICAL ( desc_type ) ) {
527  DBGC ( fcoe, "FCoE %s cannot understand critical "
528  "descriptor type %02x\n",
529  fcoe->netdev->name, desc_type );
530  return -ENOTSUP;
531  }
532 
533  /* Ignore non-critical descriptors that we cannot understand */
534  }
535 
536  return 0;
537 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
Reserved.
Definition: fip.h:102
struct net_device * netdev
Network device.
Definition: fcoe.c:75
#define FIP_VERSION
FIP frame version.
Definition: fip.h:47
uint64_t desc
Microcode descriptor list physical address.
Definition: ucode.h:12
#define DBGC(...)
Definition: compiler.h:505
#define ntohs(value)
Definition: byteswap.h:136
#define ENOTSUP
Operation not supported.
Definition: errno.h:589
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
uint32_t len
Length.
Definition: ena.h:14
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, len, fip_header::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 545 of file fcoe.c.

545  {
546  struct io_buffer *iobuf;
547  struct {
548  struct fip_header hdr;
549  struct fip_mac_address mac_address;
550  } __attribute__ (( packed )) *request;
551  int rc;
552 
553  /* Allocate I/O buffer */
554  iobuf = alloc_iob ( MAX_LL_HEADER_LEN + sizeof ( *request ) );
555  if ( ! iobuf )
556  return -ENOMEM;
557  iob_reserve ( iobuf, MAX_LL_HEADER_LEN );
558 
559  /* Construct VLAN request */
560  request = iob_put ( iobuf, sizeof ( *request ) );
561  memset ( request, 0, sizeof ( *request ) );
562  request->hdr.version = FIP_VERSION;
563  request->hdr.code = htons ( FIP_CODE_VLAN );
564  request->hdr.subcode = FIP_VLAN_REQUEST;
565  request->hdr.len = htons ( ( sizeof ( *request ) -
566  sizeof ( request->hdr ) ) / 4 );
567  request->mac_address.type = FIP_MAC_ADDRESS;
568  request->mac_address.len =
569  ( sizeof ( request->mac_address ) / 4 );
570  memcpy ( request->mac_address.mac, fcoe->netdev->ll_addr,
571  sizeof ( request->mac_address.mac ) );
572 
573  /* Send VLAN request */
574  if ( ( rc = net_tx ( iob_disown ( iobuf ), fcoe->netdev,
575  &fip_protocol, all_fcf_macs,
576  fcoe->netdev->ll_addr ) ) != 0 ) {
577  DBGC ( fcoe, "FCoE %s could not send VLAN request: "
578  "%s\n", fcoe->netdev->name, strerror ( rc ) );
579  return rc;
580  }
581 
582  return 0;
583 }
#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:120
struct net_device * netdev
Network device.
Definition: fcoe.c:75
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:129
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:212
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:127
#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:67
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:33

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 593 of file fcoe.c.

595  {
596  struct fip_mac_address *mac_address = fip_mac_address ( descs );
597  struct fip_vlan *vlan = fip_vlan ( descs );
598  unsigned int tag;
599  int rc;
600 
601  /* Sanity checks */
602  if ( ! mac_address ) {
603  DBGC ( fcoe, "FCoE %s received VLAN notification missing MAC "
604  "address\n", fcoe->netdev->name );
605  return -EINVAL;
606  }
607  if ( ! vlan ) {
608  DBGC ( fcoe, "FCoE %s received VLAN notification missing VLAN "
609  "tag\n", fcoe->netdev->name );
610  return -EINVAL;
611  }
612 
613  /* Create VLAN */
614  tag = ntohs ( vlan->vlan );
615  DBGC ( fcoe, "FCoE %s creating VLAN %d for FCF %s\n",
616  fcoe->netdev->name, tag, eth_ntoa ( mac_address->mac ) );
617  if ( ( rc = vlan_create ( fcoe->netdev, tag,
618  FCOE_VLAN_PRIORITY ) ) != 0 ) {
619  DBGC ( fcoe, "FCoE %s could not create VLAN %d: %s\n",
620  fcoe->netdev->name, tag, strerror ( rc ) );
621  return rc;
622  }
623 
624  /* Record that a VLAN was found. This FCoE port will play no
625  * further active role; the real FCoE traffic will use the
626  * port automatically created for the new VLAN device.
627  */
628  fcoe->flags |= FCOE_VLAN_FOUND;
629 
630  return 0;
631 }
#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:109
unsigned int flags
Flags.
Definition: fcoe.c:87
struct net_device * netdev
Network device.
Definition: fcoe.c:75
#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 639 of file fcoe.c.

639  {
640  struct io_buffer *iobuf;
641  struct {
642  struct fip_header hdr;
643  struct fip_mac_address mac_address;
644  struct fip_name_id name_id;
645  struct fip_max_fcoe_size max_fcoe_size;
646  } __attribute__ (( packed )) *solicitation;
647  int rc;
648 
649  /* Allocate I/O buffer */
650  iobuf = alloc_iob ( MAX_LL_HEADER_LEN + sizeof ( *solicitation ) );
651  if ( ! iobuf )
652  return -ENOMEM;
653  iob_reserve ( iobuf, MAX_LL_HEADER_LEN );
654 
655  /* Construct discovery solicitation */
656  solicitation = iob_put ( iobuf, sizeof ( *solicitation ) );
657  memset ( solicitation, 0, sizeof ( *solicitation ) );
658  solicitation->hdr.version = FIP_VERSION;
659  solicitation->hdr.code = htons ( FIP_CODE_DISCOVERY );
660  solicitation->hdr.subcode = FIP_DISCOVERY_SOLICIT;
661  solicitation->hdr.len = htons ( ( sizeof ( *solicitation ) -
662  sizeof ( solicitation->hdr ) ) / 4 );
663  solicitation->hdr.flags = htons ( FIP_FP | FIP_SP );
664  solicitation->mac_address.type = FIP_MAC_ADDRESS;
665  solicitation->mac_address.len =
666  ( sizeof ( solicitation->mac_address ) / 4 );
667  memcpy ( solicitation->mac_address.mac, fcoe->netdev->ll_addr,
668  sizeof ( solicitation->mac_address.mac ) );
669  solicitation->name_id.type = FIP_NAME_ID;
670  solicitation->name_id.len = ( sizeof ( solicitation->name_id ) / 4 );
671  memcpy ( &solicitation->name_id.name, &fcoe->node_wwn.fc,
672  sizeof ( solicitation->name_id.name ) );
673  solicitation->max_fcoe_size.type = FIP_MAX_FCOE_SIZE;
674  solicitation->max_fcoe_size.len =
675  ( sizeof ( solicitation->max_fcoe_size ) / 4 );
676  solicitation->max_fcoe_size.mtu =
677  htons ( ETH_MAX_MTU - sizeof ( struct fcoe_header ) -
678  sizeof ( struct fcoe_footer ) );
679 
680  /* Send discovery solicitation */
681  if ( ( rc = net_tx ( iob_disown ( iobuf ), fcoe->netdev,
682  &fip_protocol, all_fcf_macs,
683  fcoe->netdev->ll_addr ) ) != 0 ) {
684  DBGC ( fcoe, "FCoE %s could not send discovery solicitation: "
685  "%s\n", fcoe->netdev->name, strerror ( rc ) );
686  return rc;
687  }
688 
689  return 0;
690 }
#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:120
struct net_device * netdev
Network device.
Definition: fcoe.c:75
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:129
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:212
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:127
#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:78
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:67
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:33

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 700 of file fcoe.c.

702  {
703  struct fip_priority *priority = fip_priority ( descs );
704  struct fip_mac_address *mac_address = fip_mac_address ( descs );
705  struct fip_fka_adv_p *fka_adv_p = fip_fka_adv_p ( descs );
706 
707  /* Sanity checks */
708  if ( ! priority ) {
709  DBGC ( fcoe, "FCoE %s received advertisement missing "
710  "priority\n", fcoe->netdev->name );
711  return -EINVAL;
712  }
713  if ( ! mac_address ) {
714  DBGC ( fcoe, "FCoE %s received advertisement missing MAC "
715  "address\n", fcoe->netdev->name );
716  return -EINVAL;
717  }
718  if ( ! fka_adv_p ) {
719  DBGC ( fcoe, "FCoE %s received advertisement missing FKA ADV "
720  "period\n", fcoe->netdev->name );
721  return -EINVAL;
722  }
723 
724  if ( ! ( fcoe->flags & FCOE_HAVE_FCF ) ) {
725 
726  /* We are soliciting for an FCF. Store the highest
727  * (i.e. lowest-valued) priority solicited
728  * advertisement that we receive.
729  */
730  if ( ( ( flags & ( FIP_A | FIP_S | FIP_F ) ) ==
731  ( FIP_A | FIP_S | FIP_F ) ) &&
732  ( priority->priority < fcoe->priority ) ) {
733 
734  fcoe->flags |= FCOE_HAVE_FIP_FCF;
735  fcoe->priority = priority->priority;
736  if ( fka_adv_p->flags & FIP_NO_KEEPALIVE ) {
737  fcoe->keepalive = 0;
738  } else {
739  fcoe->keepalive = ntohl ( fka_adv_p->period );
740  }
741  fcoe->flags &= ~FCOE_FCF_ALLOWS_SPMA;
742  if ( flags & FIP_SP )
743  fcoe->flags |= FCOE_FCF_ALLOWS_SPMA;
744  memcpy ( fcoe->fcf_mac, mac_address->mac,
745  sizeof ( fcoe->fcf_mac ) );
746  DBGC ( fcoe, "FCoE %s selected FCF %s (pri %d",
747  fcoe->netdev->name, eth_ntoa ( fcoe->fcf_mac ),
748  fcoe->priority );
749  if ( fcoe->keepalive ) {
750  DBGC ( fcoe, ", FKA ADV %dms",
751  fcoe->keepalive );
752  }
753  DBGC ( fcoe, ", %cPMA)\n",
754  ( ( fcoe->flags & FCOE_FCF_ALLOWS_SPMA ) ?
755  'S' : 'F' ) );
756  }
757 
758  } else if ( fcoe->flags & FCOE_HAVE_FIP_FCF ) {
759 
760  /* We are checking that the FCF remains alive. Reset
761  * the timeout counter if this is an advertisement
762  * from our forwarder.
763  */
764  if ( memcmp ( fcoe->fcf_mac, mac_address->mac,
765  sizeof ( fcoe->fcf_mac ) ) == 0 ) {
766  fcoe->timeouts = 0;
767  }
768 
769  } else {
770 
771  /* We are operating in non-FIP mode and have received
772  * a FIP advertisement. Reset the link in order to
773  * attempt FIP.
774  */
775  fcoe_reset ( fcoe );
776 
777  }
778 
779  return 0;
780 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
unsigned int priority
FCoE forwarder priority.
Definition: fcoe.c:89
unsigned int flags
Flags.
Definition: fcoe.c:87
A FIP priority descriptor.
Definition: fip.h:124
struct net_device * netdev
Network device.
Definition: fcoe.c:75
uint8_t flags
Flags.
Definition: fip.h:315
unsigned int timeouts
FIP timeout counter.
Definition: fcoe.c:85
#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:105
static void fcoe_reset(struct fcoe_port *fcoe)
Reset FCoE port.
Definition: fcoe.c:164
FCoE forwarder supports server-provided MAC addresses.
Definition: fcoe.c:107
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:91
uint16_t priority
Priotity.
Definition: stp.h:12
We have selected an FCoE forwarder to use.
Definition: fcoe.c:103
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:93
uint32_t period
Keep alive advertisement period in milliseconds.
Definition: fip.h:317
Server-provided MAC address.
Definition: fip.h:84
uint8_t flags
Flags.
Definition: ena.h:18

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 790 of file fcoe.c.

792  {
793  struct fip_els *flogi = fip_flogi ( descs );
794  struct fip_mac_address *mac_address = fip_mac_address ( descs );
795  void *frame;
796  size_t frame_len;
797  int rc;
798 
799  /* Sanity checks */
800  if ( ! flogi ) {
801  DBGC ( fcoe, "FCoE %s received ELS response missing FLOGI\n",
802  fcoe->netdev->name );
803  return -EINVAL;
804  }
805  if ( ! mac_address ) {
806  DBGC ( fcoe, "FCoE %s received ELS response missing MAC "
807  "address\n", fcoe->netdev->name );
808  return -EINVAL;
809  }
810 
811  /* Record local MAC address */
812  memcpy ( fcoe->local_mac, mac_address->mac, sizeof ( fcoe->local_mac ));
813  DBGC ( fcoe, "FCoE %s using local MAC %s\n",
814  fcoe->netdev->name, eth_ntoa ( fcoe->local_mac ) );
815 
816  /* Hand off via transport interface */
817  frame = &flogi->fc;
818  frame_len = ( ( flogi->len * 4 ) - offsetof ( typeof ( *flogi ), fc ) );
819  if ( ( rc = xfer_deliver_raw ( &fcoe->transport, frame,
820  frame_len ) ) != 0 ) {
821  DBGC ( fcoe, "FCoE %s could not deliver FIP FLOGI frame: %s\n",
822  fcoe->netdev->name, strerror ( rc ) );
823  return rc;
824  }
825 
826  return 0;
827 }
#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:75
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:95
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:45
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:73

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 835 of file fcoe.c.

835  {
836  struct io_buffer *iobuf;
837  struct {
838  struct fip_header hdr;
839  struct fip_mac_address mac_address;
840  } __attribute__ (( packed )) *keepalive;
841  int rc;
842 
843  /* Allocate I/O buffer */
844  iobuf = alloc_iob ( MAX_LL_HEADER_LEN + sizeof ( *keepalive ) );
845  if ( ! iobuf )
846  return -ENOMEM;
847  iob_reserve ( iobuf, MAX_LL_HEADER_LEN );
848 
849  /* Construct keepalive */
850  keepalive = iob_put ( iobuf, sizeof ( *keepalive ) );
851  memset ( keepalive, 0, sizeof ( *keepalive ) );
852  keepalive->hdr.version = FIP_VERSION;
853  keepalive->hdr.code = htons ( FIP_CODE_MAINTAIN );
854  keepalive->hdr.subcode = FIP_MAINTAIN_KEEP_ALIVE;
855  keepalive->hdr.len = htons ( ( sizeof ( *keepalive ) -
856  sizeof ( keepalive->hdr ) ) / 4 );
857  keepalive->mac_address.type = FIP_MAC_ADDRESS;
858  keepalive->mac_address.len =
859  ( sizeof ( keepalive->mac_address ) / 4 );
860  memcpy ( keepalive->mac_address.mac, fcoe->netdev->ll_addr,
861  sizeof ( keepalive->mac_address.mac ) );
862 
863  /* Send keepalive */
864  if ( ( rc = net_tx ( iob_disown ( iobuf ), fcoe->netdev,
865  &fip_protocol, fcoe->fcf_mac,
866  fcoe->netdev->ll_addr ) ) != 0 ) {
867  DBGC ( fcoe, "FCoE %s could not send keepalive: %s\n",
868  fcoe->netdev->name, strerror ( rc ) );
869  return rc;
870  }
871 
872  return 0;
873 }
#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:120
struct net_device * netdev
Network device.
Definition: fcoe.c:75
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:129
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:212
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:67
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:93
void * memset(void *dest, int character, size_t len) __nonnull
A persistent I/O buffer.
Definition: iobuf.h:33

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 913 of file fcoe.c.

917  {
918  struct fip_header *fiphdr = iobuf->data;
919  struct fip_descriptors descs;
920  struct fip_handler *handler;
921  struct fcoe_port *fcoe;
922  unsigned int i;
923  int rc;
924 
925  /* Identify FCoE port */
926  fcoe = netdev_priv ( netdev, &fcoe_driver );
927  if ( ! fcoe->netdev ) {
928  DBG ( "FCoE received FIP frame for net device %s missing FCoE "
929  "port\n", netdev->name );
930  rc = -ENOTCONN;
931  goto done;
932  }
933 
934  /* Discard packets not destined for us */
935  if ( ( memcmp ( fcoe->netdev->ll_addr, ll_dest, ETH_ALEN ) != 0 ) &&
936  ( memcmp ( all_fcoe_macs, ll_dest,
937  sizeof ( all_fcoe_macs ) ) != 0 ) &&
938  ( memcmp ( all_enode_macs, ll_dest,
939  sizeof ( all_enode_macs ) ) != 0 ) ) {
940  DBGC2 ( fcoe, "FCoE %s ignoring FIP packet for %s\n",
941  fcoe->netdev->name, eth_ntoa ( ll_dest ) );
942  rc = -ENOTCONN;
943  goto done;
944  }
945 
946  /* Parse FIP packet */
947  if ( ( rc = fcoe_fip_parse ( fcoe, fiphdr, iob_len ( iobuf ),
948  &descs ) ) != 0 )
949  goto done;
950 
951  /* Find a suitable handler */
952  for ( i = 0 ; i < ( sizeof ( fip_handlers ) /
953  sizeof ( fip_handlers[0] ) ) ; i++ ) {
954  handler = &fip_handlers[i];
955  if ( ( handler->code == ntohs ( fiphdr->code ) ) &&
956  ( handler->subcode == fiphdr->subcode ) ) {
957  rc = handler->rx ( fcoe, &descs,
958  ntohs ( fiphdr->flags ) );
959  goto done;
960  }
961  }
962  DBGC ( fcoe, "FCoE %s received unsupported FIP code %04x.%02x\n",
963  fcoe->netdev->name, ntohs ( fiphdr->code ), fiphdr->subcode );
964  rc = -ENOTSUP;
965 
966  done:
967  free_iob ( iobuf );
968  return rc;
969 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
struct net_device * netdev
Network device.
Definition: fcoe.c:75
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:146
static struct fip_handler fip_handlers[]
FIP handlers.
Definition: fcoe.c:894
A FIP handler.
Definition: fcoe.c:876
#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:472
#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:123
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:155
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:71
#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:880
uint16_t code
Protocol code.
Definition: fcoe.c:878
void * data
Start of data.
Definition: iobuf.h:48
int(* rx)(struct fcoe_port *fcoe, struct fip_descriptors *descs, unsigned int flags)
Receive FIP packet.
Definition: fcoe.c:889
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:119
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 984 of file fcoe.c.

984  {
985  struct fcoe_port *fcoe =
986  container_of ( timer, struct fcoe_port, timer );
987  int rc;
988 
989  /* Sanity check */
990  assert ( fcoe->flags & FCOE_HAVE_NETWORK );
991 
992  /* Increment the timeout counter */
993  fcoe->timeouts++;
994 
995  if ( vlan_can_be_trunk ( fcoe->netdev ) &&
996  ! ( fcoe->flags & FCOE_VLAN_TIMED_OUT ) ) {
997 
998  /* If we have already found a VLAN, send infrequent
999  * VLAN requests, in case VLAN information changes.
1000  */
1001  if ( fcoe->flags & FCOE_VLAN_FOUND ) {
1002  fcoe->flags &= ~FCOE_VLAN_FOUND;
1003  fcoe->timeouts = 0;
1004  start_timer_fixed ( &fcoe->timer,
1006  fcoe_fip_tx_vlan ( fcoe );
1007  return;
1008  }
1009 
1010  /* If we have not yet found a VLAN, and we have not
1011  * yet timed out and given up on finding one, then
1012  * send a VLAN request and wait.
1013  */
1014  if ( fcoe->timeouts <= FCOE_MAX_VLAN_REQUESTS ) {
1015  start_timer_fixed ( &fcoe->timer,
1017  fcoe_fip_tx_vlan ( fcoe );
1018  return;
1019  }
1020 
1021  /* We have timed out waiting for a VLAN; proceed to
1022  * FIP discovery.
1023  */
1024  fcoe->flags |= FCOE_VLAN_TIMED_OUT;
1025  fcoe->timeouts = 0;
1026  DBGC ( fcoe, "FCoE %s giving up on VLAN discovery\n",
1027  fcoe->netdev->name );
1028  start_timer_nodelay ( &fcoe->timer );
1029 
1030  } else if ( ! ( fcoe->flags & FCOE_HAVE_FCF ) ) {
1031 
1032  /* If we have not yet found a FIP-capable forwarder,
1033  * and we have not yet timed out and given up on
1034  * finding one, then send a FIP solicitation and wait.
1035  */
1037  if ( ( ! ( fcoe->flags & FCOE_HAVE_FIP_FCF ) ) &&
1038  ( fcoe->timeouts <= FCOE_MAX_FIP_SOLICITATIONS ) ) {
1039  fcoe_fip_tx_solicitation ( fcoe );
1040  return;
1041  }
1042 
1043  /* Attach Fibre Channel port */
1044  if ( ( rc = fc_port_open ( &fcoe->transport, &fcoe->node_wwn.fc,
1045  &fcoe->port_wwn.fc,
1046  fcoe->netdev->name ) ) != 0 ) {
1047  DBGC ( fcoe, "FCoE %s could not create FC port: %s\n",
1048  fcoe->netdev->name, strerror ( rc ) );
1049  /* We will try again on the next timer expiry */
1050  return;
1051  }
1052  stop_timer ( &fcoe->timer );
1053 
1054  /* Either we have found a FIP-capable forwarder, or we
1055  * have timed out and will fall back to pre-FIP mode.
1056  */
1057  fcoe->flags |= FCOE_HAVE_FCF;
1058  fcoe->timeouts = 0;
1059  DBGC ( fcoe, "FCoE %s using %sFIP FCF %s\n", fcoe->netdev->name,
1060  ( ( fcoe->flags & FCOE_HAVE_FIP_FCF ) ? "" : "non-" ),
1061  eth_ntoa ( fcoe->fcf_mac ) );
1062 
1063  /* Start sending keepalives if applicable */
1064  if ( fcoe->keepalive )
1065  start_timer_nodelay ( &fcoe->timer );
1066 
1067  /* Send notification of window change */
1068  xfer_window_changed ( &fcoe->transport );
1069 
1070  } else {
1071 
1072  /* Send keepalive */
1073  start_timer_fixed ( &fcoe->timer,
1074  ( fcoe->keepalive * TICKS_PER_MS ) );
1075  fcoe_fip_tx_keepalive ( fcoe );
1076 
1077  /* Abandon FCF if we have not seen its advertisements */
1078  if ( fcoe->timeouts > FCOE_MAX_FIP_MISSING_KEEPALIVES ) {
1079  DBGC ( fcoe, "FCoE %s abandoning FCF %s\n",
1080  fcoe->netdev->name, eth_ntoa ( fcoe->fcf_mac ));
1081  fcoe_reset ( fcoe );
1082  }
1083  }
1084 }
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:141
An alternative VLAN has been found.
Definition: fcoe.c:109
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:835
unsigned int flags
Flags.
Definition: fcoe.c:87
struct net_device * netdev
Network device.
Definition: fcoe.c:75
#define FCOE_VLAN_RETRY_DELAY
Delay between retrying VLAN requests.
Definition: fcoe.c:138
unsigned int timeouts
FIP timeout counter.
Definition: fcoe.c:85
#define DBGC(...)
Definition: compiler.h:505
Underlying network device is available.
Definition: fcoe.c:101
#define FCOE_FIP_RETRY_DELAY
Delay between retrying FIP solicitations.
Definition: fcoe.c:147
static int fcoe_fip_tx_vlan(struct fcoe_port *fcoe)
Send FIP VLAN request.
Definition: fcoe.c:545
#define FCOE_MAX_VLAN_REQUESTS
Maximum number of VLAN requests before giving up on VLAN discovery.
Definition: fcoe.c:135
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:78
We have a FIP-capable FCoE forwarder available to be used.
Definition: fcoe.c:105
#define FCOE_MAX_FIP_MISSING_KEEPALIVES
Maximum number of missing discovery advertisements.
Definition: fcoe.c:150
static void fcoe_reset(struct fcoe_port *fcoe)
Reset FCoE port.
Definition: fcoe.c:164
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:639
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:144
An FCoE port.
Definition: fcoe.c:71
struct retry_timer timer
FIP retransmission timer.
Definition: fcoe.c:83
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:111
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:91
We have selected an FCoE forwarder to use.
Definition: fcoe.c:103
union fcoe_name port_wwn
Port WWN.
Definition: fcoe.c:80
uint8_t fcf_mac[ETH_ALEN]
FCoE forwarder MAC address.
Definition: fcoe.c:93
#define TICKS_PER_MS
Number of ticks per millisecond.
Definition: timer.h:25
struct interface transport
Transport interface.
Definition: fcoe.c:73

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 1093 of file fcoe.c.

1093  {
1095  struct fcoe_port *fcoe = priv;
1096 
1097  /* Sanity check */
1098  if ( ll_protocol->ll_proto != htons ( ARPHRD_ETHER ) ) {
1099  /* Not an error; simply skip this net device */
1100  DBG ( "FCoE skipping non-Ethernet device %s\n", netdev->name );
1101  return 0;
1102  }
1103 
1104  /* Initialise structure */
1106  timer_init ( &fcoe->timer, fcoe_expired, &netdev->refcnt );
1107  fcoe->netdev = netdev;
1108 
1109  /* Construct node and port names */
1111  memcpy ( &fcoe->node_wwn.fcoe.mac, netdev->ll_addr,
1112  sizeof ( fcoe->node_wwn.fcoe.mac ) );
1114  memcpy ( &fcoe->port_wwn.fcoe.mac, netdev->ll_addr,
1115  sizeof ( fcoe->port_wwn.fcoe.mac ) );
1116 
1117  DBGC ( fcoe, "FCoE %s is %s", fcoe->netdev->name,
1118  fc_ntoa ( &fcoe->node_wwn.fc ) );
1119  DBGC ( fcoe, " port %s\n", fc_ntoa ( &fcoe->port_wwn.fc ) );
1120 
1121  return 0;
1122 }
#define FCOE_AUTHORITY_IEEE
IEEE 48-bit address.
Definition: fcoe.h:31
struct net_device * netdev
Network device.
Definition: fcoe.c:75
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:453
#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:78
uint16_t authority
Naming authority.
Definition: fcoe.h:24
struct refcnt refcnt
Reference counter.
Definition: netdevice.h:354
An FCoE port.
Definition: fcoe.c:71
uint16_t ll_proto
Link-layer protocol.
Definition: netdevice.h:194
struct retry_timer timer
FIP retransmission timer.
Definition: fcoe.c:83
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:984
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
static struct tlan_private * priv
Definition: tlan.c:224
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
#define FCOE_AUTHORITY_IEEE_EXTENDED
IEEE extended.
Definition: fcoe.h:34
union fcoe_name port_wwn
Port WWN.
Definition: fcoe.c:80
#define htons(value)
Definition: byteswap.h:135
struct fcoe_name::@551 fcoe
FCoE name.
struct ll_protocol * ll_protocol
Link-layer protocol.
Definition: netdevice.h:372
struct interface transport
Transport interface.
Definition: fcoe.c:73

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 1130 of file fcoe.c.

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

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 1151 of file fcoe.c.

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

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:1093
static void fcoe_notify(struct net_device *netdev, void *priv)
Handle FCoE port device or link state change.
Definition: fcoe.c:1130
An FCoE port.
Definition: fcoe.c:71
static void fcoe_remove(struct net_device *netdev __unused, void *priv)
Destroy FCoE port.
Definition: fcoe.c:1151

FCoE driver.

Definition at line 114 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:320
#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 115 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 119 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 123 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 127 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 131 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:426
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:202
static struct io_buffer * fcoe_alloc_iob(struct fcoe_port *fcoe __unused, size_t len)
Allocate FCoE I/O buffer.
Definition: fcoe.c:297
#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:71
static struct device * fcoe_identify_device(struct fcoe_port *fcoe)
Identify device underlying FCoE port.
Definition: fcoe.c:438
static size_t fcoe_window(struct fcoe_port *fcoe)
Check FCoE flow control window.
Definition: fcoe.c:416
struct device * identify_device(struct interface *intf)
Identify a device behind an interface.
Definition: device.c:125

FCoE transport interface operations.

Definition at line 443 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:443
An FCoE port.
Definition: fcoe.c:71
#define INTF_DESC(object_type, intf, operations)
Define an object interface descriptor.
Definition: interface.h:80
struct interface transport
Transport interface.
Definition: fcoe.c:73

FCoE transport interface descriptor.

Definition at line 453 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:700
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:593
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:790
Discovery.
Definition: fip.h:51

FIP handlers.

Definition at line 894 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:64

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 1191 of file fcoe.c.