mirror of
https://github.com/ipxe/ipxe
synced 2026-01-02 18:03:36 +03:00
[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>
This commit is contained in:
@@ -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;
|
||||
unsigned int tag;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
/* 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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user