diff options
author | Michael Brown <mcb30@ipxe.org> | 2016-03-08 10:06:24 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2016-03-08 12:23:30 +0000 |
commit | ffdf8ea7573a8bb45bb24c9685a5cda2b21e0176 (patch) | |
tree | a2bf0dee20addbcf6d18db6b3de64d54466ea3ef /src/drivers | |
parent | 14ad9cbd6713daa10e473f6dfffad4d5373beadf (diff) | |
download | ipxe-ffdf8ea7573a8bb45bb24c9685a5cda2b21e0176.zip ipxe-ffdf8ea7573a8bb45bb24c9685a5cda2b21e0176.tar.gz ipxe-ffdf8ea7573a8bb45bb24c9685a5cda2b21e0176.tar.bz2 |
[ipoib] Avoid unnecessary path record lookup for broadcast address
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers')
-rw-r--r-- | src/drivers/net/ipoib.c | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/src/drivers/net/ipoib.c b/src/drivers/net/ipoib.c index 8bad2b2..d8c4efa 100644 --- a/src/drivers/net/ipoib.c +++ b/src/drivers/net/ipoib.c @@ -503,8 +503,10 @@ static int ipoib_transmit ( struct net_device *netdev, struct ethhdr *ethhdr; struct iphdr *iphdr; struct ipoib_hdr *ipoib_hdr; + struct ipoib_remac *remac; struct ipoib_mac *mac; - struct ib_address_vector dest; + struct ib_address_vector *dest; + struct ib_address_vector av; uint16_t net_proto; int rc; @@ -522,12 +524,32 @@ static int ipoib_transmit ( struct net_device *netdev, /* Strip eIPoIB header */ ethhdr = iobuf->data; + remac = ( ( struct ipoib_remac * ) ethhdr->h_dest ); net_proto = ethhdr->h_protocol; iob_pull ( iobuf, sizeof ( *ethhdr ) ); /* Identify destination address */ - mac = ipoib_find_remac ( ipoib, ( ( void * ) ethhdr->h_dest ) ); - if ( ! mac ) { + if ( is_multicast_ether_addr ( remac ) ) { + + /* Transmit multicasts as broadcasts, for simplicity */ + dest = &ipoib->broadcast.av; + + } else if ( ( mac = ipoib_find_remac ( ipoib, remac ) ) ) { + + /* Construct address vector from IPoIB MAC */ + dest = &av; + memset ( dest, 0, sizeof ( *dest ) ); + dest->qpn = ( ntohl ( mac->flags__qpn ) & IB_QPN_MASK ); + dest->qkey = ipoib->broadcast.av.qkey; + dest->gid_present = 1; + memcpy ( &dest->gid, &mac->gid, sizeof ( dest->gid ) ); + if ( ( rc = ib_resolve_path ( ibdev, dest ) ) != 0 ) { + /* Path not resolved yet */ + return rc; + } + + } else { + /* Generate a new ARP request (if possible) to trigger * population of the REMAC cache entry. */ @@ -564,18 +586,8 @@ static int ipoib_transmit ( struct net_device *netdev, ipoib_hdr->proto = net_proto; ipoib_hdr->reserved = 0; - /* Construct address vector */ - memset ( &dest, 0, sizeof ( dest ) ); - dest.qpn = ( ntohl ( mac->flags__qpn ) & IB_QPN_MASK ); - dest.qkey = ipoib->broadcast.av.qkey; - dest.gid_present = 1; - memcpy ( &dest.gid, &mac->gid, sizeof ( dest.gid ) ); - if ( ( rc = ib_resolve_path ( ibdev, &dest ) ) != 0 ) { - /* Path not resolved yet */ - return rc; - } - - return ib_post_send ( ibdev, ipoib->qp, &dest, iobuf ); + /* Transmit packet */ + return ib_post_send ( ibdev, ipoib->qp, dest, iobuf ); } /** |