Skip to content

Commit

Permalink
vlan: Don't check for vlan group before vlan_tx_tag_present.
Browse files Browse the repository at this point in the history
Many (but not all) drivers check to see whether there is a vlan
group configured before using a tag stored in the skb.  There's
not much point in this check since it just throws away data that
should only be present in the expected circumstances.  However,
it will soon be legal and expected to get a vlan tag when no
vlan group is configured, so remove this check from all drivers
to avoid dropping the tags.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jesse Gross authored and David S. Miller committed Oct 21, 2010
1 parent b738127 commit eab6d18
Show file tree
Hide file tree
Showing 29 changed files with 38 additions and 43 deletions.
2 changes: 1 addition & 1 deletion drivers/net/8139cp.c
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb,
}

#if CP_VLAN_TAG_USED
if (cp->vlgrp && vlan_tx_tag_present(skb))
if (vlan_tx_tag_present(skb))
vlan_tag = TxVlanTag | swab16(vlan_tx_tag_get(skb));
#endif

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/amd8111e.c
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,7 @@ static netdev_tx_t amd8111e_start_xmit(struct sk_buff *skb,
lp->tx_ring[tx_index].tx_flags = 0;

#if AMD8111E_VLAN_TAG_USED
if((lp->vlgrp != NULL) && vlan_tx_tag_present(skb)){
if (vlan_tx_tag_present(skb)) {
lp->tx_ring[tx_index].tag_ctrl_cmd |=
cpu_to_le16(TCC_VLAN_INSERT);
lp->tx_ring[tx_index].tag_ctrl_info =
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/atl1c/atl1c_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2243,7 +2243,7 @@ static netdev_tx_t atl1c_xmit_frame(struct sk_buff *skb,
return NETDEV_TX_OK;
}

if (unlikely(adapter->vlgrp && vlan_tx_tag_present(skb))) {
if (unlikely(vlan_tx_tag_present(skb))) {
u16 vlan = vlan_tx_tag_get(skb);
__le16 tag;

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/atl1e/atl1e_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1814,7 +1814,7 @@ static netdev_tx_t atl1e_xmit_frame(struct sk_buff *skb,

tpd = atl1e_get_tpd(adapter);

if (unlikely(adapter->vlgrp && vlan_tx_tag_present(skb))) {
if (unlikely(vlan_tx_tag_present(skb))) {
u16 vlan_tag = vlan_tx_tag_get(skb);
u16 atl1e_vlan_tag;

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/atlx/atl1.c
Original file line number Diff line number Diff line change
Expand Up @@ -2408,7 +2408,7 @@ static netdev_tx_t atl1_xmit_frame(struct sk_buff *skb,
(u16) atomic_read(&tpd_ring->next_to_use));
memset(ptpd, 0, sizeof(struct tx_packet_desc));

if (adapter->vlgrp && vlan_tx_tag_present(skb)) {
if (vlan_tx_tag_present(skb)) {
vlan_tag = vlan_tx_tag_get(skb);
vlan_tag = (vlan_tag << 4) | (vlan_tag >> 13) |
((vlan_tag >> 9) & 0x8);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/atlx/atl2.c
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ static netdev_tx_t atl2_xmit_frame(struct sk_buff *skb,
offset = ((u32)(skb->len-copy_len + 3) & ~3);
}
#ifdef NETIF_F_HW_VLAN_TX
if (adapter->vlgrp && vlan_tx_tag_present(skb)) {
if (vlan_tx_tag_present(skb)) {
u16 vlan_tag = vlan_tx_tag_get(skb);
vlan_tag = (vlan_tag << 4) |
(vlan_tag >> 13) |
Expand Down
7 changes: 3 additions & 4 deletions drivers/net/benet/be_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ static inline void wrb_fill(struct be_eth_wrb *wrb, u64 addr, int len)
}

static void wrb_fill_hdr(struct be_eth_hdr_wrb *hdr, struct sk_buff *skb,
bool vlan, u32 wrb_cnt, u32 len)
u32 wrb_cnt, u32 len)
{
memset(hdr, 0, sizeof(*hdr));

Expand All @@ -449,7 +449,7 @@ static void wrb_fill_hdr(struct be_eth_hdr_wrb *hdr, struct sk_buff *skb,
AMAP_SET_BITS(struct amap_eth_hdr_wrb, udpcs, hdr, 1);
}

if (vlan && vlan_tx_tag_present(skb)) {
if (vlan_tx_tag_present(skb)) {
AMAP_SET_BITS(struct amap_eth_hdr_wrb, vlan, hdr, 1);
AMAP_SET_BITS(struct amap_eth_hdr_wrb, vlan_tag,
hdr, vlan_tx_tag_get(skb));
Expand Down Expand Up @@ -532,8 +532,7 @@ static int make_tx_wrbs(struct be_adapter *adapter,
queue_head_inc(txq);
}

wrb_fill_hdr(hdr, first_skb, adapter->vlan_grp ? true : false,
wrb_cnt, copied);
wrb_fill_hdr(hdr, first_skb, wrb_cnt, copied);
be_dws_cpu_to_le(hdr, sizeof(*hdr));

return copied;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/bna/bnad.c
Original file line number Diff line number Diff line change
Expand Up @@ -2501,7 +2501,7 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev)
htons((skb_is_gso(skb) ? BNA_TXQ_WI_SEND_LSO :
BNA_TXQ_WI_SEND));

if (bnad->vlan_grp && vlan_tx_tag_present(skb)) {
if (vlan_tx_tag_present(skb)) {
vlan_tag = (u16) vlan_tx_tag_get(skb);
flags |= (BNA_TXQ_WI_CF_INS_PRIO | BNA_TXQ_WI_CF_INS_VLAN);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/bnx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -6429,7 +6429,7 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
}

#ifdef BCM_VLAN
if (bp->vlgrp && vlan_tx_tag_present(skb)) {
if (vlan_tx_tag_present(skb)) {
vlan_tag_flags |=
(TX_BD_FLAGS_VLAN_TAG | (vlan_tx_tag_get(skb) << 16));
}
Expand Down
3 changes: 1 addition & 2 deletions drivers/net/bnx2x/bnx2x_cmn.c
Original file line number Diff line number Diff line change
Expand Up @@ -2026,8 +2026,7 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
pkt_prod, tx_buf, fp->tx_pkt_prod, bd_prod, tx_start_bd);

#ifdef BCM_VLAN
if ((bp->vlgrp != NULL) && vlan_tx_tag_present(skb) &&
(bp->flags & HW_VLAN_TX_FLAG)) {
if (vlan_tx_tag_present(skb)) {
tx_start_bd->vlan_or_ethertype =
cpu_to_le16(vlan_tx_tag_get(skb));
tx_start_bd->bd_flags.as_bitfield |=
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/chelsio/sge.c
Original file line number Diff line number Diff line change
Expand Up @@ -1870,7 +1870,7 @@ netdev_tx_t t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
cpl->iff = dev->if_port;

#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
if (adapter->vlan_grp && vlan_tx_tag_present(skb)) {
if (vlan_tx_tag_present(skb)) {
cpl->vlan_valid = 1;
cpl->vlan = htons(vlan_tx_tag_get(skb));
st->vlan_insert++;
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/cxgb3/sge.c
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb,
cpl->len = htonl(skb->len);
cntrl = V_TXPKT_INTF(pi->port_id);

if (vlan_tx_tag_present(skb) && pi->vlan_grp)
if (vlan_tx_tag_present(skb))
cntrl |= F_TXPKT_VLAN_VLD | V_TXPKT_VLAN(vlan_tx_tag_get(skb));

tso_info = V_LSO_MSS(skb_shinfo(skb)->gso_size);
Expand Down Expand Up @@ -1279,7 +1279,7 @@ netdev_tx_t t3_eth_xmit(struct sk_buff *skb, struct net_device *dev)
qs->port_stats[SGE_PSTAT_TX_CSUM]++;
if (skb_shinfo(skb)->gso_size)
qs->port_stats[SGE_PSTAT_TSO]++;
if (vlan_tx_tag_present(skb) && pi->vlan_grp)
if (vlan_tx_tag_present(skb))
qs->port_stats[SGE_PSTAT_VLANINS]++;

/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/e1000/e1000_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3119,7 +3119,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
}
}

if (unlikely(adapter->vlgrp && vlan_tx_tag_present(skb))) {
if (unlikely(vlan_tx_tag_present(skb))) {
tx_flags |= E1000_TX_FLAGS_VLAN;
tx_flags |= (vlan_tx_tag_get(skb) << E1000_TX_FLAGS_VLAN_SHIFT);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/e1000e/netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -4800,7 +4800,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
if (e1000_maybe_stop_tx(netdev, count + 2))
return NETDEV_TX_BUSY;

if (adapter->vlgrp && vlan_tx_tag_present(skb)) {
if (vlan_tx_tag_present(skb)) {
tx_flags |= E1000_TX_FLAGS_VLAN;
tx_flags |= (vlan_tx_tag_get(skb) << E1000_TX_FLAGS_VLAN_SHIFT);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ehea/ehea_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2272,7 +2272,7 @@ static int ehea_start_xmit(struct sk_buff *skb, struct net_device *dev)
}
pr->swqe_id_counter += 1;

if (port->vgrp && vlan_tx_tag_present(skb)) {
if (vlan_tx_tag_present(skb)) {
swqe->tx_control |= EHEA_SWQE_VLAN_INSERT;
swqe->vlan_tag = vlan_tx_tag_get(skb);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/enic/enic_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ static inline void enic_queue_wq_skb(struct enic *enic,
int vlan_tag_insert = 0;
int loopback = 0;

if (enic->vlan_group && vlan_tx_tag_present(skb)) {
if (vlan_tx_tag_present(skb)) {
/* VLAN tag from trunking driver */
vlan_tag_insert = 1;
vlan_tag = vlan_tx_tag_get(skb);
Expand Down
11 changes: 4 additions & 7 deletions drivers/net/forcedeth.c
Original file line number Diff line number Diff line change
Expand Up @@ -2321,14 +2321,11 @@ static netdev_tx_t nv_start_xmit_optimized(struct sk_buff *skb,
NV_TX2_CHECKSUM_L3 | NV_TX2_CHECKSUM_L4 : 0;

/* vlan tag */
if (likely(!np->vlangrp)) {
if (vlan_tx_tag_present(skb))
start_tx->txvlan = cpu_to_le32(NV_TX3_VLAN_TAG_PRESENT |
vlan_tx_tag_get(skb));
else
start_tx->txvlan = 0;
} else {
if (vlan_tx_tag_present(skb))
start_tx->txvlan = cpu_to_le32(NV_TX3_VLAN_TAG_PRESENT | vlan_tx_tag_get(skb));
else
start_tx->txvlan = 0;
}

spin_lock_irqsave(&np->lock, flags);

Expand Down
4 changes: 2 additions & 2 deletions drivers/net/gianfar.c
Original file line number Diff line number Diff line change
Expand Up @@ -2075,7 +2075,7 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)

/* make space for additional header when fcb is needed */
if (((skb->ip_summed == CHECKSUM_PARTIAL) ||
(priv->vlgrp && vlan_tx_tag_present(skb)) ||
vlan_tx_tag_present(skb) ||
unlikely(do_tstamp)) &&
(skb_headroom(skb) < GMAC_FCB_LEN)) {
struct sk_buff *skb_new;
Expand Down Expand Up @@ -2161,7 +2161,7 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
gfar_tx_checksum(skb, fcb);
}

if (priv->vlgrp && vlan_tx_tag_present(skb)) {
if (vlan_tx_tag_present(skb)) {
if (unlikely(NULL == fcb)) {
fcb = gfar_add_fcb(skb);
lstatus |= BD_LFLAG(TXBD_TOE);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/igb/igb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4128,7 +4128,7 @@ netdev_tx_t igb_xmit_frame_ring_adv(struct sk_buff *skb,
tx_flags |= IGB_TX_FLAGS_TSTAMP;
}

if (vlan_tx_tag_present(skb) && adapter->vlgrp) {
if (vlan_tx_tag_present(skb)) {
tx_flags |= IGB_TX_FLAGS_VLAN;
tx_flags |= (vlan_tx_tag_get(skb) << IGB_TX_FLAGS_VLAN_SHIFT);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ixgbe/ixgbe_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6311,7 +6311,7 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb, struct net_device *netdev
int count = 0;
unsigned int f;

if (adapter->vlgrp && vlan_tx_tag_present(skb)) {
if (vlan_tx_tag_present(skb)) {
tx_flags |= vlan_tx_tag_get(skb);
if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
tx_flags &= ~IXGBE_TX_FLAGS_VLAN_PRIO_MASK;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ixgbevf/ixgbevf_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3134,7 +3134,7 @@ static int ixgbevf_xmit_frame(struct sk_buff *skb, struct net_device *netdev)

tx_ring = &adapter->tx_ring[r_idx];

if (adapter->vlgrp && vlan_tx_tag_present(skb)) {
if (vlan_tx_tag_present(skb)) {
tx_flags |= vlan_tx_tag_get(skb);
tx_flags <<= IXGBE_TX_FLAGS_VLAN_SHIFT;
tx_flags |= IXGBE_TX_FLAGS_VLAN;
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/mlx4/en_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ u16 mlx4_en_select_queue(struct net_device *dev, struct sk_buff *skb)
/* If we support per priority flow control and the packet contains
* a vlan tag, send the packet to the TX ring assigned to that priority
*/
if (priv->prof->rx_ppp && priv->vlgrp && vlan_tx_tag_present(skb)) {
if (priv->prof->rx_ppp && vlan_tx_tag_present(skb)) {
vlan_tag = vlan_tx_tag_get(skb);
return MLX4_EN_NUM_TX_RINGS + (vlan_tag >> 13);
}
Expand Down Expand Up @@ -634,7 +634,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)

tx_ind = skb->queue_mapping;
ring = &priv->tx_ring[tx_ind];
if (priv->vlgrp && vlan_tx_tag_present(skb))
if (vlan_tx_tag_present(skb))
vlan_tag = vlan_tx_tag_get(skb);

/* Check available TXBBs And 2K spare for prefetch */
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/qlge/qlge_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2572,7 +2572,7 @@ static netdev_tx_t qlge_send(struct sk_buff *skb, struct net_device *ndev)

mac_iocb_ptr->frame_len = cpu_to_le16((u16) skb->len);

if (qdev->vlgrp && vlan_tx_tag_present(skb)) {
if (vlan_tx_tag_present(skb)) {
netif_printk(qdev, tx_queued, KERN_DEBUG, qdev->ndev,
"Adding a vlan tag %d.\n", vlan_tx_tag_get(skb));
mac_iocb_ptr->flags3 |= OB_MAC_IOCB_V;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/r8169.c
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ static int rtl8169_set_rx_csum(struct net_device *dev, u32 data)
static inline u32 rtl8169_tx_vlan_tag(struct rtl8169_private *tp,
struct sk_buff *skb)
{
return (tp->vlgrp && vlan_tx_tag_present(skb)) ?
return (vlan_tx_tag_present(skb)) ?
TxVlanTag | swab16(vlan_tx_tag_get(skb)) : 0x00;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/s2io.c
Original file line number Diff line number Diff line change
Expand Up @@ -4101,7 +4101,7 @@ static netdev_tx_t s2io_xmit(struct sk_buff *skb, struct net_device *dev)
}

queue = 0;
if (sp->vlgrp && vlan_tx_tag_present(skb))
if (vlan_tx_tag_present(skb))
vlan_tag = vlan_tx_tag_get(skb);
if (sp->config.tx_steering_type == TX_DEFAULT_STEERING) {
if (skb->protocol == htons(ETH_P_IP)) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/sky2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1782,7 +1782,7 @@ static netdev_tx_t sky2_xmit_frame(struct sk_buff *skb,
ctrl = 0;
#ifdef SKY2_VLAN_TAG_USED
/* Add VLAN tag, can piggyback on LRGLEN or ADDR64 */
if (sky2->vlgrp && vlan_tx_tag_present(skb)) {
if (vlan_tx_tag_present(skb)) {
if (!le) {
le = get_tx_le(sky2, &slot);
le->addr = 0;
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -5745,7 +5745,7 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb,
}

#if TG3_VLAN_TAG_USED
if (tp->vlgrp != NULL && vlan_tx_tag_present(skb))
if (vlan_tx_tag_present(skb))
base_flags |= (TXD_FLAG_VLAN |
(vlan_tx_tag_get(skb) << 16));
#endif
Expand Down Expand Up @@ -5991,7 +5991,7 @@ static netdev_tx_t tg3_start_xmit_dma_bug(struct sk_buff *skb,
}
}
#if TG3_VLAN_TAG_USED
if (tp->vlgrp != NULL && vlan_tx_tag_present(skb))
if (vlan_tx_tag_present(skb))
base_flags |= (TXD_FLAG_VLAN |
(vlan_tx_tag_get(skb) << 16));
#endif
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/via-velocity.c
Original file line number Diff line number Diff line change
Expand Up @@ -2592,7 +2592,7 @@ static netdev_tx_t velocity_xmit(struct sk_buff *skb,

td_ptr->tdesc1.cmd = TCPLS_NORMAL + (tdinfo->nskb_dma + 1) * 16;

if (vptr->vlgrp && vlan_tx_tag_present(skb)) {
if (vlan_tx_tag_present(skb)) {
td_ptr->tdesc1.vlan = cpu_to_le16(vlan_tx_tag_get(skb));
td_ptr->tdesc1.TCR |= TCR0_VETAG;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/vxge/vxge-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ vxge_xmit(struct sk_buff *skb, struct net_device *dev)
dev->name, __func__, __LINE__,
fifo_hw, dtr, dtr_priv);

if (vdev->vlgrp && vlan_tx_tag_present(skb)) {
if (vlan_tx_tag_present(skb)) {
u16 vlan_tag = vlan_tx_tag_get(skb);
vxge_hw_fifo_txdl_vlan_set(dtr, vlan_tag);
}
Expand Down

0 comments on commit eab6d18

Please sign in to comment.