Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vlan: Don't check for vlan group before vlan_tx_tag_present.

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>

authored by

Jesse Gross and committed by
David S. Miller
eab6d18d b738127d

+38 -43
+1 -1
drivers/net/8139cp.c
··· 754 754 } 755 755 756 756 #if CP_VLAN_TAG_USED 757 - if (cp->vlgrp && vlan_tx_tag_present(skb)) 757 + if (vlan_tx_tag_present(skb)) 758 758 vlan_tag = TxVlanTag | swab16(vlan_tx_tag_get(skb)); 759 759 #endif 760 760
+1 -1
drivers/net/amd8111e.c
··· 1315 1315 lp->tx_ring[tx_index].tx_flags = 0; 1316 1316 1317 1317 #if AMD8111E_VLAN_TAG_USED 1318 - if((lp->vlgrp != NULL) && vlan_tx_tag_present(skb)){ 1318 + if (vlan_tx_tag_present(skb)) { 1319 1319 lp->tx_ring[tx_index].tag_ctrl_cmd |= 1320 1320 cpu_to_le16(TCC_VLAN_INSERT); 1321 1321 lp->tx_ring[tx_index].tag_ctrl_info =
+1 -1
drivers/net/atl1c/atl1c_main.c
··· 2243 2243 return NETDEV_TX_OK; 2244 2244 } 2245 2245 2246 - if (unlikely(adapter->vlgrp && vlan_tx_tag_present(skb))) { 2246 + if (unlikely(vlan_tx_tag_present(skb))) { 2247 2247 u16 vlan = vlan_tx_tag_get(skb); 2248 2248 __le16 tag; 2249 2249
+1 -1
drivers/net/atl1e/atl1e_main.c
··· 1814 1814 1815 1815 tpd = atl1e_get_tpd(adapter); 1816 1816 1817 - if (unlikely(adapter->vlgrp && vlan_tx_tag_present(skb))) { 1817 + if (unlikely(vlan_tx_tag_present(skb))) { 1818 1818 u16 vlan_tag = vlan_tx_tag_get(skb); 1819 1819 u16 atl1e_vlan_tag; 1820 1820
+1 -1
drivers/net/atlx/atl1.c
··· 2408 2408 (u16) atomic_read(&tpd_ring->next_to_use)); 2409 2409 memset(ptpd, 0, sizeof(struct tx_packet_desc)); 2410 2410 2411 - if (adapter->vlgrp && vlan_tx_tag_present(skb)) { 2411 + if (vlan_tx_tag_present(skb)) { 2412 2412 vlan_tag = vlan_tx_tag_get(skb); 2413 2413 vlan_tag = (vlan_tag << 4) | (vlan_tag >> 13) | 2414 2414 ((vlan_tag >> 9) & 0x8);
+1 -1
drivers/net/atlx/atl2.c
··· 870 870 offset = ((u32)(skb->len-copy_len + 3) & ~3); 871 871 } 872 872 #ifdef NETIF_F_HW_VLAN_TX 873 - if (adapter->vlgrp && vlan_tx_tag_present(skb)) { 873 + if (vlan_tx_tag_present(skb)) { 874 874 u16 vlan_tag = vlan_tx_tag_get(skb); 875 875 vlan_tag = (vlan_tag << 4) | 876 876 (vlan_tag >> 13) |
+3 -4
drivers/net/benet/be_main.c
··· 430 430 } 431 431 432 432 static void wrb_fill_hdr(struct be_eth_hdr_wrb *hdr, struct sk_buff *skb, 433 - bool vlan, u32 wrb_cnt, u32 len) 433 + u32 wrb_cnt, u32 len) 434 434 { 435 435 memset(hdr, 0, sizeof(*hdr)); 436 436 ··· 449 449 AMAP_SET_BITS(struct amap_eth_hdr_wrb, udpcs, hdr, 1); 450 450 } 451 451 452 - if (vlan && vlan_tx_tag_present(skb)) { 452 + if (vlan_tx_tag_present(skb)) { 453 453 AMAP_SET_BITS(struct amap_eth_hdr_wrb, vlan, hdr, 1); 454 454 AMAP_SET_BITS(struct amap_eth_hdr_wrb, vlan_tag, 455 455 hdr, vlan_tx_tag_get(skb)); ··· 532 532 queue_head_inc(txq); 533 533 } 534 534 535 - wrb_fill_hdr(hdr, first_skb, adapter->vlan_grp ? true : false, 536 - wrb_cnt, copied); 535 + wrb_fill_hdr(hdr, first_skb, wrb_cnt, copied); 537 536 be_dws_cpu_to_le(hdr, sizeof(*hdr)); 538 537 539 538 return copied;
+1 -1
drivers/net/bna/bnad.c
··· 2501 2501 htons((skb_is_gso(skb) ? BNA_TXQ_WI_SEND_LSO : 2502 2502 BNA_TXQ_WI_SEND)); 2503 2503 2504 - if (bnad->vlan_grp && vlan_tx_tag_present(skb)) { 2504 + if (vlan_tx_tag_present(skb)) { 2505 2505 vlan_tag = (u16) vlan_tx_tag_get(skb); 2506 2506 flags |= (BNA_TXQ_WI_CF_INS_PRIO | BNA_TXQ_WI_CF_INS_VLAN); 2507 2507 }
+1 -1
drivers/net/bnx2.c
··· 6429 6429 } 6430 6430 6431 6431 #ifdef BCM_VLAN 6432 - if (bp->vlgrp && vlan_tx_tag_present(skb)) { 6432 + if (vlan_tx_tag_present(skb)) { 6433 6433 vlan_tag_flags |= 6434 6434 (TX_BD_FLAGS_VLAN_TAG | (vlan_tx_tag_get(skb) << 16)); 6435 6435 }
+1 -2
drivers/net/bnx2x/bnx2x_cmn.c
··· 2026 2026 pkt_prod, tx_buf, fp->tx_pkt_prod, bd_prod, tx_start_bd); 2027 2027 2028 2028 #ifdef BCM_VLAN 2029 - if ((bp->vlgrp != NULL) && vlan_tx_tag_present(skb) && 2030 - (bp->flags & HW_VLAN_TX_FLAG)) { 2029 + if (vlan_tx_tag_present(skb)) { 2031 2030 tx_start_bd->vlan_or_ethertype = 2032 2031 cpu_to_le16(vlan_tx_tag_get(skb)); 2033 2032 tx_start_bd->bd_flags.as_bitfield |=
+1 -1
drivers/net/chelsio/sge.c
··· 1870 1870 cpl->iff = dev->if_port; 1871 1871 1872 1872 #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 1873 - if (adapter->vlan_grp && vlan_tx_tag_present(skb)) { 1873 + if (vlan_tx_tag_present(skb)) { 1874 1874 cpl->vlan_valid = 1; 1875 1875 cpl->vlan = htons(vlan_tx_tag_get(skb)); 1876 1876 st->vlan_insert++;
+2 -2
drivers/net/cxgb3/sge.c
··· 1145 1145 cpl->len = htonl(skb->len); 1146 1146 cntrl = V_TXPKT_INTF(pi->port_id); 1147 1147 1148 - if (vlan_tx_tag_present(skb) && pi->vlan_grp) 1148 + if (vlan_tx_tag_present(skb)) 1149 1149 cntrl |= F_TXPKT_VLAN_VLD | V_TXPKT_VLAN(vlan_tx_tag_get(skb)); 1150 1150 1151 1151 tso_info = V_LSO_MSS(skb_shinfo(skb)->gso_size); ··· 1279 1279 qs->port_stats[SGE_PSTAT_TX_CSUM]++; 1280 1280 if (skb_shinfo(skb)->gso_size) 1281 1281 qs->port_stats[SGE_PSTAT_TSO]++; 1282 - if (vlan_tx_tag_present(skb) && pi->vlan_grp) 1282 + if (vlan_tx_tag_present(skb)) 1283 1283 qs->port_stats[SGE_PSTAT_VLANINS]++; 1284 1284 1285 1285 /*
+1 -1
drivers/net/e1000/e1000_main.c
··· 3119 3119 } 3120 3120 } 3121 3121 3122 - if (unlikely(adapter->vlgrp && vlan_tx_tag_present(skb))) { 3122 + if (unlikely(vlan_tx_tag_present(skb))) { 3123 3123 tx_flags |= E1000_TX_FLAGS_VLAN; 3124 3124 tx_flags |= (vlan_tx_tag_get(skb) << E1000_TX_FLAGS_VLAN_SHIFT); 3125 3125 }
+1 -1
drivers/net/e1000e/netdev.c
··· 4800 4800 if (e1000_maybe_stop_tx(netdev, count + 2)) 4801 4801 return NETDEV_TX_BUSY; 4802 4802 4803 - if (adapter->vlgrp && vlan_tx_tag_present(skb)) { 4803 + if (vlan_tx_tag_present(skb)) { 4804 4804 tx_flags |= E1000_TX_FLAGS_VLAN; 4805 4805 tx_flags |= (vlan_tx_tag_get(skb) << E1000_TX_FLAGS_VLAN_SHIFT); 4806 4806 }
+1 -1
drivers/net/ehea/ehea_main.c
··· 2272 2272 } 2273 2273 pr->swqe_id_counter += 1; 2274 2274 2275 - if (port->vgrp && vlan_tx_tag_present(skb)) { 2275 + if (vlan_tx_tag_present(skb)) { 2276 2276 swqe->tx_control |= EHEA_SWQE_VLAN_INSERT; 2277 2277 swqe->vlan_tag = vlan_tx_tag_get(skb); 2278 2278 }
+1 -1
drivers/net/enic/enic_main.c
··· 805 805 int vlan_tag_insert = 0; 806 806 int loopback = 0; 807 807 808 - if (enic->vlan_group && vlan_tx_tag_present(skb)) { 808 + if (vlan_tx_tag_present(skb)) { 809 809 /* VLAN tag from trunking driver */ 810 810 vlan_tag_insert = 1; 811 811 vlan_tag = vlan_tx_tag_get(skb);
+4 -7
drivers/net/forcedeth.c
··· 2321 2321 NV_TX2_CHECKSUM_L3 | NV_TX2_CHECKSUM_L4 : 0; 2322 2322 2323 2323 /* vlan tag */ 2324 - if (likely(!np->vlangrp)) { 2324 + if (vlan_tx_tag_present(skb)) 2325 + start_tx->txvlan = cpu_to_le32(NV_TX3_VLAN_TAG_PRESENT | 2326 + vlan_tx_tag_get(skb)); 2327 + else 2325 2328 start_tx->txvlan = 0; 2326 - } else { 2327 - if (vlan_tx_tag_present(skb)) 2328 - start_tx->txvlan = cpu_to_le32(NV_TX3_VLAN_TAG_PRESENT | vlan_tx_tag_get(skb)); 2329 - else 2330 - start_tx->txvlan = 0; 2331 - } 2332 2329 2333 2330 spin_lock_irqsave(&np->lock, flags); 2334 2331
+2 -2
drivers/net/gianfar.c
··· 2075 2075 2076 2076 /* make space for additional header when fcb is needed */ 2077 2077 if (((skb->ip_summed == CHECKSUM_PARTIAL) || 2078 - (priv->vlgrp && vlan_tx_tag_present(skb)) || 2078 + vlan_tx_tag_present(skb) || 2079 2079 unlikely(do_tstamp)) && 2080 2080 (skb_headroom(skb) < GMAC_FCB_LEN)) { 2081 2081 struct sk_buff *skb_new; ··· 2161 2161 gfar_tx_checksum(skb, fcb); 2162 2162 } 2163 2163 2164 - if (priv->vlgrp && vlan_tx_tag_present(skb)) { 2164 + if (vlan_tx_tag_present(skb)) { 2165 2165 if (unlikely(NULL == fcb)) { 2166 2166 fcb = gfar_add_fcb(skb); 2167 2167 lstatus |= BD_LFLAG(TXBD_TOE);
+1 -1
drivers/net/igb/igb_main.c
··· 4128 4128 tx_flags |= IGB_TX_FLAGS_TSTAMP; 4129 4129 } 4130 4130 4131 - if (vlan_tx_tag_present(skb) && adapter->vlgrp) { 4131 + if (vlan_tx_tag_present(skb)) { 4132 4132 tx_flags |= IGB_TX_FLAGS_VLAN; 4133 4133 tx_flags |= (vlan_tx_tag_get(skb) << IGB_TX_FLAGS_VLAN_SHIFT); 4134 4134 }
+1 -1
drivers/net/ixgbe/ixgbe_main.c
··· 6311 6311 int count = 0; 6312 6312 unsigned int f; 6313 6313 6314 - if (adapter->vlgrp && vlan_tx_tag_present(skb)) { 6314 + if (vlan_tx_tag_present(skb)) { 6315 6315 tx_flags |= vlan_tx_tag_get(skb); 6316 6316 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { 6317 6317 tx_flags &= ~IXGBE_TX_FLAGS_VLAN_PRIO_MASK;
+1 -1
drivers/net/ixgbevf/ixgbevf_main.c
··· 3134 3134 3135 3135 tx_ring = &adapter->tx_ring[r_idx]; 3136 3136 3137 - if (adapter->vlgrp && vlan_tx_tag_present(skb)) { 3137 + if (vlan_tx_tag_present(skb)) { 3138 3138 tx_flags |= vlan_tx_tag_get(skb); 3139 3139 tx_flags <<= IXGBE_TX_FLAGS_VLAN_SHIFT; 3140 3140 tx_flags |= IXGBE_TX_FLAGS_VLAN;
+2 -2
drivers/net/mlx4/en_tx.c
··· 583 583 /* If we support per priority flow control and the packet contains 584 584 * a vlan tag, send the packet to the TX ring assigned to that priority 585 585 */ 586 - if (priv->prof->rx_ppp && priv->vlgrp && vlan_tx_tag_present(skb)) { 586 + if (priv->prof->rx_ppp && vlan_tx_tag_present(skb)) { 587 587 vlan_tag = vlan_tx_tag_get(skb); 588 588 return MLX4_EN_NUM_TX_RINGS + (vlan_tag >> 13); 589 589 } ··· 634 634 635 635 tx_ind = skb->queue_mapping; 636 636 ring = &priv->tx_ring[tx_ind]; 637 - if (priv->vlgrp && vlan_tx_tag_present(skb)) 637 + if (vlan_tx_tag_present(skb)) 638 638 vlan_tag = vlan_tx_tag_get(skb); 639 639 640 640 /* Check available TXBBs And 2K spare for prefetch */
+1 -1
drivers/net/qlge/qlge_main.c
··· 2572 2572 2573 2573 mac_iocb_ptr->frame_len = cpu_to_le16((u16) skb->len); 2574 2574 2575 - if (qdev->vlgrp && vlan_tx_tag_present(skb)) { 2575 + if (vlan_tx_tag_present(skb)) { 2576 2576 netif_printk(qdev, tx_queued, KERN_DEBUG, qdev->ndev, 2577 2577 "Adding a vlan tag %d.\n", vlan_tx_tag_get(skb)); 2578 2578 mac_iocb_ptr->flags3 |= OB_MAC_IOCB_V;
+1 -1
drivers/net/r8169.c
··· 1034 1034 static inline u32 rtl8169_tx_vlan_tag(struct rtl8169_private *tp, 1035 1035 struct sk_buff *skb) 1036 1036 { 1037 - return (tp->vlgrp && vlan_tx_tag_present(skb)) ? 1037 + return (vlan_tx_tag_present(skb)) ? 1038 1038 TxVlanTag | swab16(vlan_tx_tag_get(skb)) : 0x00; 1039 1039 } 1040 1040
+1 -1
drivers/net/s2io.c
··· 4101 4101 } 4102 4102 4103 4103 queue = 0; 4104 - if (sp->vlgrp && vlan_tx_tag_present(skb)) 4104 + if (vlan_tx_tag_present(skb)) 4105 4105 vlan_tag = vlan_tx_tag_get(skb); 4106 4106 if (sp->config.tx_steering_type == TX_DEFAULT_STEERING) { 4107 4107 if (skb->protocol == htons(ETH_P_IP)) {
+1 -1
drivers/net/sky2.c
··· 1782 1782 ctrl = 0; 1783 1783 #ifdef SKY2_VLAN_TAG_USED 1784 1784 /* Add VLAN tag, can piggyback on LRGLEN or ADDR64 */ 1785 - if (sky2->vlgrp && vlan_tx_tag_present(skb)) { 1785 + if (vlan_tx_tag_present(skb)) { 1786 1786 if (!le) { 1787 1787 le = get_tx_le(sky2, &slot); 1788 1788 le->addr = 0;
+2 -2
drivers/net/tg3.c
··· 5745 5745 } 5746 5746 5747 5747 #if TG3_VLAN_TAG_USED 5748 - if (tp->vlgrp != NULL && vlan_tx_tag_present(skb)) 5748 + if (vlan_tx_tag_present(skb)) 5749 5749 base_flags |= (TXD_FLAG_VLAN | 5750 5750 (vlan_tx_tag_get(skb) << 16)); 5751 5751 #endif ··· 5991 5991 } 5992 5992 } 5993 5993 #if TG3_VLAN_TAG_USED 5994 - if (tp->vlgrp != NULL && vlan_tx_tag_present(skb)) 5994 + if (vlan_tx_tag_present(skb)) 5995 5995 base_flags |= (TXD_FLAG_VLAN | 5996 5996 (vlan_tx_tag_get(skb) << 16)); 5997 5997 #endif
+1 -1
drivers/net/via-velocity.c
··· 2592 2592 2593 2593 td_ptr->tdesc1.cmd = TCPLS_NORMAL + (tdinfo->nskb_dma + 1) * 16; 2594 2594 2595 - if (vptr->vlgrp && vlan_tx_tag_present(skb)) { 2595 + if (vlan_tx_tag_present(skb)) { 2596 2596 td_ptr->tdesc1.vlan = cpu_to_le16(vlan_tx_tag_get(skb)); 2597 2597 td_ptr->tdesc1.TCR |= TCR0_VETAG; 2598 2598 }
+1 -1
drivers/net/vxge/vxge-main.c
··· 822 822 dev->name, __func__, __LINE__, 823 823 fifo_hw, dtr, dtr_priv); 824 824 825 - if (vdev->vlgrp && vlan_tx_tag_present(skb)) { 825 + if (vlan_tx_tag_present(skb)) { 826 826 u16 vlan_tag = vlan_tx_tag_get(skb); 827 827 vxge_hw_fifo_txdl_vlan_set(dtr, vlan_tag); 828 828 }