Browse Source

[ipoib] Resimplify test for received broadcast packets

Commit e62e52b ("[ipoib] Simplify test for received broadcast
packets") relies upon the multicast LID being present in the
destination address vector as passed to ipoib_complete_recv().
Unfortunately, this information is not present in many Infiniband
devices' completion queue entries.

Fix by testing instead for the presence of a multicast GID.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 years ago
parent
commit
b5aa51ac62
2 changed files with 5 additions and 2 deletions
  1. 2
    2
      src/drivers/net/ipoib.c
  2. 3
    0
      src/include/ipxe/ib_packet.h

+ 2
- 2
src/drivers/net/ipoib.c View File

671
 	ethhdr->h_protocol = net_proto;
671
 	ethhdr->h_protocol = net_proto;
672
 
672
 
673
 	/* Construct destination address */
673
 	/* Construct destination address */
674
-	if ( IB_LID_MULTICAST ( dest->lid ) ) {
675
-		/* Multicast LID; use the Ethernet broadcast address */
674
+	if ( dest->gid_present && IB_GID_MULTICAST ( &dest->gid ) ) {
675
+		/* Multicast GID: use the Ethernet broadcast address */
676
 		memcpy ( &ethhdr->h_dest, eth_broadcast,
676
 		memcpy ( &ethhdr->h_dest, eth_broadcast,
677
 			 sizeof ( ethhdr->h_dest ) );
677
 			 sizeof ( ethhdr->h_dest ) );
678
 	} else {
678
 	} else {

+ 3
- 0
src/include/ipxe/ib_packet.h View File

48
 #define IB_GID_ARGS( gid ) \
48
 #define IB_GID_ARGS( gid ) \
49
 	IB_GUID_ARGS ( &(gid)->s.prefix ), IB_GUID_ARGS ( &(gid)->s.guid )
49
 	IB_GUID_ARGS ( &(gid)->s.prefix ), IB_GUID_ARGS ( &(gid)->s.guid )
50
 
50
 
51
+/** Test for multicast GID */
52
+#define IB_GID_MULTICAST( gid ) ( (gid)->bytes[0] == 0xff )
53
+
51
 /** An Infiniband Local Route Header */
54
 /** An Infiniband Local Route Header */
52
 struct ib_local_route_header {
55
 struct ib_local_route_header {
53
 	/** Virtual lane and link version */
56
 	/** Virtual lane and link version */

Loading…
Cancel
Save