58 #define EINVAL_UNDERLENGTH __einfo_error ( EINFO_EINVAL_UNDERLENGTH ) 59 #define EINFO_EINVAL_UNDERLENGTH \ 60 __einfo_uniqify ( EINFO_EINVAL, 0x01, "Underlength packet" ) 61 #define EINVAL_SOF __einfo_error ( EINFO_EINVAL_SOF ) 62 #define EINFO_EINVAL_SOF \ 63 __einfo_uniqify ( EINFO_EINVAL, 0x02, "Invalid SoF delimiter" ) 64 #define EINVAL_CRC __einfo_error ( EINFO_EINVAL_CRC ) 65 #define EINFO_EINVAL_CRC \ 66 __einfo_uniqify ( EINFO_EINVAL, 0x03, "Invalid CRC (not stripped?)" ) 67 #define EINVAL_EOF __einfo_error ( EINFO_EINVAL_EOF ) 68 #define EINFO_EINVAL_EOF \ 69 __einfo_uniqify ( EINFO_EINVAL, 0x04, "Invalid EoF delimiter" ) 121 { 0x01, 0x10, 0x18, 0x01, 0x00, 0x00 };
125 { 0x01, 0x10, 0x18, 0x01, 0x00, 0x01 };
129 { 0x01, 0x10, 0x18, 0x01, 0x00, 0x02 };
133 { 0x0e, 0xfc, 0x00, 0xff, 0xff, 0xfe };
136 #define FCOE_MAX_VLAN_REQUESTS 2 139 #define FCOE_VLAN_RETRY_DELAY ( TICKS_PER_SEC ) 142 #define FCOE_VLAN_POLL_DELAY ( 30 * TICKS_PER_SEC ) 145 #define FCOE_MAX_FIP_SOLICITATIONS 2 148 #define FCOE_FIP_RETRY_DELAY ( TICKS_PER_SEC ) 151 #define FCOE_MAX_FIP_MISSING_KEEPALIVES 4 188 "VLAN discovery" :
"FIP solicitation" ) );
231 fipmac =
iob_put ( iobuf,
sizeof ( *fipmac ) );
232 memset ( fipmac, 0,
sizeof ( *fipmac ) );
234 fipmac->
len = (
sizeof ( *fipmac ) / 4 );
237 sizeof ( fipmac->
mac ) );
241 fiphdr =
iob_push ( iobuf,
sizeof ( *fiphdr ) );
242 memset ( fiphdr, 0,
sizeof ( *fiphdr ) );
247 htons ( (
iob_len ( iobuf ) -
sizeof ( *fiphdr ) ) / 4);
262 fcoehdr =
iob_push ( iobuf,
sizeof ( *fcoehdr ) );
263 memset ( fcoehdr, 0,
sizeof ( *fcoehdr ) );
268 fcoeftr =
iob_put ( iobuf,
sizeof ( *fcoeftr ) );
269 memset ( fcoeftr, 0,
sizeof ( *fcoeftr ) );
281 fcoe->
fcf_mac, ll_source ) ) != 0 ) {
282 DBGC ( fcoe,
"FCoE %s could not transmit: %s\n",
322 const void *ll_dest,
const void *ll_source,
332 DBG (
"FCoE received frame for net device %s missing FCoE " 343 DBGC2 ( fcoe,
"FCoE %s ignoring packet for %s\n",
350 if (
iob_len ( iobuf ) < (
sizeof ( *fcoehdr ) +
sizeof ( *fcoeftr ) )){
351 DBGC ( fcoe,
"FCoE %s received under-length frame (%zd " 358 fcoehdr = iobuf->
data;
359 iob_pull ( iobuf,
sizeof ( *fcoehdr ) );
360 fcoeftr = ( iobuf->
data +
iob_len ( iobuf ) -
sizeof ( *fcoeftr ) );
361 iob_unput ( iobuf,
sizeof ( *fcoeftr ) );
365 DBGC ( fcoe,
"FCoE %s received unsupported frame version " 372 DBGC ( fcoe,
"FCoE %s received unsupported start-of-frame " 379 DBGC ( fcoe,
"FCoE %s received invalid CRC\n",
386 DBGC ( fcoe,
"FCoE %s received unsupported end-of-frame " 401 DBGC ( fcoe,
"FCoE %s could not deliver frame: %s\n",
479 unsigned int desc_type;
483 DBGC ( fcoe,
"FCoE %s received unsupported FIP version %02x\n",
489 descs_len = (
ntohs ( fiphdr->
len ) * 4 );
490 if ( (
sizeof ( *fiphdr ) + descs_len ) >
len ) {
491 DBGC ( fcoe,
"FCoE %s received bad descriptor list length\n",
497 memset ( descs, 0,
sizeof ( *descs ) );
498 for ( desc_offset = 0 ;
499 desc_offset <= ( descs_len -
sizeof (
desc->common ) ) ;
500 desc_offset += desc_len ) {
503 desc = ( ( (
void * ) ( fiphdr + 1 ) ) + desc_offset );
504 desc_type =
desc->common.type;
505 desc_len = (
desc->common.len * 4 );
506 if ( desc_len == 0 ) {
507 DBGC ( fcoe,
"FCoE %s received zero-length " 511 if ( ( desc_offset + desc_len ) > descs_len ) {
512 DBGC ( fcoe,
"FCoE %s descriptor overrun\n",
521 if ( descs->
desc[desc_type] ==
NULL )
528 DBGC ( fcoe,
"FCoE %s cannot understand critical " 529 "descriptor type %02x\n",
567 sizeof (
request->hdr ) ) / 4 );
570 (
sizeof (
request->mac_address ) / 4 );
572 sizeof (
request->mac_address.mac ) );
578 DBGC ( fcoe,
"FCoE %s could not send VLAN request: " 603 if ( ! mac_address ) {
604 DBGC ( fcoe,
"FCoE %s received VLAN notification missing MAC " 609 DBGC ( fcoe,
"FCoE %s received VLAN notification missing VLAN " 616 DBGC ( fcoe,
"FCoE %s creating VLAN %d for FCF %s\n",
620 DBGC ( fcoe,
"FCoE %s could not create VLAN %d: %s\n",
657 solicitation =
iob_put ( iobuf,
sizeof ( *solicitation ) );
658 memset ( solicitation, 0,
sizeof ( *solicitation ) );
662 solicitation->hdr.len =
htons ( (
sizeof ( *solicitation ) -
663 sizeof ( solicitation->hdr ) ) / 4 );
666 solicitation->mac_address.len =
667 (
sizeof ( solicitation->mac_address ) / 4 );
669 sizeof ( solicitation->mac_address.mac ) );
671 solicitation->name_id.len = (
sizeof ( solicitation->name_id ) / 4 );
673 sizeof ( solicitation->name_id.name ) );
675 solicitation->max_fcoe_size.len =
676 (
sizeof ( solicitation->max_fcoe_size ) / 4 );
677 solicitation->max_fcoe_size.mtu =
685 DBGC ( fcoe,
"FCoE %s could not send discovery solicitation: " 703 unsigned int flags ) {
710 DBGC ( fcoe,
"FCoE %s received advertisement missing " 714 if ( ! mac_address ) {
715 DBGC ( fcoe,
"FCoE %s received advertisement missing MAC " 720 DBGC ( fcoe,
"FCoE %s received advertisement missing FKA ADV " 747 DBGC ( fcoe,
"FCoE %s selected FCF %s (pri %d",
751 DBGC ( fcoe,
", FKA ADV %dms",
754 DBGC ( fcoe,
", %cPMA)\n",
766 sizeof ( fcoe->
fcf_mac ) ) == 0 ) {
794 struct fip_els *flogi = fip_flogi ( descs );
802 DBGC ( fcoe,
"FCoE %s received ELS response missing FLOGI\n",
806 if ( ! mac_address ) {
807 DBGC ( fcoe,
"FCoE %s received ELS response missing MAC " 814 DBGC ( fcoe,
"FCoE %s using local MAC %s\n",
821 frame_len ) ) != 0 ) {
822 DBGC ( fcoe,
"FCoE %s could not deliver FIP FLOGI frame: %s\n",
851 keepalive =
iob_put ( iobuf,
sizeof ( *keepalive ) );
852 memset ( keepalive, 0,
sizeof ( *keepalive ) );
856 keepalive->hdr.len =
htons ( (
sizeof ( *keepalive ) -
857 sizeof ( keepalive->hdr ) ) / 4 );
859 keepalive->mac_address.len =
860 (
sizeof ( keepalive->mac_address ) / 4 );
862 sizeof ( keepalive->mac_address.mac ) );
868 DBGC ( fcoe,
"FCoE %s could not send keepalive: %s\n",
891 unsigned int flags );
929 DBG (
"FCoE received FIP frame for net device %s missing FCoE " 941 DBGC2 ( fcoe,
"FCoE %s ignoring FIP packet for %s\n",
958 rc = handler->
rx ( fcoe, &descs,
963 DBGC ( fcoe,
"FCoE %s received unsupported FIP code %04x.%02x\n",
1027 DBGC ( fcoe,
"FCoE %s giving up on VLAN discovery\n",
1048 DBGC ( fcoe,
"FCoE %s could not create FC port: %s\n",
1080 DBGC ( fcoe,
"FCoE %s abandoning FCF %s\n",
1101 DBG (
"FCoE skipping non-Ethernet device %s\n",
netdev->
name );
1166 .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.
#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.
struct ena_llq_option desc
Descriptor counts.
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.
uint8_t meta
Metadata flags.
#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 fcoe_name::@614 fcoe
FCoE name.
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 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)