mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 12:10:52 -04:00
vlan: allow null VLAN ID to be used
We currently use a 16 bit field (vlan_tci) to store VLAN ID/PRIO on a skb. Null value is used as a special value, meaning vlan tagging not enabled. This forbids use of null vlan ID. As pointed by David, some drivers use the 3 high order bits (PRIO) As VLAN ID is 12 bits, we can use the remaining bit (CFI) as a flag, and allow null VLAN ID. In case future code really wants to use VLAN_CFI_MASK, we'll have to use a bit outside of vlan_tci. #define VLAN_PRIO_MASK 0xe000 /* Priority Code Point */ #define VLAN_PRIO_SHIFT 13 #define VLAN_CFI_MASK 0x1000 /* Canonical Format Indicator */ #define VLAN_TAG_PRESENT VLAN_CFI_MASK #define VLAN_VID_MASK 0x0fff /* VLAN Identifier */ Reported-by: Gertjan Hofman <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
9dbb58d867
commit
05423b2413
5 changed files with 15 additions and 10 deletions
|
|
@ -89,7 +89,7 @@ static inline u32 vlan_get_ingress_priority(struct net_device *dev,
|
|||
{
|
||||
struct vlan_dev_info *vip = vlan_dev_info(dev);
|
||||
|
||||
return vip->ingress_priority_map[(vlan_tci >> 13) & 0x7];
|
||||
return vip->ingress_priority_map[(vlan_tci >> VLAN_PRIO_SHIFT) & 0x7];
|
||||
}
|
||||
|
||||
#ifdef CONFIG_VLAN_8021Q_GVRP
|
||||
|
|
|
|||
|
|
@ -393,7 +393,7 @@ int vlan_dev_set_egress_priority(const struct net_device *dev,
|
|||
struct vlan_dev_info *vlan = vlan_dev_info(dev);
|
||||
struct vlan_priority_tci_mapping *mp = NULL;
|
||||
struct vlan_priority_tci_mapping *np;
|
||||
u32 vlan_qos = (vlan_prio << 13) & 0xE000;
|
||||
u32 vlan_qos = (vlan_prio << VLAN_PRIO_SHIFT) & VLAN_PRIO_MASK;
|
||||
|
||||
/* See if a priority mapping exists.. */
|
||||
mp = vlan->egress_priority_map[skb_prio & 0xF];
|
||||
|
|
|
|||
Loading…
Reference in a new issue