Skip to content

Commit 9fc95fe

Browse files
Radu Buliedavem330
authored andcommitted
net: fec: correct queue selection
The old implementation extracted VLAN TCI info from the payload before the VLAN tag has been pushed in the payload. Another problem was that the VLAN TCI was extracted even if the packet did not have VLAN protocol header. This resulted in invalid VLAN TCI and as a consequence a random queue was computed. This patch fixes the above issues and use the VLAN TCI from the skb if it is present or VLAN TCI from payload if present. If no VLAN header is present queue 0 is selected. Fixes: 52c4a1a ("net: fec: add ndo_select_queue to fix TX bandwidth fluctuations") Signed-off-by: Radu Bulie <[email protected]> Signed-off-by: Wei Fang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 69db702 commit 9fc95fe

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

drivers/net/ethernet/freescale/fec_main.c

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3731,31 +3731,26 @@ static int fec_set_features(struct net_device *netdev,
37313731
return 0;
37323732
}
37333733

3734-
static u16 fec_enet_get_raw_vlan_tci(struct sk_buff *skb)
3735-
{
3736-
struct vlan_ethhdr *vhdr;
3737-
unsigned short vlan_TCI = 0;
3738-
3739-
if (skb->protocol == htons(ETH_P_ALL)) {
3740-
vhdr = (struct vlan_ethhdr *)(skb->data);
3741-
vlan_TCI = ntohs(vhdr->h_vlan_TCI);
3742-
}
3743-
3744-
return vlan_TCI;
3745-
}
3746-
37473734
static u16 fec_enet_select_queue(struct net_device *ndev, struct sk_buff *skb,
37483735
struct net_device *sb_dev)
37493736
{
37503737
struct fec_enet_private *fep = netdev_priv(ndev);
3751-
u16 vlan_tag;
3738+
u16 vlan_tag = 0;
37523739

37533740
if (!(fep->quirks & FEC_QUIRK_HAS_AVB))
37543741
return netdev_pick_tx(ndev, skb, NULL);
37553742

3756-
vlan_tag = fec_enet_get_raw_vlan_tci(skb);
3757-
if (!vlan_tag)
3743+
/* VLAN is present in the payload.*/
3744+
if (eth_type_vlan(skb->protocol)) {
3745+
struct vlan_ethhdr *vhdr = skb_vlan_eth_hdr(skb);
3746+
3747+
vlan_tag = ntohs(vhdr->h_vlan_TCI);
3748+
/* VLAN is present in the skb but not yet pushed in the payload.*/
3749+
} else if (skb_vlan_tag_present(skb)) {
3750+
vlan_tag = skb->vlan_tci;
3751+
} else {
37583752
return vlan_tag;
3753+
}
37593754

37603755
return fec_enet_vlan_pri_to_queue[vlan_tag >> 13];
37613756
}

0 commit comments

Comments
 (0)