summaryrefslogtreecommitdiffstats
path: root/src/net/vlan.c
diff options
context:
space:
mode:
authorStefan Hajnoczi2013-03-01 16:32:15 +0100
committerMichael Brown2013-03-01 17:11:40 +0100
commit7426177d631c0fd8b2ef3ffae4449637d5bca32a (patch)
tree5d1fd4375b0b51ebcf4278be7974ad2268ba6748 /src/net/vlan.c
parent[efi] Ensure EFI binaries comply with Authenticode requirements (diff)
downloadipxe-7426177d631c0fd8b2ef3ffae4449637d5bca32a.tar.gz
ipxe-7426177d631c0fd8b2ef3ffae4449637d5bca32a.tar.xz
ipxe-7426177d631c0fd8b2ef3ffae4449637d5bca32a.zip
[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>
Diffstat (limited to 'src/net/vlan.c')
-rw-r--r--src/net/vlan.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/net/vlan.c b/src/net/vlan.c
index f7281f5d..1a2a0862 100644
--- a/src/net/vlan.c
+++ b/src/net/vlan.c
@@ -283,6 +283,23 @@ struct net_protocol vlan_protocol __net_protocol = {
};
/**
+ * Get the VLAN tag
+ *
+ * @v netdev Network device
+ * @ret tag VLAN tag, or 0 if device is not a VLAN device
+ */
+unsigned int vlan_tag ( struct net_device *netdev ) {
+ struct vlan_device *vlan;
+
+ if ( netdev->op == &vlan_operations ) {
+ vlan = netdev->priv;
+ return vlan->tag;
+ } else {
+ return 0;
+ }
+}
+
+/**
* Check if network device can be used as a VLAN trunk device
*
* @v trunk Trunk network device