Browse Source

[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>
tags/v1.20.1
Michael Brown 14 years ago
parent
commit
a9c799250f
1 changed files with 18 additions and 5 deletions
  1. 18
    5
      src/net/fcoe.c

+ 18
- 5
src/net/fcoe.c View File

101
 	FCOE_HAVE_FCF = 0x0002,
101
 	FCOE_HAVE_FCF = 0x0002,
102
 	/** We have a FIP-capable FCoE forwarder available to be used */
102
 	/** We have a FIP-capable FCoE forwarder available to be used */
103
 	FCOE_HAVE_FIP_FCF = 0x0004,
103
 	FCOE_HAVE_FIP_FCF = 0x0004,
104
+	/** FCoE forwarder supports server-provided MAC addresses */
105
+	FCOE_FCF_ALLOWS_SPMA = 0x0008,
104
 };
106
 };
105
 
107
 
106
 struct net_protocol fcoe_protocol __net_protocol;
108
 struct net_protocol fcoe_protocol __net_protocol;
228
 		memset ( fipmac, 0, sizeof ( *fipmac ) );
230
 		memset ( fipmac, 0, sizeof ( *fipmac ) );
229
 		fipmac->type = FIP_MAC_ADDRESS;
231
 		fipmac->type = FIP_MAC_ADDRESS;
230
 		fipmac->len = ( sizeof ( *fipmac ) / 4 );
232
 		fipmac->len = ( sizeof ( *fipmac ) / 4 );
231
-		memcpy ( fipmac->mac, fcoe->netdev->ll_addr,
232
-			 sizeof ( fipmac->mac ) );
233
+		if ( fcoe->flags & FCOE_FCF_ALLOWS_SPMA ) {
234
+			memcpy ( fipmac->mac, fcoe->netdev->ll_addr,
235
+				 sizeof ( fipmac->mac ) );
236
+		}
233
 
237
 
234
 		/* Create FIP header */
238
 		/* Create FIP header */
235
 		fiphdr = iob_push ( iobuf, sizeof ( *fiphdr ) );
239
 		fiphdr = iob_push ( iobuf, sizeof ( *fiphdr ) );
239
 		fiphdr->subcode = FIP_ELS_REQUEST;
243
 		fiphdr->subcode = FIP_ELS_REQUEST;
240
 		fiphdr->len =
244
 		fiphdr->len =
241
 			htons ( ( iob_len ( iobuf ) - sizeof ( *fiphdr ) ) / 4);
245
 			htons ( ( iob_len ( iobuf ) - sizeof ( *fiphdr ) ) / 4);
242
-		fiphdr->flags = htons ( FIP_FP | FIP_SP );
246
+		fiphdr->flags = ( ( fcoe->flags & FCOE_FCF_ALLOWS_SPMA ) ?
247
+				  htons ( FIP_SP ) : htons ( FIP_FP ) );
243
 
248
 
244
 		/* Send as FIP packet from netdev's own MAC address */
249
 		/* Send as FIP packet from netdev's own MAC address */
245
 		net_protocol = &fip_protocol;
250
 		net_protocol = &fip_protocol;
636
 			} else {
641
 			} else {
637
 				fcoe->keepalive = ntohl ( fka_adv_p->period );
642
 				fcoe->keepalive = ntohl ( fka_adv_p->period );
638
 			}
643
 			}
644
+			fcoe->flags &= ~FCOE_FCF_ALLOWS_SPMA;
645
+			if ( flags & FIP_SP )
646
+				fcoe->flags |= FCOE_FCF_ALLOWS_SPMA;
639
 			memcpy ( fcoe->fcf_mac, mac_address->mac,
647
 			memcpy ( fcoe->fcf_mac, mac_address->mac,
640
 				 sizeof ( fcoe->fcf_mac ) );
648
 				 sizeof ( fcoe->fcf_mac ) );
641
 			DBGC ( fcoe, "FCoE %s selected FCF %s (priority %d, ",
649
 			DBGC ( fcoe, "FCoE %s selected FCF %s (priority %d, ",
642
 			       fcoe->netdev->name, eth_ntoa ( fcoe->fcf_mac ),
650
 			       fcoe->netdev->name, eth_ntoa ( fcoe->fcf_mac ),
643
 			       fcoe->priority );
651
 			       fcoe->priority );
644
 			if ( fcoe->keepalive ) {
652
 			if ( fcoe->keepalive ) {
645
-				DBGC ( fcoe, "keepalive %dms)\n",
653
+				DBGC ( fcoe, "keepalive %dms",
646
 				       fcoe->keepalive );
654
 				       fcoe->keepalive );
647
 			} else {
655
 			} else {
648
-				DBGC ( fcoe, "no keepalive)\n" );
656
+				DBGC ( fcoe, "no keepalive" );
649
 			}
657
 			}
658
+			DBGC ( fcoe, ", %cPMA)\n",
659
+			       ( ( fcoe->flags & FCOE_FCF_ALLOWS_SPMA ) ?
660
+				 'S' : 'F' ) );
650
 		}
661
 		}
651
 
662
 
652
 	} else if ( fcoe->flags & FCOE_HAVE_FIP_FCF ) {
663
 	} else if ( fcoe->flags & FCOE_HAVE_FIP_FCF ) {
704
 
715
 
705
 	/* Record local MAC address */
716
 	/* Record local MAC address */
706
 	memcpy ( fcoe->local_mac, mac_address->mac, sizeof ( fcoe->local_mac ));
717
 	memcpy ( fcoe->local_mac, mac_address->mac, sizeof ( fcoe->local_mac ));
718
+	DBGC ( fcoe, "FCoE %s using local MAC %s\n",
719
+	       fcoe->netdev->name, eth_ntoa ( fcoe->local_mac ) );
707
 
720
 
708
 	/* Hand off via transport interface */
721
 	/* Hand off via transport interface */
709
 	frame = &flogi->fc;
722
 	frame = &flogi->fc;

Loading…
Cancel
Save