]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[ipoib] Resimplify test for received broadcast packets
authorMichael Brown <mcb30@ipxe.org>
Tue, 8 Mar 2016 17:02:24 +0000 (17:02 +0000)
committerMichael Brown <mcb30@ipxe.org>
Tue, 8 Mar 2016 17:43:26 +0000 (17:43 +0000)
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>
src/drivers/net/ipoib.c
src/include/ipxe/ib_packet.h

index b52ccb1947cf7649148e75974b0e908faea53104..4b85eda316a30a66b6fd005f1808495683b2c9a4 100644 (file)
@@ -671,8 +671,8 @@ static void ipoib_complete_recv ( struct ib_device *ibdev __unused,
        ethhdr->h_protocol = net_proto;
 
        /* Construct destination address */
-       if ( IB_LID_MULTICAST ( dest->lid ) ) {
-               /* Multicast LID; use the Ethernet broadcast address */
+       if ( dest->gid_present && IB_GID_MULTICAST ( &dest->gid ) ) {
+               /* Multicast GID: use the Ethernet broadcast address */
                memcpy ( &ethhdr->h_dest, eth_broadcast,
                         sizeof ( ethhdr->h_dest ) );
        } else {
index 2cea016bd4e5afd1dc5b3245a2baa7873546d1fd..747f9639998bf8a85e1dbb3319a6752501b92059 100644 (file)
@@ -48,6 +48,9 @@ union ib_gid {
 #define IB_GID_ARGS( gid ) \
        IB_GUID_ARGS ( &(gid)->s.prefix ), IB_GUID_ARGS ( &(gid)->s.guid )
 
+/** Test for multicast GID */
+#define IB_GID_MULTICAST( gid ) ( (gid)->bytes[0] == 0xff )
+
 /** An Infiniband Local Route Header */
 struct ib_local_route_header {
        /** Virtual lane and link version */