summaryrefslogtreecommitdiffstats
path: root/src/net/fcoe.c
diff options
context:
space:
mode:
authorMichael Brown2010-10-15 00:56:28 +0200
committerMichael Brown2010-10-15 01:04:11 +0200
commita9c799250faacd79e482be72f9f5bb0f8d4847d3 (patch)
treef2ddcb04c4eec8457dd7d0b9b24a294a56e62f03 /src/net/fcoe.c
parent[build] Fix building elf2efi using binutils 2.20 (diff)
downloadipxe-a9c799250faacd79e482be72f9f5bb0f8d4847d3.tar.gz
ipxe-a9c799250faacd79e482be72f9f5bb0f8d4847d3.tar.xz
ipxe-a9c799250faacd79e482be72f9f5bb0f8d4847d3.zip
[fcoe] Request SPMA iff FIP advertisement indicates support for SPMA
We currently set both the FP and SP bits in our FIP FLOGI, to allow the FCF the choice of selecting either a fabric-provided or a server- provided MAC address. This complies with the FCoE specification, but has been observed to result in an FLOGI rejection from some FCFs. Fix by recording whether or not the FCF supports SPMA, and requesting only one of FPMA or SPMA in our FIP FLOGI. We choose to prefer SPMA where available, because many iPXE drivers will not be able to receive unicast packets sent to a non-default MAC address. Reported-by: Hadar Hen Zion <hadarh@mellanox.co.il> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/fcoe.c')
-rw-r--r--src/net/fcoe.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/net/fcoe.c b/src/net/fcoe.c
index f22f9f7b..47446799 100644
--- a/src/net/fcoe.c
+++ b/src/net/fcoe.c
@@ -101,6 +101,8 @@ enum fcoe_flags {
FCOE_HAVE_FCF = 0x0002,
/** We have a FIP-capable FCoE forwarder available to be used */
FCOE_HAVE_FIP_FCF = 0x0004,
+ /** FCoE forwarder supports server-provided MAC addresses */
+ FCOE_FCF_ALLOWS_SPMA = 0x0008,
};
struct net_protocol fcoe_protocol __net_protocol;
@@ -228,8 +230,10 @@ static int fcoe_deliver ( struct fcoe_port *fcoe,
memset ( fipmac, 0, sizeof ( *fipmac ) );
fipmac->type = FIP_MAC_ADDRESS;
fipmac->len = ( sizeof ( *fipmac ) / 4 );
- memcpy ( fipmac->mac, fcoe->netdev->ll_addr,
- sizeof ( fipmac->mac ) );
+ if ( fcoe->flags & FCOE_FCF_ALLOWS_SPMA ) {
+ memcpy ( fipmac->mac, fcoe->netdev->ll_addr,
+ sizeof ( fipmac->mac ) );
+ }
/* Create FIP header */
fiphdr = iob_push ( iobuf, sizeof ( *fiphdr ) );
@@ -239,7 +243,8 @@ static int fcoe_deliver ( struct fcoe_port *fcoe,
fiphdr->subcode = FIP_ELS_REQUEST;
fiphdr->len =
htons ( ( iob_len ( iobuf ) - sizeof ( *fiphdr ) ) / 4);
- fiphdr->flags = htons ( FIP_FP | FIP_SP );
+ fiphdr->flags = ( ( fcoe->flags & FCOE_FCF_ALLOWS_SPMA ) ?
+ htons ( FIP_SP ) : htons ( FIP_FP ) );
/* Send as FIP packet from netdev's own MAC address */
net_protocol = &fip_protocol;
@@ -636,17 +641,23 @@ static int fcoe_fip_rx_advertisement ( struct fcoe_port *fcoe,
} else {
fcoe->keepalive = ntohl ( fka_adv_p->period );
}
+ fcoe->flags &= ~FCOE_FCF_ALLOWS_SPMA;
+ if ( flags & FIP_SP )
+ fcoe->flags |= FCOE_FCF_ALLOWS_SPMA;
memcpy ( fcoe->fcf_mac, mac_address->mac,
sizeof ( fcoe->fcf_mac ) );
DBGC ( fcoe, "FCoE %s selected FCF %s (priority %d, ",
fcoe->netdev->name, eth_ntoa ( fcoe->fcf_mac ),
fcoe->priority );
if ( fcoe->keepalive ) {
- DBGC ( fcoe, "keepalive %dms)\n",
+ DBGC ( fcoe, "keepalive %dms",
fcoe->keepalive );
} else {
- DBGC ( fcoe, "no keepalive)\n" );
+ DBGC ( fcoe, "no keepalive" );
}
+ DBGC ( fcoe, ", %cPMA)\n",
+ ( ( fcoe->flags & FCOE_FCF_ALLOWS_SPMA ) ?
+ 'S' : 'F' ) );
}
} else if ( fcoe->flags & FCOE_HAVE_FIP_FCF ) {
@@ -704,6 +715,8 @@ static int fcoe_fip_rx_els_response ( struct fcoe_port *fcoe,
/* Record local MAC address */
memcpy ( fcoe->local_mac, mac_address->mac, sizeof ( fcoe->local_mac ));
+ DBGC ( fcoe, "FCoE %s using local MAC %s\n",
+ fcoe->netdev->name, eth_ntoa ( fcoe->local_mac ) );
/* Hand off via transport interface */
frame = &flogi->fc;