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 NULL
NULL pointer (VOID *)
struct golan_inbox_hdr hdr
Message header.
typeof(acpi_finder=acpi_find)
ACPI table finder.
struct arbelprm_rc_send_wqe rc
#define assert(condition)
Assert a condition at run-time.
struct bofm_section_header done
u32 crc32_le(u32 seed, const void *data, size_t len)
Calculate 32-bit little-endian CRC checksum.
struct device * identify_device(struct interface *intf)
Identify a device behind an interface.
uint64_t tag
Identity tag.
uint8_t meta
Metadata flags.
struct ena_llq_option desc
Descriptor counts.
#define __einfo_errortab(einfo)
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
const char * fc_ntoa(const struct fc_name *wwn)
Format Fibre Channel WWN.
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.
@ FC_R_CTL_ELS
Extended Link Services.
@ FC_R_CTL_UNSOL_CTRL
Unsolicited Control.
@ FC_F_CTL_ES_END
Last Data Frame of Sequence.
@ FC_ELS_FLOGI
Fabric Login.
static uint8_t all_fcf_macs[ETH_ALEN]
FCoE All-FCF-MACs address.
static size_t fcoe_window(struct fcoe_port *fcoe)
Check FCoE flow control window.
static void fcoe_reset(struct fcoe_port *fcoe)
Reset FCoE port.
static struct io_buffer * fcoe_alloc_iob(struct fcoe_port *fcoe __unused, size_t len)
Allocate FCoE I/O buffer.
static uint8_t default_fcf_mac[ETH_ALEN]
Default FCoE forwarded MAC address.
static int fcoe_fip_rx_advertisement(struct fcoe_port *fcoe, struct fip_descriptors *descs, unsigned int flags)
Handle received FIP discovery advertisement.
#define EINVAL_UNDERLENGTH
static void fcoe_remove(struct net_device *netdev __unused, void *priv)
Destroy FCoE port.
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.
static int fcoe_fip_tx_vlan(struct fcoe_port *fcoe)
Send FIP VLAN request.
static uint8_t all_fcoe_macs[ETH_ALEN]
FCoE All-FCoE-MACs address.
static struct interface_operation fcoe_transport_op[]
FCoE transport interface operations.
static uint8_t all_enode_macs[ETH_ALEN]
FCoE All-ENode-MACs address.
#define FCOE_MAX_FIP_SOLICITATIONS
Maximum number of FIP solicitations before giving up on FIP.
static int fcoe_probe(struct net_device *netdev, void *priv)
Create FCoE port.
#define FCOE_MAX_VLAN_REQUESTS
Maximum number of VLAN requests before giving up on VLAN discovery.
static void fcoe_notify(struct net_device *netdev, void *priv)
Handle FCoE port device or link state change.
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.
static int fcoe_fip_tx_solicitation(struct fcoe_port *fcoe)
Send FIP discovery solicitation.
static int fcoe_fip_rx_els_response(struct fcoe_port *fcoe, struct fip_descriptors *descs, unsigned int flags __unused)
Handle received FIP ELS response.
#define FCOE_FIP_RETRY_DELAY
Delay between retrying FIP solicitations.
static int fcoe_fip_tx_keepalive(struct fcoe_port *fcoe)
Send FIP keepalive.
static int fcoe_fip_rx_vlan(struct fcoe_port *fcoe, struct fip_descriptors *descs, unsigned int flags __unused)
Handle received FIP VLAN notification.
static void fcoe_close(struct fcoe_port *fcoe, int rc)
Close FCoE port.
#define FCOE_VLAN_POLL_DELAY
Delay between retrying polling VLAN requests.
static int fcoe_deliver(struct fcoe_port *fcoe, struct io_buffer *iobuf, struct xfer_metadata *meta __unused)
Transmit FCoE packet.
static struct fip_handler fip_handlers[]
FIP handlers.
static struct interface_descriptor fcoe_transport_desc
FCoE transport interface descriptor.
#define FCOE_VLAN_RETRY_DELAY
Delay between retrying VLAN requests.
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.
static struct device * fcoe_identify_device(struct fcoe_port *fcoe)
Identify device underlying FCoE port.
static void fcoe_expired(struct retry_timer *timer, int over __unused)
Handle FCoE timer expiry.
@ FCOE_VLAN_TIMED_OUT
VLAN discovery has timed out.
@ FCOE_VLAN_FOUND
An alternative VLAN has been found.
@ FCOE_FCF_ALLOWS_SPMA
FCoE forwarder supports server-provided MAC addresses.
@ FCOE_HAVE_FIP_FCF
We have a FIP-capable FCoE forwarder available to be used.
@ FCOE_HAVE_NETWORK
Underlying network device is available.
@ FCOE_HAVE_FCF
We have selected an FCoE forwarder to use.
#define FCOE_MAX_FIP_MISSING_KEEPALIVES
Maximum number of missing discovery advertisements.
Fibre Channel over Ethernet.
@ FCOE_EOF_T
End of Frame Terminate.
@ FCOE_EOF_N
End of Frame Normal.
#define FCOE_VLAN_PRIORITY
FCoE VLAN priority.
@ FCOE_SOF_I3
Start of Frame Initiate Class 3.
@ FCOE_SOF_N3
Start of Frame Normal Class 3.
#define FCOE_FRAME_VER
FCoE frame version.
#define FCOE_AUTHORITY_IEEE_EXTENDED
IEEE extended.
#define FCOE_AUTHORITY_IEEE
IEEE 48-bit address.
@ FIP_MAINTAIN_KEEP_ALIVE
Keep alive.
@ FIP_CODE_ELS
Extended link services.
@ FIP_CODE_DISCOVERY
Discovery.
@ FIP_CODE_MAINTAIN
Maintain virtual links.
#define FIP_LOWEST_PRIORITY
Lowest FIP priority.
@ FIP_ELS_REQUEST
ELS request.
@ FIP_ELS_RESPONSE
ELS response.
@ FIP_SP
Server-provided MAC address.
@ FIP_FP
Fabric-provided MAC address.
@ FIP_A
Available for login.
#define FIP_IS_CRITICAL(type)
FIP descriptor type is critical.
@ FIP_VLAN_REQUEST
VLAN request.
@ FIP_VLAN_NOTIFY
VLAN notification.
@ FIP_NO_KEEPALIVE
Do not send keepalives.
#define FIP_VERSION
FIP frame version.
@ FIP_MAX_FCOE_SIZE
Max FCoE size.
@ FIP_MAC_ADDRESS
MAC address.
@ FIP_NUM_DESCRIPTOR_TYPES
@ FIP_NAME_ID
Name identifier.
@ FIP_DISCOVERY_SOLICIT
Discovery solicitation.
@ FIP_DISCOVERY_ADVERTISE
Discovery advertisement.
static struct net_device * netdev
#define __unused
Declare a variable or data structure as unused.
#define DBG(...)
Print a debugging message.
#define DHCP_EB_FEATURE_FCOE
FCoE protocol.
#define FEATURE_PROTOCOL
Network protocols.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define EINVAL
Invalid argument.
#define ENOMEM
Not enough space.
#define ENOTSUP
Operation not supported.
#define ECANCELED
Operation canceled.
#define EPROTONOSUPPORT
Protocol not supported.
#define ENOTCONN
The socket is not connected.
u16 fc
802.11 Frame Control field
u8 request[0]
List of IEs requested.
Address Resolution Protocol constants and types.
#define ARPHRD_ETHER
Ethernet 10Mbps.
#define le32_to_cpu(value)
#define cpu_to_le32(value)
#define TICKS_PER_MS
Number of ticks per millisecond.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
void * memset(void *dest, int character, size_t len) __nonnull
void intf_close(struct interface *intf, int rc)
Close an object interface.
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
void intf_restart(struct interface *intf, int rc)
Shut down and restart an object interface.
#define INTF_DESC(object_type, intf, operations)
Define an object interface descriptor.
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
#define iob_push(iobuf, len)
#define iob_put(iobuf, len)
#define iob_disown(iobuf)
Disown an I/O buffer.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
#define iob_reserve(iobuf, len)
#define iob_pull(iobuf, len)
#define iob_unput(iobuf, len)
#define FEATURE(category, text, feature_opt, version)
Declare a feature.
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.
void * netdev_priv(struct net_device *netdev, struct net_driver *driver)
Get network device driver private data.
Network device management.
static int netdev_is_open(struct net_device *netdev)
Check whether or not network device is open.
static int netdev_link_ok(struct net_device *netdev)
Check link state of network device.
#define __net_driver
Declare a network driver.
#define MAX_LL_HEADER_LEN
Maximum length of a link-layer header.
#define __net_protocol
Declare a network-layer protocol.
void start_timer_fixed(struct retry_timer *timer, unsigned long timeout)
Start timer with a specified timeout.
void stop_timer(struct retry_timer *timer)
Stop timer.
static void start_timer_nodelay(struct retry_timer *timer)
Start timer with no delay.
#define offsetof(type, field)
Get offset of a field within a structure.
#define container_of(ptr, type, field)
Get containing structure.
uint16_t priority
Priotity.
char * strerror(int errno)
Retrieve string representation of error number.
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
Fibre Channel ELS frame common parameters.
uint8_t command
ELS command code.
union fcoe_name node_wwn
Node WWN.
struct retry_timer timer
FIP retransmission timer.
unsigned int keepalive
Keepalive delay (in ms)
uint8_t fcf_mac[ETH_ALEN]
FCoE forwarder MAC address.
struct net_device * netdev
Network device.
unsigned int timeouts
FIP timeout counter.
union fcoe_name port_wwn
Port WWN.
uint8_t local_mac[ETH_ALEN]
Local MAC address.
unsigned int priority
FCoE forwarder priority.
struct interface transport
Transport interface.
union fip_descriptor * desc[FIP_NUM_DESCRIPTOR_TYPES]
Descriptors, indexed by type.
A FIP descriptor containing an encapsulated ELS frame.
struct fc_frame_header fc
Fibre Channel frame header.
uint8_t len
Length in 32-bit words.
A FIP FKA ADV period descriptor.
uint32_t period
Keep alive advertisement period in milliseconds.
uint8_t subcode
Protocol subcode.
int(* rx)(struct fcoe_port *fcoe, struct fip_descriptors *descs, unsigned int flags)
Receive FIP packet.
uint16_t code
Protocol code.
A FIP descriptor containing an encapsulated login frame.
uint8_t len
Length in 32-bit words.
A FIP MAC address descriptor.
uint8_t mac[ETH_ALEN]
MAC address.
uint8_t len
Length in 32-bit words.
A FIP max FCoE size descriptor.
A FIP name identifier descriptor.
A FIP priority descriptor.
An object interface descriptor.
An object interface operation.
void * data
Start of data.
uint16_t ll_proto
Link-layer protocol.
char name[NETDEV_NAME_LEN]
Name of this network device.
struct device * dev
Underlying hardware device.
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
A network upper-layer driver.
A network-layer protocol.
static struct tlan_private * priv
uint8_t mac[ETH_ALEN]
MAC address.
struct fc_name fc
Fibre Channel name.
struct fcoe_name::@146233060014345030116354157144043320206274366016 fcoe
FCoE name.
uint16_t authority
Naming authority.
int vlan_can_be_trunk(struct net_device *trunk)
Check if network device can be used as a VLAN trunk device.
int vlan_create(struct net_device *trunk, unsigned int tag, unsigned int priority)
Create VLAN device.
size_t xfer_window(struct interface *intf)
Check flow control window.
int xfer_deliver(struct interface *intf, struct io_buffer *iobuf, struct xfer_metadata *meta)
Deliver datagram.
struct io_buffer * xfer_alloc_iob(struct interface *intf, size_t len)
Allocate I/O buffer.
void xfer_window_changed(struct interface *intf)
Report change of flow control window.
int xfer_deliver_iob(struct interface *intf, struct io_buffer *iobuf)
Deliver datagram as I/O buffer without metadata.
int xfer_deliver_raw(struct interface *intf, const void *data, size_t len)
Deliver datagram as raw data without metadata.
Data transfer interfaces.