]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[vlan] Allow external code to identify VLAN priority as well as tag
authorMichael Brown <mcb30@ipxe.org>
Fri, 9 Dec 2022 14:40:54 +0000 (14:40 +0000)
committerMichael Brown <mcb30@ipxe.org>
Wed, 14 Dec 2022 11:05:37 +0000 (11:05 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/include/ipxe/vlan.h
src/net/netdevice.c
src/net/vlan.c

index 7f93439b364e4d0a4e5352e0537138d9b172ca41..e4baf4cf07569035d7ec5a437256876769e678a5 100644 (file)
@@ -61,7 +61,19 @@ struct vlan_header {
  */
 #define VLAN_PRIORITY_IS_VALID( priority ) ( (priority) <= 7 )
 
-extern unsigned int vlan_tag ( struct net_device *netdev );
+extern unsigned int vlan_tci ( struct net_device *netdev );
+
+/**
+ * Get the VLAN tag
+ *
+ * @v netdev           Network device
+ * @ret tag            VLAN tag, or 0 if device is not a VLAN device
+ */
+static inline __attribute__ (( always_inline )) unsigned int
+vlan_tag ( struct net_device *netdev ) {
+       return VLAN_TAG ( vlan_tci ( 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 );
index 5df306e8d69efead21b00c2d4517452421be4655..51d1831cc48590ca6d5bde18812574602170d0b1 100644 (file)
@@ -1171,12 +1171,12 @@ static void net_step ( struct process *process __unused ) {
 }
 
 /**
- * Get the VLAN tag (when VLAN support is not present)
+ * Get the VLAN tag control information (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 ) {
+__weak unsigned int vlan_tci ( struct net_device *netdev __unused ) {
        return 0;
 }
 
index 90f2934dec9f144a850fcf33b0fc2b8dd3dfbd15..fe4488614063cc9121bee82ed9862c9d04cc4d8f 100644 (file)
@@ -288,17 +288,17 @@ struct net_protocol vlan_protocol __net_protocol = {
 };
 
 /**
- * Get the VLAN tag
+ * Get the VLAN tag control information
  *
  * @v netdev           Network device
- * @ret tag            VLAN tag, or 0 if device is not a VLAN device
+ * @ret tci            VLAN tag control information, or 0 if not a VLAN device
  */
-unsigned int vlan_tag ( struct net_device *netdev ) {
+unsigned int vlan_tci ( struct net_device *netdev ) {
        struct vlan_device *vlan;
 
        if ( netdev->op == &vlan_operations ) {
                vlan = netdev->priv;
-               return vlan->tag;
+               return ( VLAN_TCI ( vlan->tag, vlan->priority ) );
        } else {
                return 0;
        }