Skip to content

Commit

Permalink
[netdevice] Separate VLAN support from presence of VLAN-supporting dr…
Browse files Browse the repository at this point in the history
…ivers

Some NICs (e.g. Hermon) provide hardware support for stripping the
VLAN tag, but do not provide any way for this support to be disabled.
Drivers for this hardware must therefore call vlan_find() to identify
a suitable receiving network device.

Provide a weak version of vlan_find() which will always return NULL if
VLAN support has not been enabled (either directly, or by enabling
a feature such as FCoE which requires VLAN support).  This allows the
VLAN code to be omitted from builds where the user has not requested
support for VLANs.

Inspired-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Mar 1, 2013
1 parent 7d64abb commit 77f64b1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/net/netdevice.c
Expand Up @@ -794,5 +794,17 @@ __weak unsigned int vlan_tag ( struct net_device *netdev __unused ) {
return 0;
}

/**
* Identify VLAN device (when VLAN support is not present)
*
* @v trunk Trunk network device
* @v tag VLAN tag
* @ret netdev VLAN device, if any
*/
__weak struct net_device * vlan_find ( struct net_device *trunk __unused,
unsigned int tag __unused ) {
return NULL;
}

/** Networking stack process */
PERMANENT_PROCESS ( net_process, net_step );

0 comments on commit 77f64b1

Please sign in to comment.