57 #define EINVAL_UNDERLENGTH __einfo_error ( EINFO_EINVAL_UNDERLENGTH ) 58 #define EINFO_EINVAL_UNDERLENGTH \ 59 __einfo_uniqify ( EINFO_EINVAL, 0x01, "Underlength packet" ) 60 #define EINVAL_SOF __einfo_error ( EINFO_EINVAL_SOF ) 61 #define EINFO_EINVAL_SOF \ 62 __einfo_uniqify ( EINFO_EINVAL, 0x02, "Invalid SoF delimiter" ) 63 #define EINVAL_CRC __einfo_error ( EINFO_EINVAL_CRC ) 64 #define EINFO_EINVAL_CRC \ 65 __einfo_uniqify ( EINFO_EINVAL, 0x03, "Invalid CRC (not stripped?)" ) 66 #define EINVAL_EOF __einfo_error ( EINFO_EINVAL_EOF ) 67 #define EINFO_EINVAL_EOF \ 68 __einfo_uniqify ( EINFO_EINVAL, 0x04, "Invalid EoF delimiter" ) 120 { 0x01, 0x10, 0x18, 0x01, 0x00, 0x00 };
124 { 0x01, 0x10, 0x18, 0x01, 0x00, 0x01 };
128 { 0x01, 0x10, 0x18, 0x01, 0x00, 0x02 };
132 { 0x0e, 0xfc, 0x00, 0xff, 0xff, 0xfe };
135 #define FCOE_MAX_VLAN_REQUESTS 2 138 #define FCOE_VLAN_RETRY_DELAY ( TICKS_PER_SEC ) 141 #define FCOE_VLAN_POLL_DELAY ( 30 * TICKS_PER_SEC ) 144 #define FCOE_MAX_FIP_SOLICITATIONS 2 147 #define FCOE_FIP_RETRY_DELAY ( TICKS_PER_SEC ) 150 #define FCOE_MAX_FIP_MISSING_KEEPALIVES 4 187 "VLAN discovery" :
"FIP solicitation" ) );
230 fipmac =
iob_put ( iobuf,
sizeof ( *fipmac ) );
231 memset ( fipmac, 0,
sizeof ( *fipmac ) );
233 fipmac->
len = (
sizeof ( *fipmac ) / 4 );
236 sizeof ( fipmac->
mac ) );
240 fiphdr =
iob_push ( iobuf,
sizeof ( *fiphdr ) );
241 memset ( fiphdr, 0,
sizeof ( *fiphdr ) );
246 htons ( (
iob_len ( iobuf ) -
sizeof ( *fiphdr ) ) / 4);
261 fcoehdr =
iob_push ( iobuf,
sizeof ( *fcoehdr ) );
262 memset ( fcoehdr, 0,
sizeof ( *fcoehdr ) );
267 fcoeftr =
iob_put ( iobuf,
sizeof ( *fcoeftr ) );
268 memset ( fcoeftr, 0,
sizeof ( *fcoeftr ) );
280 fcoe->
fcf_mac, ll_source ) ) != 0 ) {
281 DBGC ( fcoe,
"FCoE %s could not transmit: %s\n",
321 const void *ll_dest,
const void *ll_source,
331 DBG (
"FCoE received frame for net device %s missing FCoE " 342 DBGC2 ( fcoe,
"FCoE %s ignoring packet for %s\n",
349 if (
iob_len ( iobuf ) < (
sizeof ( *fcoehdr ) +
sizeof ( *fcoeftr ) )){
350 DBGC ( fcoe,
"FCoE %s received under-length frame (%zd " 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 ) );
364 DBGC ( fcoe,
"FCoE %s received unsupported frame version " 371 DBGC ( fcoe,
"FCoE %s received unsupported start-of-frame " 378 DBGC ( fcoe,
"FCoE %s received invalid CRC\n",
385 DBGC ( fcoe,
"FCoE %s received unsupported end-of-frame " 400 DBGC ( fcoe,
"FCoE %s could not deliver frame: %s\n",
478 unsigned int desc_type;
482 DBGC ( fcoe,
"FCoE %s received unsupported FIP version %02x\n",
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",
496 memset ( descs, 0,
sizeof ( *descs ) );
497 for ( desc_offset = 0 ;
498 desc_offset <= ( descs_len -
sizeof (
desc->common ) ) ;
499 desc_offset += desc_len ) {
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 " 510 if ( ( desc_offset + desc_len ) > descs_len ) {
511 DBGC ( fcoe,
"FCoE %s descriptor overrun\n",
520 if ( descs->
desc[desc_type] ==
NULL )
527 DBGC ( fcoe,
"FCoE %s cannot understand critical " 528 "descriptor type %02x\n",
566 sizeof (
request->hdr ) ) / 4 );
569 (
sizeof (
request->mac_address ) / 4 );
571 sizeof (
request->mac_address.mac ) );
577 DBGC ( fcoe,
"FCoE %s could not send VLAN request: " 602 if ( ! mac_address ) {
603 DBGC ( fcoe,
"FCoE %s received VLAN notification missing MAC " 608 DBGC ( fcoe,
"FCoE %s received VLAN notification missing VLAN " 615 DBGC ( fcoe,
"FCoE %s creating VLAN %d for FCF %s\n",
619 DBGC ( fcoe,
"FCoE %s could not create VLAN %d: %s\n",
656 solicitation =
iob_put ( iobuf,
sizeof ( *solicitation ) );
657 memset ( solicitation, 0,
sizeof ( *solicitation ) );
661 solicitation->hdr.len =
htons ( (
sizeof ( *solicitation ) -
662 sizeof ( solicitation->hdr ) ) / 4 );
665 solicitation->mac_address.len =
666 (
sizeof ( solicitation->mac_address ) / 4 );
668 sizeof ( solicitation->mac_address.mac ) );
670 solicitation->name_id.len = (
sizeof ( solicitation->name_id ) / 4 );
672 sizeof ( solicitation->name_id.name ) );
674 solicitation->max_fcoe_size.len =
675 (
sizeof ( solicitation->max_fcoe_size ) / 4 );
676 solicitation->max_fcoe_size.mtu =
684 DBGC ( fcoe,
"FCoE %s could not send discovery solicitation: " 702 unsigned int flags ) {
709 DBGC ( fcoe,
"FCoE %s received advertisement missing " 713 if ( ! mac_address ) {
714 DBGC ( fcoe,
"FCoE %s received advertisement missing MAC " 719 DBGC ( fcoe,
"FCoE %s received advertisement missing FKA ADV " 746 DBGC ( fcoe,
"FCoE %s selected FCF %s (pri %d",
750 DBGC ( fcoe,
", FKA ADV %dms",
753 DBGC ( fcoe,
", %cPMA)\n",
765 sizeof ( fcoe->
fcf_mac ) ) == 0 ) {
793 struct fip_els *flogi = fip_flogi ( descs );
801 DBGC ( fcoe,
"FCoE %s received ELS response missing FLOGI\n",
805 if ( ! mac_address ) {
806 DBGC ( fcoe,
"FCoE %s received ELS response missing MAC " 813 DBGC ( fcoe,
"FCoE %s using local MAC %s\n",
820 frame_len ) ) != 0 ) {
821 DBGC ( fcoe,
"FCoE %s could not deliver FIP FLOGI frame: %s\n",
850 keepalive =
iob_put ( iobuf,
sizeof ( *keepalive ) );
851 memset ( keepalive, 0,
sizeof ( *keepalive ) );
855 keepalive->hdr.len =
htons ( (
sizeof ( *keepalive ) -
856 sizeof ( keepalive->hdr ) ) / 4 );
858 keepalive->mac_address.len =
859 (
sizeof ( keepalive->mac_address ) / 4 );
861 sizeof ( keepalive->mac_address.mac ) );
867 DBGC ( fcoe,
"FCoE %s could not send keepalive: %s\n",
890 unsigned int flags );
928 DBG (
"FCoE received FIP frame for net device %s missing FCoE " 940 DBGC2 ( fcoe,
"FCoE %s ignoring FIP packet for %s\n",
957 rc = handler->
rx ( fcoe, &descs,
962 DBGC ( fcoe,
"FCoE %s received unsupported FIP code %04x.%02x\n",
1026 DBGC ( fcoe,
"FCoE %s giving up on VLAN discovery\n",
1047 DBGC ( fcoe,
"FCoE %s could not create FC port: %s\n",
1079 DBGC ( fcoe,
"FCoE %s abandoning FCF %s\n",
1100 DBG (
"FCoE skipping non-Ethernet device %s\n",
netdev->
name );
1165 .priv_len =
sizeof (
struct fcoe_port ),
#define iob_pull(iobuf, len)
#define EINVAL
Invalid argument.
An object interface operation.
A FIP descriptor containing an encapsulated login frame.
Fibre Channel ELS frame common parameters.
#define FCOE_AUTHORITY_IEEE
IEEE 48-bit address.
struct arbelprm_rc_send_wqe rc
void xfer_window_changed(struct interface *intf)
Report change of flow control window.
#define FCOE_VLAN_POLL_DELAY
Delay between retrying polling VLAN requests.
void intf_close(struct interface *intf, int rc)
Close an object interface.
const char * name
Protocol name.
void intf_restart(struct interface *intf, int rc)
Shut down and restart an object interface.
#define iob_put(iobuf, len)
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
An alternative VLAN has been found.
#define EINVAL_UNDERLENGTH
int xfer_deliver_iob(struct interface *intf, struct io_buffer *iobuf)
Deliver datagram as I/O buffer without metadata.
unsigned int priority
FCoE forwarder priority.
#define FIP_LOWEST_PRIORITY
Lowest FIP priority.
static void start_timer_nodelay(struct retry_timer *timer)
Start timer with no delay.
static int fcoe_fip_tx_keepalive(struct fcoe_port *fcoe)
Send FIP keepalive.
#define FEATURE_PROTOCOL
Network protocols.
#define le32_to_cpu(value)
A FIP priority descriptor.
struct net_device * netdev
Network device.
struct golan_inbox_hdr hdr
Message header.
#define FCOE_VLAN_RETRY_DELAY
Delay between retrying VLAN requests.
#define iob_push(iobuf, len)
u16 fc
802.11 Frame Control field
uint8_t mac[ETH_ALEN]
MAC address.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
static struct interface_operation fcoe_transport_op[]
FCoE transport interface operations.
#define FIP_VERSION
FIP frame version.
uint8_t command
ELS command code.
static int fcoe_probe(struct net_device *netdev, void *priv)
Create FCoE port.
static struct fip_handler fip_handlers[]
FIP handlers.
#define __einfo_errortab(einfo)
static struct interface_descriptor fcoe_transport_desc
FCoE transport interface descriptor.
unsigned int timeouts
FIP timeout counter.
uint64_t desc
Microcode descriptor list physical address.
#define FCOE_VLAN_PRIORITY
FCoE VLAN priority.
Underlying network device is available.
#define FCOE_FIP_RETRY_DELAY
Delay between retrying FIP solicitations.
struct io_buffer * xfer_alloc_iob(struct interface *intf, size_t len)
Allocate I/O buffer.
static void fcoe_notify(struct net_device *netdev, void *priv)
Handle FCoE port device or link state change.
static void fcoe_close(struct fcoe_port *fcoe, int rc)
Close FCoE port.
const char * fc_ntoa(const struct fc_name *wwn)
Format Fibre Channel WWN.
#define offsetof(type, field)
Get offset of a field within a structure.
static int fcoe_fip_tx_vlan(struct fcoe_port *fcoe)
Send FIP VLAN request.
uint8_t local_mac[ETH_ALEN]
Local MAC address.
struct net_protocol fcoe_protocol __net_protocol
FCoE protocol.
Last Data Frame of Sequence.
uint8_t len
Length in 32-bit words.
#define FCOE_MAX_VLAN_REQUESTS
Maximum number of VLAN requests before giving up on VLAN discovery.
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.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
A network upper-layer driver.
size_t xfer_window(struct interface *intf)
Check flow control window.
Address Resolution Protocol constants and types.
int vlan_create(struct net_device *trunk, unsigned int tag, unsigned int priority)
Create VLAN device.
#define ECANCELED
Operation canceled.
int xfer_deliver_raw(struct interface *intf, const void *data, size_t len)
Deliver datagram as raw data without metadata.
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.
#define ENOTSUP
Operation not supported.
Data transfer interfaces.
static uint8_t all_enode_macs[ETH_ALEN]
FCoE All-ENode-MACs address.
u32 crc32_le(u32 seed, const void *data, size_t len)
Calculate 32-bit little-endian CRC checksum.
Fibre Channel over Ethernet.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
#define ENOMEM
Not enough space.
static int fcoe_deliver(struct fcoe_port *fcoe, struct io_buffer *iobuf, struct xfer_metadata *meta __unused)
Transmit FCoE packet.
#define iob_disown(iobuf)
Disown an I/O buffer.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static struct io_buffer * fcoe_alloc_iob(struct fcoe_port *fcoe __unused, size_t len)
Allocate FCoE I/O buffer.
static int netdev_is_open(struct net_device *netdev)
Check whether or not network device is open.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define container_of(ptr, type, field)
Get containing structure.
static uint8_t all_fcf_macs[ETH_ALEN]
FCoE All-FCF-MACs address.
void * netdev_priv(struct net_device *netdev, struct net_driver *driver)
Get network device driver private data.
#define __unused
Declare a variable or data structure as unused.
static int fcoe_fip_rx_advertisement(struct fcoe_port *fcoe, struct fip_descriptors *descs, unsigned int flags)
Handle received FIP discovery advertisement.
struct errortab fcoe_errors [] __errortab
Human-readable message for CRC errors.
static int netdev_link_ok(struct net_device *netdev)
Check link state of network device.
static struct net_device * netdev
#define MAX_LL_HEADER_LEN
Maximum length of a link-layer header.
union fcoe_name node_wwn
Node WWN.
We have a FIP-capable FCoE forwarder available to be used.
#define FCOE_MAX_FIP_MISSING_KEEPALIVES
Maximum number of missing discovery advertisements.
static void fcoe_reset(struct fcoe_port *fcoe)
Reset FCoE port.
uint16_t authority
Naming authority.
#define cpu_to_le32(value)
FCoE forwarder supports server-provided MAC addresses.
#define ENOTCONN
The socket is not connected.
An object interface descriptor.
#define iob_unput(iobuf, len)
char * strerror(int errno)
Retrieve string representation of error number.
struct refcnt refcnt
Reference counter.
uint8_t len
Length in 32-bit words.
static int fcoe_fip_tx_solicitation(struct fcoe_port *fcoe)
Send FIP discovery solicitation.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
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.
#define FCOE_MAX_FIP_SOLICITATIONS
Maximum number of FIP solicitations before giving up on FIP.
int xfer_deliver(struct interface *intf, struct io_buffer *iobuf, struct xfer_metadata *meta)
Deliver datagram.
A FIP MAC address descriptor.
A FIP max FCoE size descriptor.
static void fcoe_remove(struct net_device *netdev __unused, void *priv)
Destroy FCoE port.
static struct device * fcoe_identify_device(struct fcoe_port *fcoe)
Identify device underlying FCoE port.
uint16_t ll_proto
Link-layer protocol.
A FIP FKA ADV period descriptor.
union fip_descriptor * desc[FIP_NUM_DESCRIPTOR_TYPES]
Descriptors, indexed by type.
struct retry_timer timer
FIP retransmission timer.
A FIP descriptor containing an encapsulated ELS frame.
static size_t fcoe_window(struct fcoe_port *fcoe)
Check FCoE flow control window.
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.
struct device * dev
Underlying hardware device.
struct fc_name fc
Fibre Channel name.
A network-layer protocol.
static void fcoe_expired(struct retry_timer *timer, int over __unused)
Handle FCoE timer expiry.
Network device management.
void start_timer_fixed(struct retry_timer *timer, unsigned long timeout)
Start timer with a specified timeout.
VLAN discovery has timed out.
static int fcoe_fip_rx_vlan(struct fcoe_port *fcoe, struct fip_descriptors *descs, unsigned int flags __unused)
Handle received FIP VLAN notification.
Start of Frame Initiate Class 3.
#define iob_reserve(iobuf, len)
#define INTF_DESC(object_type, intf, operations)
Define an object interface descriptor.
void stop_timer(struct retry_timer *timer)
Stop timer.
int vlan_can_be_trunk(struct net_device *trunk)
Check if network device can be used as a VLAN trunk device.
char name[NETDEV_NAME_LEN]
Name of this network device.
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.
unsigned int keepalive
Keepalive delay (in ms)
static struct tlan_private * priv
#define EPROTONOSUPPORT
Protocol not supported.
static int fcoe_fip_rx_els_response(struct fcoe_port *fcoe, struct fip_descriptors *descs, unsigned int flags __unused)
Handle received FIP ELS response.
struct net_driver fcoe_driver __net_driver
FCoE driver.
uint16_t priority
Priotity.
uint8_t subcode
Protocol subcode.
uint16_t code
Protocol code.
void * data
Start of data.
int(* rx)(struct fcoe_port *fcoe, struct fip_descriptors *descs, unsigned int flags)
Receive FIP packet.
u8 request[0]
List of IEs requested.
We have selected an FCoE forwarder to use.
uint8_t mac[ETH_ALEN]
MAC address.
struct device * identify_device(struct interface *intf)
Identify a device behind an interface.
typeof(acpi_finder=acpi_find)
ACPI table finder.
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
#define DHCP_EB_FEATURE_FCOE
FCoE protocol.
#define DBG(...)
Print a debugging message.
Fabric-provided MAC address.
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
#define FCOE_FRAME_VER
FCoE frame version.
#define ARPHRD_ETHER
Ethernet 10Mbps.
struct fc_frame_header fc
Fibre Channel frame header.
#define FCOE_AUTHORITY_IEEE_EXTENDED
IEEE extended.
uint64_t tag
Identity tag.
union fcoe_name port_wwn
Port WWN.
static uint8_t all_fcoe_macs[ETH_ALEN]
FCoE All-FCoE-MACs address.
A FIP name identifier descriptor.
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
#define FIP_IS_CRITICAL(type)
FIP descriptor type is critical.
static uint8_t default_fcf_mac[ETH_ALEN]
Default FCoE forwarded MAC address.
#define NULL
NULL pointer (VOID *)
Start of Frame Normal Class 3.
struct fcoe_name::@605 fcoe
FCoE name.
struct bofm_section_header done
uint8_t fcf_mac[ETH_ALEN]
FCoE forwarder MAC address.
#define TICKS_PER_MS
Number of ticks per millisecond.
uint8_t len
Length in 32-bit words.
uint32_t period
Keep alive advertisement period in milliseconds.
struct ll_protocol * ll_protocol
Link-layer protocol.
struct interface transport
Transport interface.
Server-provided MAC address.
void * memset(void *dest, int character, size_t len) __nonnull
FEATURE(FEATURE_PROTOCOL, "FCoE", DHCP_EB_FEATURE_FCOE, 1)