vlan: Don't check for vlan group before vlan_tx_tag_present.
authorJesse Gross <jesse@nicira.com>
Wed, 20 Oct 2010 13:56:03 +0000 (13:56 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 21 Oct 2010 08:26:52 +0000 (01:26 -0700)
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>
29 files changed:
drivers/net/8139cp.c
drivers/net/amd8111e.c
drivers/net/atl1c/atl1c_main.c
drivers/net/atl1e/atl1e_main.c
drivers/net/atlx/atl1.c
drivers/net/atlx/atl2.c
drivers/net/benet/be_main.c
drivers/net/bna/bnad.c
drivers/net/bnx2.c
drivers/net/bnx2x/bnx2x_cmn.c
drivers/net/chelsio/sge.c
drivers/net/cxgb3/sge.c
drivers/net/e1000/e1000_main.c
drivers/net/e1000e/netdev.c
drivers/net/ehea/ehea_main.c
drivers/net/enic/enic_main.c
drivers/net/forcedeth.c
drivers/net/gianfar.c
drivers/net/igb/igb_main.c
drivers/net/ixgbe/ixgbe_main.c
drivers/net/ixgbevf/ixgbevf_main.c
drivers/net/mlx4/en_tx.c
drivers/net/qlge/qlge_main.c
drivers/net/r8169.c
drivers/net/s2io.c
drivers/net/sky2.c
drivers/net/tg3.c
drivers/net/via-velocity.c
drivers/net/vxge/vxge-main.c

index 237d4ea5a416f071cd50e5b9f3333da00cf062be..ac422cd332eadd687823fcc4db7ca2eaef997fea 100644 (file)
@@ -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
 
index 58a0ab4923ee64013886fc056a1e63c0fa1192f5..2ca880b4c0dbea4499b681c55a4f46d8331caadb 100644 (file)
@@ -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 =
index 553230eb365c547fce10d845051d5dbed8558753..99ffcf667d1f7cc08287aa20a12f117e52a43432 100644 (file)
@@ -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;
 
index 56ace3fbe40d879002a80fc111e966121d692557..ef6349bf3b33e8f8ce328147826f8e890a16abf0 100644 (file)
@@ -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;
 
index b8c053f768788fda4f9bbb0af404e471ded607b8..dbd27b8e66bdac2f324e6b01fd53ac16cf9d41c9 100644 (file)
@@ -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);
index 29c0265ccc5d2d65e08d0d4506870046cdf5bc3d..35b14bec12078a1a8cf364da39290d56429339b5 100644 (file)
@@ -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) |
index 4b59e53890b268fecbd4762c1084929e625d48cc..d5e796832fdd77270db8935537063d271c598762 100644 (file)
@@ -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));
 
@@ -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));
@@ -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;
index 74c64d6c88019e0c5ee6641be309e0216a51dc9a..7e839b9cec221758c69afe3871d7cd884207bb80 100644 (file)
@@ -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);
        }
index ae894bca4afb992dbaaf7dcae345c2c855caffbb..363ca8bcc974dd75ffcba3cce7b2aa7f08487ec4 100644 (file)
@@ -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));
        }
index 1966ceeefcd4980d1ff11b25e780348c7244cdda..6905b2e0609e0d9b26bdb90e14118555e9cb12c7 100644 (file)
@@ -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 |=
index 340b537dc97e1602d75593e368fdc49dc63b582b..70221ca3268373cf35ad44254514256cb91105b9 100644 (file)
@@ -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++;
index c5a142bea5e92a759885a2a70115b4a3031fd871..7ad4625dac629e030a7d1d725793684daaba48a0 100644 (file)
@@ -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);
@@ -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]++;
 
        /*
index 232ac2dcb4974bf6a99b086be598f647bd6332d2..a117f2a0252e8c884f6d890f912556924635cae9 100644 (file)
@@ -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);
        }
index 5d6cdea0eb14a922b9004d1df255e4e585bfaa7f..ec8cf3f51423fbf12fbdb9794ce1684f314b5140 100644 (file)
@@ -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);
        }
index 6932578816d35b6a4fc407f1a36055ca64ba5ed7..a0d117022be6e3071f51a11003c8bb4c2febc426 100644 (file)
@@ -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);
        }
index f47fbb63d8b6c8dff2cbc24f34806ff54dd4d7a1..a466ef91dd4351d58f37e4ed5b443395ce4725e6 100644 (file)
@@ -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);
index ddac63cefbaa692c6ff32e062607e4ccef65d629..0fa1776563a33c61a827f79e6824c600e9b41efc 100644 (file)
@@ -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);
 
index 6180089bf67a71223875c4930c005395f92546c2..4c4cc80ec0a1938f4a543254a7bf763f0a3ebfd4 100644 (file)
@@ -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;
@@ -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);
index 0f0939caf091f3ce5e6ba7622a29f99d0c468db3..75155a27fdde50594f5626c2e412fd91a0c20c9a 100644 (file)
@@ -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);
        }
index 1d424428079ffe8934cdcab1db7c3169c12ab250..998debe8023bd9c3f26e679ac4c5665ddf90f28f 100644 (file)
@@ -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;
index 78bfbe42ca9b9cb6a4f6aa3114188b6868b3de64..dc03c9652389692982dbcff1be6693c5d76e2f6b 100644 (file)
@@ -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;
index 98dd620042a8ed293cf6a6ea656eb88ecb138ab6..a680cd4a5ab66de803116ba69d7603f1919ceebe 100644 (file)
@@ -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);
        }
@@ -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 */
index 4ffebe83d883f2c23a828411a87c74a9c5dcfb81..ba0053d8515e24096854ee7cb7a07e99da32617b 100644 (file)
@@ -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;
index 1760533852a46a0681bc6ed9de7cedec9637ae02..242748b2c357249eb83690ed9bdd634508e31e91 100644 (file)
@@ -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;
 }
 
index c70ad515383add23bbac3a489d197b5245d4e091..ecc25aab896af3ee9e55a9da4e90bccd32553d37 100644 (file)
@@ -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)) {
index 3ef9b67ac6e62158839d23a4c2b1c82f9bb4948a..d6577084ce70b79690e79aea191ac2b36240cbfb 100644 (file)
@@ -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;
index 5b4c510dbcedcd062fdc729f48ec78d5a8ba75f0..22720eeabddbf240eecb0941eb7429056b7bf00b 100644 (file)
@@ -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
@@ -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
index f1995615dc8459297018e7b517e7c4987c3a8c97..cab96ad49e601488100d744ecacc6a76539f9b34 100644 (file)
@@ -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;
        }
index 0bda7fe05d4b478be5b2d0bcba9540cc04fc0c2f..a69542ecb68de8592e7f9791d4c627104caba046 100644 (file)
@@ -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);
        }