summaryrefslogtreecommitdiffstats
path: root/src/drivers
diff options
context:
space:
mode:
authorMichael Brown2019-04-27 21:12:01 +0200
committerMichael Brown2019-04-27 21:25:00 +0200
commitfe680c8228563369804948010954128aacb7db74 (patch)
tree65e6035ee970a69550bb44ee2e07d47c1c85d314 /src/drivers
parent[pci] Add support for PCI MSI-X interrupts (diff)
downloadipxe-fe680c8228563369804948010954128aacb7db74.tar.gz
ipxe-fe680c8228563369804948010954128aacb7db74.tar.xz
ipxe-fe680c8228563369804948010954128aacb7db74.zip
[vlan] Provide vlan_netdev_rx() and vlan_netdev_rx_err()
The Hermon driver uses vlan_find() to identify the appropriate VLAN device for packets that are received with the VLAN tag already stripped out by the hardware. Generalise this capability and expose it for use by other network card drivers. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/infiniband/hermon.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/drivers/infiniband/hermon.c b/src/drivers/infiniband/hermon.c
index a1d2a3bd5..9675c156b 100644
--- a/src/drivers/infiniband/hermon.c
+++ b/src/drivers/infiniband/hermon.c
@@ -3207,22 +3207,16 @@ static void hermon_eth_complete_recv ( struct ib_device *ibdev __unused,
struct ib_address_vector *source,
struct io_buffer *iobuf, int rc ) {
struct net_device *netdev = ib_qp_get_ownerdata ( qp );
- struct net_device *vlan;
-
- /* Find VLAN device, if applicable */
- if ( source->vlan_present ) {
- if ( ( vlan = vlan_find ( netdev, source->vlan ) ) != NULL ) {
- netdev = vlan;
- } else if ( rc == 0 ) {
- rc = -ENODEV;
- }
- }
+ unsigned int tag;
+
+ /* Identify VLAN tag, if applicable */
+ tag = ( source->vlan_present ? source->vlan : 0 );
/* Hand off to network layer */
if ( rc == 0 ) {
- netdev_rx ( netdev, iobuf );
+ vlan_netdev_rx ( netdev, tag, iobuf );
} else {
- netdev_rx_err ( netdev, iobuf, rc );
+ vlan_netdev_rx_err ( netdev, tag, iobuf, rc );
}
}