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" ) 123 { 0x01, 0x10, 0x18, 0x01, 0x00, 0x00 };
127 { 0x01, 0x10, 0x18, 0x01, 0x00, 0x01 };
131 { 0x01, 0x10, 0x18, 0x01, 0x00, 0x02 };
135 { 0x0e, 0xfc, 0x00, 0xff, 0xff, 0xfe };
138 #define FCOE_MAX_VLAN_REQUESTS 2 141 #define FCOE_VLAN_RETRY_DELAY ( TICKS_PER_SEC ) 144 #define FCOE_VLAN_POLL_DELAY ( 30 * TICKS_PER_SEC ) 147 #define FCOE_MAX_FIP_SOLICITATIONS 2 150 #define FCOE_FIP_RETRY_DELAY ( TICKS_PER_SEC ) 153 #define FCOE_MAX_FIP_MISSING_KEEPALIVES 4 209 "VLAN discovery" :
"FIP solicitation" ) );
252 fipmac =
iob_put ( iobuf,
sizeof ( *fipmac ) );
253 memset ( fipmac, 0,
sizeof ( *fipmac ) );
255 fipmac->
len = (
sizeof ( *fipmac ) / 4 );
258 sizeof ( fipmac->
mac ) );
262 fiphdr =
iob_push ( iobuf,
sizeof ( *fiphdr ) );
263 memset ( fiphdr, 0,
sizeof ( *fiphdr ) );
268 htons ( (
iob_len ( iobuf ) -
sizeof ( *fiphdr ) ) / 4);
283 fcoehdr =
iob_push ( iobuf,
sizeof ( *fcoehdr ) );
284 memset ( fcoehdr, 0,
sizeof ( *fcoehdr ) );
289 fcoeftr =
iob_put ( iobuf,
sizeof ( *fcoeftr ) );
290 memset ( fcoeftr, 0,
sizeof ( *fcoeftr ) );
302 fcoe->
fcf_mac, ll_source ) ) != 0 ) {
303 DBGC ( fcoe,
"FCoE %s could not transmit: %s\n",
343 const void *ll_dest,
const void *ll_source,
352 DBG (
"FCoE received frame for net device %s missing FCoE " 363 DBGC2 ( fcoe,
"FCoE %s ignoring packet for %s\n",
370 if (
iob_len ( iobuf ) < (
sizeof ( *fcoehdr ) +
sizeof ( *fcoeftr ) )){
371 DBGC ( fcoe,
"FCoE %s received under-length frame (%zd " 378 fcoehdr = iobuf->
data;
379 iob_pull ( iobuf,
sizeof ( *fcoehdr ) );
380 fcoeftr = ( iobuf->
data +
iob_len ( iobuf ) -
sizeof ( *fcoeftr ) );
381 iob_unput ( iobuf,
sizeof ( *fcoeftr ) );
385 DBGC ( fcoe,
"FCoE %s received unsupported frame version " 392 DBGC ( fcoe,
"FCoE %s received unsupported start-of-frame " 399 DBGC ( fcoe,
"FCoE %s received invalid CRC\n",
406 DBGC ( fcoe,
"FCoE %s received unsupported end-of-frame " 421 DBGC ( fcoe,
"FCoE %s could not deliver frame: %s\n",
502 unsigned int desc_type;
506 DBGC ( fcoe,
"FCoE %s received unsupported FIP version %02x\n",
512 descs_len = (
ntohs ( fiphdr->
len ) * 4 );
513 if ( (
sizeof ( *fiphdr ) + descs_len ) >
len ) {
514 DBGC ( fcoe,
"FCoE %s received bad descriptor list length\n",
520 memset ( descs, 0,
sizeof ( *descs ) );
521 for ( desc_offset = 0 ;
522 desc_offset <= ( descs_len -
sizeof ( desc->
common ) ) ;
523 desc_offset += desc_len ) {
526 desc = ( ( (
void * ) ( fiphdr + 1 ) ) + desc_offset );
529 if ( desc_len == 0 ) {
530 DBGC ( fcoe,
"FCoE %s received zero-length " 534 if ( ( desc_offset + desc_len ) > descs_len ) {
535 DBGC ( fcoe,
"FCoE %s descriptor overrun\n",
544 if ( descs->
desc[desc_type] ==
NULL )
545 descs->
desc[desc_type] = desc;
551 DBGC ( fcoe,
"FCoE %s cannot understand critical " 552 "descriptor type %02x\n",
590 sizeof (
request->hdr ) ) / 4 );
593 (
sizeof (
request->mac_address ) / 4 );
595 sizeof (
request->mac_address.mac ) );
601 DBGC ( fcoe,
"FCoE %s could not send VLAN request: " 626 if ( ! mac_address ) {
627 DBGC ( fcoe,
"FCoE %s received VLAN notification missing MAC " 632 DBGC ( fcoe,
"FCoE %s received VLAN notification missing VLAN " 639 DBGC ( fcoe,
"FCoE %s creating VLAN %d for FCF %s\n",
643 DBGC ( fcoe,
"FCoE %s could not create VLAN %d: %s\n",
680 solicitation =
iob_put ( iobuf,
sizeof ( *solicitation ) );
681 memset ( solicitation, 0,
sizeof ( *solicitation ) );
685 solicitation->hdr.len =
htons ( (
sizeof ( *solicitation ) -
686 sizeof ( solicitation->hdr ) ) / 4 );
689 solicitation->mac_address.len =
690 (
sizeof ( solicitation->mac_address ) / 4 );
692 sizeof ( solicitation->mac_address.mac ) );
694 solicitation->name_id.len = (
sizeof ( solicitation->name_id ) / 4 );
696 sizeof ( solicitation->name_id.name ) );
698 solicitation->max_fcoe_size.len =
699 (
sizeof ( solicitation->max_fcoe_size ) / 4 );
700 solicitation->max_fcoe_size.mtu =
708 DBGC ( fcoe,
"FCoE %s could not send discovery solicitation: " 726 unsigned int flags ) {
733 DBGC ( fcoe,
"FCoE %s received advertisement missing " 737 if ( ! mac_address ) {
738 DBGC ( fcoe,
"FCoE %s received advertisement missing MAC " 743 DBGC ( fcoe,
"FCoE %s received advertisement missing FKA ADV " 770 DBGC ( fcoe,
"FCoE %s selected FCF %s (pri %d",
774 DBGC ( fcoe,
", FKA ADV %dms",
777 DBGC ( fcoe,
", %cPMA)\n",
789 sizeof ( fcoe->
fcf_mac ) ) == 0 ) {
817 struct fip_els *flogi = fip_flogi ( descs );
825 DBGC ( fcoe,
"FCoE %s received ELS response missing FLOGI\n",
829 if ( ! mac_address ) {
830 DBGC ( fcoe,
"FCoE %s received ELS response missing MAC " 837 DBGC ( fcoe,
"FCoE %s using local MAC %s\n",
844 frame_len ) ) != 0 ) {
845 DBGC ( fcoe,
"FCoE %s could not deliver FIP FLOGI frame: %s\n",
874 keepalive =
iob_put ( iobuf,
sizeof ( *keepalive ) );
875 memset ( keepalive, 0,
sizeof ( *keepalive ) );
879 keepalive->hdr.len =
htons ( (
sizeof ( *keepalive ) -
880 sizeof ( keepalive->hdr ) ) / 4 );
882 keepalive->mac_address.len =
883 (
sizeof ( keepalive->mac_address ) / 4 );
885 sizeof ( keepalive->mac_address.mac ) );
891 DBGC ( fcoe,
"FCoE %s could not send keepalive: %s\n",
914 unsigned int flags );
951 DBG (
"FCoE received FIP frame for net device %s missing FCoE " 963 DBGC2 ( fcoe,
"FCoE %s ignoring FIP packet for %s\n",
980 rc = handler->
rx ( fcoe, &descs,
985 DBGC ( fcoe,
"FCoE %s received unsupported FIP code %04x.%02x\n",
1049 DBGC ( fcoe,
"FCoE %s giving up on VLAN discovery\n",
1070 DBGC ( fcoe,
"FCoE %s could not create FC port: %s\n",
1102 DBGC ( fcoe,
"FCoE %s abandoning FCF %s\n",
1123 DBG (
"FCoE skipping non-Ethernet device %s\n",
netdev->
name );
1125 goto err_non_ethernet;
1129 fcoe =
zalloc (
sizeof ( *fcoe ) );
1171 DBG (
"FCoE notification for net device %s missing FCoE " 1194 DBG (
"FCoE removal of net device %s missing FCoE port\n",
#define iob_pull(iobuf, len)
struct list_head list
List of FCoE ports.
#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)
#define list_add(new, head)
Add a new entry to the head of a list.
A FIP priority descriptor.
struct net_device * netdev
Network device.
#define ref_init(refcnt, free)
Initialise a reference counter.
struct golan_inbox_hdr hdr
Message header.
uint8_t len
Length in 32-bit words.
#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 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_close(struct fcoe_port *fcoe, int rc)
Close FCoE port.
const char * fc_ntoa(const struct fc_name *wwn)
Format Fibre Channel WWN.
struct fip_common common
Common fields.
#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.
static struct fcoe_port * fcoe_demux(struct net_device *netdev)
Identify FCoE port by network device.
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.
A doubly-linked list entry (or list head)
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.
#define list_del(list)
Delete an entry from a list.
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.
static void fcoe_remove(struct net_device *netdev)
Destroy FCoE port.
struct refcnt refcnt
Reference count.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
#define container_of(ptr, type, field)
Get containing structure.
static uint8_t all_fcf_macs[ETH_ALEN]
FCoE All-FCF-MACs address.
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
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.
static void fcoe_notify(struct net_device *netdev)
Handle FCoE port device or link state change.
An object interface descriptor.
#define iob_unput(iobuf, len)
char * strerror(int errno)
Retrieve string representation of error number.
uint8_t len
Length in 32-bit words.
void * zalloc(size_t size)
Allocate cleared memory.
static int fcoe_probe(struct net_device *netdev)
Create FCoE port.
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 struct net_device * netdev_get(struct net_device *netdev)
Get reference to network device.
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.
#define __unused
Declare a variable or data structure as unused.
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)
#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.
struct fcoe_name::@534 fcoe
FCoE name.
static LIST_HEAD(fcoe_ports)
List of FCoE ports.
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 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.
#define ref_put(refcnt)
Drop reference to object.
void * memset(void *dest, int character, size_t len) __nonnull
FEATURE(FEATURE_PROTOCOL, "FCoE", DHCP_EB_FEATURE_FCOE, 1)