[netdevice] Add vlan_tag() to get the VLAN tag of a network device

The iBFT has a VLAN field that should be filled in.  Add the
vlan_tag() function to extract the VLAN tag of a network device.

Since VLAN support is optional, define a weak function that returns 0
when iPXE is built without VLAN support.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Stefan Hajnoczi
2013-03-01 16:32:15 +01:00
committed by Michael Brown
parent 09c5109b85
commit 7426177d63
3 changed files with 29 additions and 0 deletions

View File

@@ -33,6 +33,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/init.h>
#include <ipxe/device.h>
#include <ipxe/errortab.h>
#include <ipxe/vlan.h>
#include <ipxe/netdevice.h>
/** @file
@@ -783,5 +784,15 @@ static void net_step ( struct process *process __unused ) {
net_poll();
}
/**
* Get the VLAN tag (when VLAN support is not present)
*
* @v netdev Network device
* @ret tag 0, indicating that device is not a VLAN device
*/
__weak unsigned int vlan_tag ( struct net_device *netdev __unused ) {
return 0;
}
/** Networking stack process */
PERMANENT_PROCESS ( net_process, net_step );