[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:
Michael Brown
2019-04-27 20:12:01 +01:00
parent afee77d816
commit fe680c8228
4 changed files with 84 additions and 21 deletions

View File

@@ -10,6 +10,8 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/netdevice.h>
/** A VLAN header */
struct vlan_header {
/** Tag control information */
@@ -59,12 +61,14 @@ struct vlan_header {
*/
#define VLAN_PRIORITY_IS_VALID( priority ) ( (priority) <= 7 )
extern struct net_device * vlan_find ( struct net_device *trunk,
unsigned int tag );
extern unsigned int vlan_tag ( struct net_device *netdev );
extern int vlan_can_be_trunk ( struct net_device *trunk );
extern int vlan_create ( struct net_device *trunk, unsigned int tag,
unsigned int priority );
extern int vlan_destroy ( struct net_device *netdev );
extern void vlan_netdev_rx ( struct net_device *netdev, unsigned int tag,
struct io_buffer *iobuf );
extern void vlan_netdev_rx_err ( struct net_device *netdev, unsigned int tag,
struct io_buffer *iobuf, int rc );
#endif /* _IPXE_VLAN_H */