net: vlan: add protocol argument to packet tagging functions
authorPatrick McHardy <kaber@trash.net>
Fri, 19 Apr 2013 02:04:30 +0000 (02:04 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 19 Apr 2013 18:46:06 +0000 (14:46 -0400)
Add a protocol argument to the VLAN packet tagging functions. In case of HW
tagging, we need that protocol available in the ndo_start_xmit functions,
so it is stored in a new field in the skb. The new field fits into a hole
(on 64 bit) and doesn't increase the sks's size.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
56 files changed:
drivers/infiniband/hw/nes/nes_hw.c
drivers/net/bonding/bond_alb.c
drivers/net/ethernet/3com/typhoon.c
drivers/net/ethernet/adaptec/starfire.c
drivers/net/ethernet/alteon/acenic.c
drivers/net/ethernet/amd/amd8111e.c
drivers/net/ethernet/atheros/atl1c/atl1c_main.c
drivers/net/ethernet/atheros/atl1e/atl1e_main.c
drivers/net/ethernet/atheros/atlx/atl1.c
drivers/net/ethernet/atheros/atlx/atl2.c
drivers/net/ethernet/broadcom/bnx2.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
drivers/net/ethernet/broadcom/tg3.c
drivers/net/ethernet/brocade/bna/bnad.c
drivers/net/ethernet/chelsio/cxgb/sge.c
drivers/net/ethernet/chelsio/cxgb3/sge.c
drivers/net/ethernet/chelsio/cxgb4/sge.c
drivers/net/ethernet/chelsio/cxgb4vf/sge.c
drivers/net/ethernet/cisco/enic/enic_main.c
drivers/net/ethernet/emulex/benet/be_main.c
drivers/net/ethernet/intel/e1000/e1000_main.c
drivers/net/ethernet/intel/e1000e/netdev.c
drivers/net/ethernet/intel/igb/igb_main.c
drivers/net/ethernet/intel/igbvf/netdev.c
drivers/net/ethernet/intel/ixgb/ixgb_main.c
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
drivers/net/ethernet/jme.c
drivers/net/ethernet/marvell/sky2.c
drivers/net/ethernet/mellanox/mlx4/en_rx.c
drivers/net/ethernet/myricom/myri10ge/myri10ge.c
drivers/net/ethernet/natsemi/ns83820.c
drivers/net/ethernet/neterion/s2io.c
drivers/net/ethernet/neterion/vxge/vxge-main.c
drivers/net/ethernet/nvidia/forcedeth.c
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
drivers/net/ethernet/qlogic/qlge/qlge_main.c
drivers/net/ethernet/realtek/8139cp.c
drivers/net/ethernet/realtek/r8169.c
drivers/net/ethernet/tehuti/tehuti.c
drivers/net/ethernet/via/via-rhine.c
drivers/net/ethernet/via/via-velocity.c
drivers/net/usb/cdc_mbim.c
drivers/net/vmxnet3/vmxnet3_drv.c
include/linux/if_vlan.h
include/linux/skbuff.h
net/8021q/vlan_core.c
net/8021q/vlan_dev.c
net/batman-adv/bridge_loop_avoidance.c
net/bridge/br_netfilter.c
net/bridge/br_vlan.c
net/core/dev.c
net/core/netpoll.c
net/core/skbuff.c
net/openvswitch/actions.c
net/openvswitch/datapath.c

index 67647e264611ecc7d6f7e54b602683d93ed3bd5c..418004c93feb772c641dde6b102620fc2be45900 100644 (file)
@@ -2948,7 +2948,7 @@ void nes_nic_ce_handler(struct nes_device *nesdev, struct nes_hw_nic_cq *cq)
                                        nes_debug(NES_DBG_CQ, "%s: Reporting stripped VLAN packet. Tag = 0x%04X\n",
                                                        nesvnic->netdev->name, vlan_tag);
 
-                                       __vlan_hwaccel_put_tag(rx_skb, vlan_tag);
+                                       __vlan_hwaccel_put_tag(rx_skb, htons(ETH_P_8021Q), vlan_tag);
                                }
                                if (nes_use_lro)
                                        lro_receive_skb(&nesvnic->lro_mgr, rx_skb, NULL);
index f5e05272302995cddb352ce4310524047d1a9dbe..e02cc265723abbaf397abbf84b0751d817dc5efd 100644 (file)
@@ -514,7 +514,7 @@ static void rlb_update_client(struct rlb_client_info *client_info)
                skb->dev = client_info->slave->dev;
 
                if (client_info->tag) {
-                       skb = vlan_put_tag(skb, client_info->vlan_id);
+                       skb = vlan_put_tag(skb, htons(ETH_P_8021Q), client_info->vlan_id);
                        if (!skb) {
                                pr_err("%s: Error: failed to insert VLAN tag\n",
                                       client_info->slave->bond->dev->name);
@@ -1014,7 +1014,7 @@ static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[])
                                continue;
                        }
 
-                       skb = vlan_put_tag(skb, vlan->vlan_id);
+                       skb = vlan_put_tag(skb, htons(ETH_P_8021Q), vlan->vlan_id);
                        if (!skb) {
                                pr_err("%s: Error: failed to insert VLAN tag\n",
                                       bond->dev->name);
index 839a962137428a30311988013dc274b394630a2f..144942f6372b68edd1bedc91175b8feab07cbe6e 100644 (file)
@@ -1690,7 +1690,7 @@ typhoon_rx(struct typhoon *tp, struct basic_ring *rxRing, volatile __le32 * read
                        skb_checksum_none_assert(new_skb);
 
                if (rx->rxStatus & TYPHOON_RX_VLAN)
-                       __vlan_hwaccel_put_tag(new_skb,
+                       __vlan_hwaccel_put_tag(new_skb, htons(ETH_P_8021Q),
                                               ntohl(rx->vlanTag) & 0xffff);
                netif_receive_skb(new_skb);
 
index cdbc5443ae3b8bfc81d0510d2948121a3ccfd86e..8b04bfc20cfba3b9c17984471dfccb6163799bdb 100644 (file)
@@ -1498,7 +1498,7 @@ static int __netdev_rx(struct net_device *dev, int *quota)
                                printk(KERN_DEBUG "  netdev_rx() vlanid = %d\n",
                                       vlid);
                        }
-                       __vlan_hwaccel_put_tag(skb, vlid);
+                       __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlid);
                }
 #endif /* VLAN_SUPPORT */
                netif_receive_skb(skb);
index a7689d931053b0bc865f7a5193a2905296675617..b7894f8af9d1969e31410b0ffb3784c774a88275 100644 (file)
@@ -2019,7 +2019,7 @@ static void ace_rx_int(struct net_device *dev, u32 rxretprd, u32 rxretcsm)
 
                /* send it up */
                if ((bd_flags & BD_FLG_VLAN_TAG))
-                       __vlan_hwaccel_put_tag(skb, retdesc->vlan);
+                       __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), retdesc->vlan);
                netif_rx(skb);
 
                dev->stats.rx_packets++;
index 6bad84d6e2c4430f77b649c6816aed641411ebda..8e6b665a672686350f872565e4e071fad7c6caa9 100644 (file)
@@ -793,7 +793,7 @@ static int amd8111e_rx_poll(struct napi_struct *napi, int budget)
 #if AMD8111E_VLAN_TAG_USED
                        if (vtag == TT_VLAN_TAGGED){
                                u16 vlan_tag = le16_to_cpu(lp->rx_ring[rx_index].tag_ctrl_info);
-                               __vlan_hwaccel_put_tag(skb, vlan_tag);
+                               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
                        }
 #endif
                        netif_receive_skb(skb);
index 3565255cdd811eab40299c2ad6f241eaf6d259a0..0ba900762b138d87a3547a0a6d810bcfb151429d 100644 (file)
@@ -1809,7 +1809,7 @@ rrs_checked:
 
                        AT_TAG_TO_VLAN(rrs->vlan_tag, vlan);
                        vlan = le16_to_cpu(vlan);
-                       __vlan_hwaccel_put_tag(skb, vlan);
+                       __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan);
                }
                netif_receive_skb(skb);
 
index 598a611516683d9d4060056dabb83084e4b11192..0688bb82b442e9cd55d5ce6da9d1a9f064295403 100644 (file)
@@ -1435,7 +1435,7 @@ static void atl1e_clean_rx_irq(struct atl1e_adapter *adapter, u8 que,
                                netdev_dbg(netdev,
                                           "RXD VLAN TAG<RRD>=0x%04x\n",
                                           prrs->vtag);
-                               __vlan_hwaccel_put_tag(skb, vlan_tag);
+                               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
                        }
                        netif_receive_skb(skb);
 
index fd7d85044e4a7c47ce89ec2fbbdd48e4e16ef474..fa0915f3999b24c8d3d53d0efddad6ad7efb98d6 100644 (file)
@@ -2024,7 +2024,7 @@ rrd_ok:
                                        ((rrd->vlan_tag & 7) << 13) |
                                        ((rrd->vlan_tag & 8) << 9);
 
-                       __vlan_hwaccel_put_tag(skb, vlan_tag);
+                       __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
                }
                netif_receive_skb(skb);
 
index 6b2c08a89b7ed041cd77b249ebcc18279adc069b..265ce1b752ed0b169a927f6dad148e694ca4c5a2 100644 (file)
@@ -452,7 +452,7 @@ static void atl2_intr_rx(struct atl2_adapter *adapter)
                                        ((rxd->status.vtag&7) << 13) |
                                        ((rxd->status.vtag&8) << 9);
 
-                               __vlan_hwaccel_put_tag(skb, vlan_tag);
+                               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
                        }
                        netif_rx(skb);
                        netdev->stats.rx_bytes += rx_size;
index 42a8bc8df5dd55de389a0e908109afc0c965949e..5d204492c603a84fd94f03faf5fc1179abf61208 100644 (file)
@@ -3211,7 +3211,7 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
                }
                if ((status & L2_FHDR_STATUS_L2_VLAN_TAG) &&
                    !(bp->rx_mode & BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG))
-                       __vlan_hwaccel_put_tag(skb, rx_hdr->l2_fhdr_vlan_tag);
+                       __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), rx_hdr->l2_fhdr_vlan_tag);
 
                skb->protocol = eth_type_trans(skb, bp->dev);
 
index 352e58ede4d5e48d728bf2ab07d77e0cb514f5df..6b50443d3456c12c34f525408267639cd14f875a 100644 (file)
@@ -719,7 +719,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
                if (!bnx2x_fill_frag_skb(bp, fp, tpa_info, pages,
                                         skb, cqe, cqe_idx)) {
                        if (tpa_info->parsing_flags & PARSING_FLAGS_VLAN)
-                               __vlan_hwaccel_put_tag(skb, tpa_info->vlan_tag);
+                               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), tpa_info->vlan_tag);
                        bnx2x_gro_receive(bp, fp, skb);
                } else {
                        DP(NETIF_MSG_RX_STATUS,
@@ -994,7 +994,7 @@ reuse_rx:
 
                if (le16_to_cpu(cqe_fp->pars_flags.flags) &
                    PARSING_FLAGS_VLAN)
-                       __vlan_hwaccel_put_tag(skb,
+                       __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
                                               le16_to_cpu(cqe_fp->vlan_tag));
                napi_gro_receive(&fp->napi, skb);
 
index 0c22c9a059c44513d47ce4066ddab93a97fe9619..ac83c87e0b1b3af379beff49782a66a1e155d61e 100644 (file)
@@ -6715,7 +6715,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
 
                if (desc->type_flags & RXD_FLAG_VLAN &&
                    !(tp->rx_mode & RX_MODE_KEEP_VLAN_TAG))
-                       __vlan_hwaccel_put_tag(skb,
+                       __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
                                               desc->err_vlan & RXD_VLAN_MASK);
 
                napi_gro_receive(&tnapi->napi, skb);
index c0bc44e51fa9477dbbe22b307db3e23baef43351..ce4a030d3d0cab9705e8715b6169a9031b0fd840 100644 (file)
@@ -610,7 +610,7 @@ bnad_cq_process(struct bnad *bnad, struct bna_ccb *ccb, int budget)
                rcb->rxq->rx_bytes += length;
 
                if (flags & BNA_CQ_EF_VLAN)
-                       __vlan_hwaccel_put_tag(skb, ntohs(cmpl->vlan_tag));
+                       __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(cmpl->vlan_tag));
 
                if (BNAD_RXBUF_IS_PAGE(unmap_q->type))
                        napi_gro_frags(&rx_ctrl->napi);
index f85e0659432b2aec8f16fe0f948dcb4bc751d07f..8061fb0ef7edd5b8b9d5bca8d8d6a3e270c5314a 100644 (file)
@@ -1386,7 +1386,7 @@ static void sge_rx(struct sge *sge, struct freelQ *fl, unsigned int len)
 
        if (p->vlan_valid) {
                st->vlan_xtract++;
-               __vlan_hwaccel_put_tag(skb, ntohs(p->vlan));
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(p->vlan));
        }
        netif_receive_skb(skb);
 }
index 9d67eb794c4baf612fbbab2e2897235cef10a796..f12e6b85a653c3d345c775281a3b7b9ccacdf90f 100644 (file)
@@ -2030,7 +2030,7 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq,
 
        if (p->vlan_valid) {
                qs->port_stats[SGE_PSTAT_VLANEX]++;
-               __vlan_hwaccel_put_tag(skb, ntohs(p->vlan));
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(p->vlan));
        }
        if (rq->polling) {
                if (lro)
@@ -2132,7 +2132,7 @@ static void lro_add_page(struct adapter *adap, struct sge_qset *qs,
 
        if (cpl->vlan_valid) {
                qs->port_stats[SGE_PSTAT_VLANEX]++;
-               __vlan_hwaccel_put_tag(skb, ntohs(cpl->vlan));
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(cpl->vlan));
        }
        napi_gro_frags(&qs->napi);
 }
index 8b47b253e204a53d56e41ff2fadd5c0b6a8f3f2d..2bfbb206b35af7c943f489ab5cbae9ebb44b8d7e 100644 (file)
@@ -1633,7 +1633,7 @@ static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl,
                skb->rxhash = (__force u32)pkt->rsshdr.hash_val;
 
        if (unlikely(pkt->vlan_ex)) {
-               __vlan_hwaccel_put_tag(skb, ntohs(pkt->vlan));
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(pkt->vlan));
                rxq->stats.vlan_ex++;
        }
        ret = napi_gro_frags(&rxq->rspq.napi);
@@ -1705,7 +1705,7 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
                skb_checksum_none_assert(skb);
 
        if (unlikely(pkt->vlan_ex)) {
-               __vlan_hwaccel_put_tag(skb, ntohs(pkt->vlan));
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(pkt->vlan));
                rxq->stats.vlan_ex++;
        }
        netif_receive_skb(skb);
index 61dfb2a4792989da01e824de2c256f29dc4ac661..df296af20bd52d1052a1c05200841d55dc4acde1 100644 (file)
@@ -1482,7 +1482,8 @@ static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl,
        skb_record_rx_queue(skb, rxq->rspq.idx);
 
        if (pkt->vlan_ex) {
-               __vlan_hwaccel_put_tag(skb, be16_to_cpu(pkt->vlan));
+               __vlan_hwaccel_put_tag(skb, cpu_to_be16(ETH_P_8021Q),
+                                       be16_to_cpu(pkt->vlan));
                rxq->stats.vlan_ex++;
        }
        ret = napi_gro_frags(&rxq->rspq.napi);
@@ -1551,7 +1552,7 @@ int t4vf_ethrx_handler(struct sge_rspq *rspq, const __be64 *rsp,
 
        if (pkt->vlan_ex) {
                rxq->stats.vlan_ex++;
-               __vlan_hwaccel_put_tag(skb, be16_to_cpu(pkt->vlan));
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), be16_to_cpu(pkt->vlan));
        }
 
        netif_receive_skb(skb);
index 05c1e59b6bff9814e64066895176eb3d89c4d083..635f55992d7e8f2788a5411974e448d7af20f3ec 100644 (file)
@@ -1300,7 +1300,7 @@ static void enic_rq_indicate_buf(struct vnic_rq *rq,
                }
 
                if (vlan_stripped)
-                       __vlan_hwaccel_put_tag(skb, vlan_tci);
+                       __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tci);
 
                if (netdev->features & NETIF_F_GRO)
                        napi_gro_receive(&enic->napi[q_number], skb);
index b41333184916dac17ff16f52827d24b34999b6ee..811d0a47d17a5c16e340491d0d55d3258d3a8149 100644 (file)
@@ -771,7 +771,7 @@ static struct sk_buff *be_insert_vlan_in_pkt(struct be_adapter *adapter,
 
        if (vlan_tx_tag_present(skb)) {
                vlan_tag = be_get_tx_vlan_tag(adapter, skb);
-               __vlan_put_tag(skb, vlan_tag);
+               __vlan_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
                skb->vlan_tci = 0;
        }
 
@@ -1383,7 +1383,7 @@ static void be_rx_compl_process(struct be_rx_obj *rxo,
 
 
        if (rxcp->vlanf)
-               __vlan_hwaccel_put_tag(skb, rxcp->vlan_tag);
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), rxcp->vlan_tag);
 
        netif_receive_skb(skb);
 }
@@ -1439,7 +1439,7 @@ void be_rx_compl_process_gro(struct be_rx_obj *rxo, struct napi_struct *napi,
                skb->rxhash = rxcp->rss_hash;
 
        if (rxcp->vlanf)
-               __vlan_hwaccel_put_tag(skb, rxcp->vlan_tag);
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), rxcp->vlan_tag);
 
        napi_gro_frags(napi);
 }
index 8239dafdd8e7542cd06b77cac94bad673208aa58..59ad007dd5aa09a6123cbd25db7c7b8f4e06f1b7 100644 (file)
@@ -4003,7 +4003,7 @@ static void e1000_receive_skb(struct e1000_adapter *adapter, u8 status,
        if (status & E1000_RXD_STAT_VP) {
                u16 vid = le16_to_cpu(vlan) & E1000_RXD_SPC_VLAN_MASK;
 
-               __vlan_hwaccel_put_tag(skb, vid);
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
        }
        napi_gro_receive(&adapter->napi, skb);
 }
index 8c17f01a155fcc2b94633896f7d156ab03c74407..da7f2fad5ba4815672dff09d3d78af6bccd82393 100644 (file)
@@ -554,7 +554,7 @@ static void e1000_receive_skb(struct e1000_adapter *adapter,
        skb->protocol = eth_type_trans(skb, netdev);
 
        if (staterr & E1000_RXD_STAT_VP)
-               __vlan_hwaccel_put_tag(skb, tag);
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), tag);
 
        napi_gro_receive(&adapter->napi, skb);
 }
index d13ea71c7c1ffa8cbd06fc0e6688ea1540ccfa19..9bf08b977daab541ab66f7ecabfb94d85be12eb9 100644 (file)
@@ -6683,7 +6683,7 @@ static void igb_process_skb_fields(struct igb_ring *rx_ring,
                else
                        vid = le16_to_cpu(rx_desc->wb.upper.vlan);
 
-               __vlan_hwaccel_put_tag(skb, vid);
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
        }
 
        skb_record_rx_queue(skb, rx_ring->queue_index);
index 3854fd698b856bdc33c00478d125ce6efe435f5b..93eb7ee06d3e0aa2159fcccc61e797eb44fd79bd 100644 (file)
@@ -116,7 +116,7 @@ static void igbvf_receive_skb(struct igbvf_adapter *adapter,
                else
                        vid = le16_to_cpu(vlan) & E1000_RXD_SPC_VLAN_MASK;
                if (test_bit(vid, adapter->active_vlans))
-                       __vlan_hwaccel_put_tag(skb, vid);
+                       __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
        }
 
        napi_gro_receive(&adapter->rx_ring->napi, skb);
index a32f274acd36b4ffa5f7944d278c26126b464c12..fce3e92f9d11cf249b9574d3687947f3242dd81e 100644 (file)
@@ -2082,8 +2082,8 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter, int *work_done, int work_to_do)
 
                skb->protocol = eth_type_trans(skb, netdev);
                if (status & IXGB_RX_DESC_STATUS_VP)
-                       __vlan_hwaccel_put_tag(skb,
-                                              le16_to_cpu(rx_desc->special));
+                       __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
+                                      le16_to_cpu(rx_desc->special));
 
                netif_receive_skb(skb);
 
index 3becffc7732104eb2e07b6e0d1841e9d0d24cdda..6225f880a3f455a342a1abe0dc9a76bf15b8a737 100644 (file)
@@ -1491,7 +1491,7 @@ static void ixgbe_process_skb_fields(struct ixgbe_ring *rx_ring,
        if ((dev->features & NETIF_F_HW_VLAN_CTAG_RX) &&
            ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_VP)) {
                u16 vid = le16_to_cpu(rx_desc->wb.upper.vlan);
-               __vlan_hwaccel_put_tag(skb, vid);
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
        }
 
        skb_record_rx_queue(skb, rx_ring->queue_index);
index 4bc1f84c9352616a2cc4c21834aa9f99015e68f2..1f5166ad6bb514ade1ee4fd906c1e47385bf5b6a 100644 (file)
@@ -291,7 +291,7 @@ static void ixgbevf_receive_skb(struct ixgbevf_q_vector *q_vector,
        u16 tag = le16_to_cpu(rx_desc->wb.upper.vlan);
 
        if (is_vlan && test_bit(tag & VLAN_VID_MASK, adapter->active_vlans))
-               __vlan_hwaccel_put_tag(skb, tag);
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), tag);
 
        if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL))
                napi_gro_receive(&q_vector->napi, skb);
index d28ce6f9717285eec333ac34a825dc792b2afa18..070a6f1a057745a803d3a6ccd6d8201644e95703 100644 (file)
@@ -1059,7 +1059,7 @@ jme_alloc_and_feed_skb(struct jme_adapter *jme, int idx)
                if (rxdesc->descwb.flags & cpu_to_le16(RXWBFLAG_TAGON)) {
                        u16 vid = le16_to_cpu(rxdesc->descwb.vlan);
 
-                       __vlan_hwaccel_put_tag(skb, vid);
+                       __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
                        NET_STAT(jme).rx_bytes += 4;
                }
                jme->jme_rx(skb);
index bf9da1b7b090a8edf9a95a1cf0372dd399038e94..256ae789c1431c669835879b84587926d45a2d35 100644 (file)
@@ -2713,7 +2713,7 @@ static void sky2_rx_tag(struct sky2_port *sky2, u16 length)
        struct sk_buff *skb;
 
        skb = sky2->rx_ring[sky2->rx_next].skb;
-       __vlan_hwaccel_put_tag(skb, be16_to_cpu(length));
+       __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), be16_to_cpu(length));
 }
 
 static void sky2_rx_hash(struct sky2_port *sky2, u32 status)
index c7f856308e1ac42249848bfea0780ed3a590b3b9..4006f8857cb567ee426f73ba7ac44aa763258f6d 100644 (file)
@@ -673,7 +673,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
                                            cpu_to_be32(MLX4_CQE_VLAN_PRESENT_MASK)) {
                                                u16 vid = be16_to_cpu(cqe->sl_vid);
 
-                                               __vlan_hwaccel_put_tag(gro_skb, vid);
+                                               __vlan_hwaccel_put_tag(gro_skb, htons(ETH_P_8021Q), vid);
                                        }
 
                                        if (dev->features & NETIF_F_RXHASH)
@@ -716,7 +716,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
 
                if (be32_to_cpu(cqe->vlan_my_qpn) &
                    MLX4_CQE_VLAN_PRESENT_MASK)
-                       __vlan_hwaccel_put_tag(skb, be16_to_cpu(cqe->sl_vid));
+                       __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), be16_to_cpu(cqe->sl_vid));
 
                /* Push it up the stack */
                netif_receive_skb(skb);
index 46262ea610fd1b1e96ecf1bb9713316144c9a231..7be9788ed0f6fddcb43abd1b384b0424ad33cb22 100644 (file)
@@ -1290,7 +1290,7 @@ myri10ge_vlan_rx(struct net_device *dev, void *addr, struct sk_buff *skb)
                        skb->csum = csum_sub(skb->csum, vsum);
                }
                /* pop tag */
-               __vlan_hwaccel_put_tag(skb, ntohs(veh->h_vlan_TCI));
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(veh->h_vlan_TCI));
                memmove(va + VLAN_HLEN, va, 2 * ETH_ALEN);
                skb->len -= VLAN_HLEN;
                skb->data_len -= VLAN_HLEN;
index 60267e91cbda9cacd3906e3dc1fb895c275e2948..d3b47003a5757067f47340c60e6d2dc08d299c10 100644 (file)
@@ -911,7 +911,7 @@ static void rx_irq(struct net_device *ndev)
                                unsigned short tag;
 
                                tag = ntohs(extsts & EXTSTS_VTG_MASK);
-                               __vlan_hwaccel_put_tag(skb, tag);
+                               __vlan_hwaccel_put_tag(skb, htons(ETH_P_IPV6), tag);
                        }
 #endif
                        rx_rc = netif_rx(skb);
index ec82d59b03ed83a6c87c00ab44a6409d01d13515..51b00941302c8d7e7eea3dcad6daa17c7702c65e 100644 (file)
@@ -8555,7 +8555,7 @@ static void queue_rx_frame(struct sk_buff *skb, u16 vlan_tag)
 
        skb->protocol = eth_type_trans(skb, dev);
        if (vlan_tag && sp->vlan_strip_flag)
-               __vlan_hwaccel_put_tag(skb, vlan_tag);
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
        if (sp->config.napi)
                netif_receive_skb(skb);
        else
index a9396142201ce3d19f2bd026395773b044c5c20b..cbfaed5f2f8df2617a45f7f08150492c398104fa 100644 (file)
@@ -312,7 +312,7 @@ vxge_rx_complete(struct vxge_ring *ring, struct sk_buff *skb, u16 vlan,
 
        if (ext_info->vlan &&
            ring->vlan_tag_strip == VXGE_HW_VPATH_RPA_STRIP_VLAN_TAG_ENABLE)
-               __vlan_hwaccel_put_tag(skb, ext_info->vlan);
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ext_info->vlan);
        napi_gro_receive(ring->napi_p, skb);
 
        vxge_debug_entryexit(VXGE_TRACE,
index fcad64081d74aa9d15a43136c36fb780b682481b..b003fe53c8e2508e3de8f2c2a118060b57ac02ac 100644 (file)
@@ -2969,7 +2969,7 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit)
                            vlanflags & NV_RX3_VLAN_TAG_PRESENT) {
                                u16 vid = vlanflags & NV_RX3_VLAN_TAG_MASK;
 
-                               __vlan_hwaccel_put_tag(skb, vid);
+                               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
                        }
                        napi_gro_receive(&np->napi, skb);
                        u64_stats_update_begin(&np->swstats_rx_syncp);
index a85ca63a2c9e823ed6eadd7ed602e3bdb83235a0..56223a6aa408ab49f0096adb86033b3a1d5c0058 100644 (file)
@@ -1050,7 +1050,7 @@ qlcnic_process_rcv(struct qlcnic_adapter *adapter,
        skb->protocol = eth_type_trans(skb, netdev);
 
        if (vid != 0xffff)
-               __vlan_hwaccel_put_tag(skb, vid);
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
 
        napi_gro_receive(&sds_ring->napi, skb);
 
@@ -1153,7 +1153,7 @@ qlcnic_process_lro(struct qlcnic_adapter *adapter,
        }
 
        if (vid != 0xffff)
-               __vlan_hwaccel_put_tag(skb, vid);
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
        netif_receive_skb(skb);
 
        adapter->stats.lro_pkts++;
@@ -1518,7 +1518,7 @@ qlcnic_83xx_process_rcv(struct qlcnic_adapter *adapter,
        skb->protocol = eth_type_trans(skb, netdev);
 
        if (vid != 0xffff)
-               __vlan_hwaccel_put_tag(skb, vid);
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
 
        napi_gro_receive(&sds_ring->napi, skb);
 
@@ -1615,7 +1615,7 @@ qlcnic_83xx_process_lro(struct qlcnic_adapter *adapter,
        }
 
        if (vid != 0xffff)
-               __vlan_hwaccel_put_tag(skb, vid);
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
 
        netif_receive_skb(skb);
 
index a9016acc2d6aacf17bfe9e6efe070abb42470cd3..44cf72ac248947328fd4654ac254ca97c354a9ad 100644 (file)
@@ -1498,7 +1498,7 @@ static void ql_process_mac_rx_gro_page(struct ql_adapter *qdev,
        skb->ip_summed = CHECKSUM_UNNECESSARY;
        skb_record_rx_queue(skb, rx_ring->cq_id);
        if (vlan_id != 0xffff)
-               __vlan_hwaccel_put_tag(skb, vlan_id);
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_id);
        napi_gro_frags(napi);
 }
 
@@ -1574,7 +1574,7 @@ static void ql_process_mac_rx_page(struct ql_adapter *qdev,
 
        skb_record_rx_queue(skb, rx_ring->cq_id);
        if (vlan_id != 0xffff)
-               __vlan_hwaccel_put_tag(skb, vlan_id);
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_id);
        if (skb->ip_summed == CHECKSUM_UNNECESSARY)
                napi_gro_receive(napi, skb);
        else
@@ -1670,7 +1670,7 @@ static void ql_process_mac_rx_skb(struct ql_adapter *qdev,
 
        skb_record_rx_queue(skb, rx_ring->cq_id);
        if (vlan_id != 0xffff)
-               __vlan_hwaccel_put_tag(skb, vlan_id);
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_id);
        if (skb->ip_summed == CHECKSUM_UNNECESSARY)
                napi_gro_receive(&rx_ring->napi, skb);
        else
@@ -1975,7 +1975,7 @@ static void ql_process_mac_split_rx_intr(struct ql_adapter *qdev,
        rx_ring->rx_bytes += skb->len;
        skb_record_rx_queue(skb, rx_ring->cq_id);
        if ((ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_V) && (vlan_id != 0))
-               __vlan_hwaccel_put_tag(skb, vlan_id);
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_id);
        if (skb->ip_summed == CHECKSUM_UNNECESSARY)
                napi_gro_receive(&rx_ring->napi, skb);
        else
index 6d03b52e56f1ddc72a8490ceaac6a85f5bf9d161..7d1fb9ad1296e5825da2d845129ef38b51728cd7 100644 (file)
@@ -431,7 +431,7 @@ static inline void cp_rx_skb (struct cp_private *cp, struct sk_buff *skb,
        cp->dev->stats.rx_bytes += skb->len;
 
        if (opts2 & RxVlanTagged)
-               __vlan_hwaccel_put_tag(skb, swab16(opts2 & 0xffff));
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), swab16(opts2 & 0xffff));
 
        napi_gro_receive(&cp->napi, skb);
 }
index 86d5d7909d102ca58d6c5f85ce739aa0dd46195a..c6dac38fd9ccf0a56a8cfa45316e0b2c020659d5 100644 (file)
@@ -1843,7 +1843,7 @@ static void rtl8169_rx_vlan_tag(struct RxDesc *desc, struct sk_buff *skb)
        u32 opts2 = le32_to_cpu(desc->opts2);
 
        if (opts2 & RxVlanTag)
-               __vlan_hwaccel_put_tag(skb, swab16(opts2 & 0xffff));
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), swab16(opts2 & 0xffff));
 }
 
 static int rtl8169_gset_tbi(struct net_device *dev, struct ethtool_cmd *cmd)
index f7050c573519245381db1acd71a02092d3b8a1b1..571452e786d5103460180e54481cd11ae88e4927 100644 (file)
@@ -1148,7 +1148,7 @@ NETIF_RX_MUX(struct bdx_priv *priv, u32 rxd_val1, u16 rxd_vlan,
                    priv->ndev->name,
                    GET_RXD_VLAN_ID(rxd_vlan),
                    GET_RXD_VTAG(rxd_val1));
-               __vlan_hwaccel_put_tag(skb, GET_RXD_VLAN_TCI(rxd_vlan));
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), GET_RXD_VLAN_TCI(rxd_vlan));
        }
        netif_receive_skb(skb);
 }
index c6014916f622af8f3649f43aa22b0a939e0250f7..ca98acabf1b43b29b6f27c547fbbb0c5277b2e8a 100644 (file)
@@ -1936,7 +1936,7 @@ static int rhine_rx(struct net_device *dev, int limit)
                        skb->protocol = eth_type_trans(skb, dev);
 
                        if (unlikely(desc_length & DescTag))
-                               __vlan_hwaccel_put_tag(skb, vlan_tci);
+                               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tci);
                        netif_receive_skb(skb);
 
                        u64_stats_update_begin(&rp->rx_stats.syncp);
index 91cd59146c242da0b0f1e3ab48b4e29ef25740bb..fb6248956ee26ec55c8c4cbcd853fc721c74e1d7 100644 (file)
@@ -2080,7 +2080,7 @@ static int velocity_receive_frame(struct velocity_info *vptr, int idx)
        if (rd->rdesc0.RSR & RSR_DETAG) {
                u16 vid = swab16(le16_to_cpu(rd->rdesc1.PQTAG));
 
-               __vlan_hwaccel_put_tag(skb, vid);
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
        }
        netif_rx(skb);
 
index b7e9cd7ca6d53c46c4bb6f42c899cc78584419ca..cc6dfe4102fd4f21ed2df0927318003c09e4f66d 100644 (file)
@@ -221,7 +221,7 @@ static struct sk_buff *cdc_mbim_process_dgram(struct usbnet *dev, u8 *buf, size_
 
        /* map MBIM session to VLAN */
        if (tci)
-               vlan_put_tag(skb, tci);
+               vlan_put_tag(skb, htons(ETH_P_8021Q), tci);
 err:
        return skb;
 }
index 27b889992ab88019dad78b548c0689ef1d6ab058..55a62cae2cb4c976388a9b67dc20ad5c15832604 100644 (file)
@@ -1293,7 +1293,7 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
                        skb->protocol = eth_type_trans(skb, adapter->netdev);
 
                        if (unlikely(rcd->ts))
-                               __vlan_hwaccel_put_tag(skb, rcd->tci);
+                               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), rcd->tci);
 
                        if (adapter->netdev->features & NETIF_F_LRO)
                                netif_receive_skb(skb);
index 2c9fb65f826709880d47a3339686612c66c4779f..8086ff9988b10b73113137871a7a0cc908b63e57 100644 (file)
@@ -157,9 +157,18 @@ static inline bool vlan_uses_dev(const struct net_device *dev)
 }
 #endif
 
+static inline bool vlan_hw_offload_capable(netdev_features_t features,
+                                          __be16 proto)
+{
+       if (proto == htons(ETH_P_8021Q) && features & NETIF_F_HW_VLAN_CTAG_TX)
+               return true;
+       return false;
+}
+
 /**
  * vlan_insert_tag - regular VLAN tag inserting
  * @skb: skbuff to tag
+ * @vlan_proto: VLAN encapsulation protocol
  * @vlan_tci: VLAN TCI to insert
  *
  * Inserts the VLAN tag into @skb as part of the payload
@@ -170,7 +179,8 @@ static inline bool vlan_uses_dev(const struct net_device *dev)
  *
  * Does not change skb->protocol so this function can be used during receive.
  */
-static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci)
+static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb,
+                                             __be16 vlan_proto, u16 vlan_tci)
 {
        struct vlan_ethhdr *veth;
 
@@ -185,7 +195,7 @@ static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci)
        skb->mac_header -= VLAN_HLEN;
 
        /* first, the ethernet type */
-       veth->h_vlan_proto = htons(ETH_P_8021Q);
+       veth->h_vlan_proto = vlan_proto;
 
        /* now, the TCI */
        veth->h_vlan_TCI = htons(vlan_tci);
@@ -204,24 +214,28 @@ static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci)
  * Following the skb_unshare() example, in case of error, the calling function
  * doesn't have to worry about freeing the original skb.
  */
-static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci)
+static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb,
+                                            __be16 vlan_proto, u16 vlan_tci)
 {
-       skb = vlan_insert_tag(skb, vlan_tci);
+       skb = vlan_insert_tag(skb, vlan_proto, vlan_tci);
        if (skb)
-               skb->protocol = htons(ETH_P_8021Q);
+               skb->protocol = vlan_proto;
        return skb;
 }
 
 /**
  * __vlan_hwaccel_put_tag - hardware accelerated VLAN inserting
  * @skb: skbuff to tag
+ * @vlan_proto: VLAN encapsulation protocol
  * @vlan_tci: VLAN TCI to insert
  *
  * Puts the VLAN TCI in @skb->vlan_tci and lets the device do the rest
  */
 static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb,
+                                                    __be16 vlan_proto,
                                                     u16 vlan_tci)
 {
+       skb->vlan_proto = vlan_proto;
        skb->vlan_tci = VLAN_TAG_PRESENT | vlan_tci;
        return skb;
 }
@@ -236,12 +250,13 @@ static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb,
  * Assumes skb->dev is the target that will xmit this frame.
  * Returns a VLAN tagged skb.
  */
-static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb, u16 vlan_tci)
+static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb,
+                                          __be16 vlan_proto, u16 vlan_tci)
 {
-       if (skb->dev->features & NETIF_F_HW_VLAN_CTAG_TX) {
-               return __vlan_hwaccel_put_tag(skb, vlan_tci);
+       if (vlan_hw_offload_capable(skb->dev->features, vlan_proto)) {
+               return __vlan_hwaccel_put_tag(skb, vlan_proto, vlan_tci);
        } else {
-               return __vlan_put_tag(skb, vlan_tci);
+               return __vlan_put_tag(skb, vlan_proto, vlan_tci);
        }
 }
 
index e27d1c782f32aa079aa92c32f0d523e46ba5af98..f5bed7b319547f4c147e6d38230bc93363411d5f 100644 (file)
@@ -387,6 +387,7 @@ typedef unsigned char *sk_buff_data_t;
  *     @secmark: security marking
  *     @mark: Generic packet mark
  *     @dropcount: total number of sk_receive_queue overflows
+ *     @vlan_proto: vlan encapsulation protocol
  *     @vlan_tci: vlan tag control information
  *     @inner_transport_header: Inner transport layer header (encapsulation)
  *     @inner_network_header: Network layer header (encapsulation)
@@ -465,6 +466,7 @@ struct sk_buff {
 
        __u32                   rxhash;
 
+       __be16                  vlan_proto;
        __u16                   vlan_tci;
 
 #ifdef CONFIG_NET_SCHED
index 4e4c360353ea94fe0496d61db1b11b0684a35185..bdb0b9d2e9cfbdc0c914d0233fbaf44f2b67821e 100644 (file)
@@ -8,11 +8,12 @@
 bool vlan_do_receive(struct sk_buff **skbp)
 {
        struct sk_buff *skb = *skbp;
+       __be16 vlan_proto = skb->vlan_proto;
        u16 vlan_id = skb->vlan_tci & VLAN_VID_MASK;
        struct net_device *vlan_dev;
        struct vlan_pcpu_stats *rx_stats;
 
-       vlan_dev = vlan_find_dev(skb->dev, htons(ETH_P_8021Q), vlan_id);
+       vlan_dev = vlan_find_dev(skb->dev, vlan_proto, vlan_id);
        if (!vlan_dev)
                return false;
 
@@ -38,7 +39,8 @@ bool vlan_do_receive(struct sk_buff **skbp)
                 * original position later
                 */
                skb_push(skb, offset);
-               skb = *skbp = vlan_insert_tag(skb, skb->vlan_tci);
+               skb = *skbp = vlan_insert_tag(skb, skb->vlan_proto,
+                                             skb->vlan_tci);
                if (!skb)
                        return false;
                skb_pull(skb, offset + VLAN_HLEN);
@@ -127,7 +129,7 @@ struct sk_buff *vlan_untag(struct sk_buff *skb)
 
        vhdr = (struct vlan_hdr *) skb->data;
        vlan_tci = ntohs(vhdr->h_vlan_TCI);
-       __vlan_hwaccel_put_tag(skb, vlan_tci);
+       __vlan_hwaccel_put_tag(skb, skb->protocol, vlan_tci);
 
        skb_pull_rcsum(skb, VLAN_HLEN);
        vlan_set_encap_proto(skb, vhdr);
index d7457b7e1b95b4a3ec8e2d689bd7c30125b724ac..8af508536d36b539117ffeecfc8e7b47200bd72d 100644 (file)
@@ -167,7 +167,7 @@ static netdev_tx_t vlan_dev_hard_start_xmit(struct sk_buff *skb,
                u16 vlan_tci;
                vlan_tci = vlan->vlan_id;
                vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb);
-               skb = __vlan_hwaccel_put_tag(skb, vlan_tci);
+               skb = __vlan_hwaccel_put_tag(skb, vlan->vlan_proto, vlan_tci);
        }
 
        skb->dev = vlan->real_dev;
index 6a4f728680ae5c347f74c7930bf5c0d672c5f6bc..379061c725491ec0801940265aedd21245e4ccf1 100644 (file)
@@ -341,7 +341,7 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, uint8_t *mac,
        }
 
        if (vid != -1)
-               skb = vlan_insert_tag(skb, vid);
+               skb = vlan_insert_tag(skb, htons(ETH_P_8021Q), vid);
 
        skb_reset_mac_header(skb);
        skb->protocol = eth_type_trans(skb, soft_iface);
index bd61bf5159c981e133d7989f3da003d1dd733bcd..1ed75bfd8d1d72f6ae89bef20191eb824d3aac6c 100644 (file)
@@ -535,7 +535,7 @@ static struct net_device *brnf_get_logical_dev(struct sk_buff *skb, const struct
        if (brnf_pass_vlan_indev == 0 || !vlan_tx_tag_present(skb))
                return br;
 
-       vlan = __vlan_find_dev_deep(br, htons(ETH_P_8021Q),
+       vlan = __vlan_find_dev_deep(br, skb->vlan_proto,
                                    vlan_tx_tag_get(skb) & VLAN_VID_MASK);
 
        return vlan ? vlan : br;
index c3076e2c429401f2ff1159e029471a2d09b57903..bd58b45f5f901fd4c6a3ad00abe068baeba8d898 100644 (file)
@@ -175,7 +175,7 @@ struct sk_buff *br_handle_vlan(struct net_bridge *br,
                         * mac header.
                         */
                        skb_push(skb, ETH_HLEN);
-                       skb = __vlan_put_tag(skb, skb->vlan_tci);
+                       skb = __vlan_put_tag(skb, skb->vlan_proto, skb->vlan_tci);
                        if (!skb)
                                goto out;
                        /* put skb->data back to where it was */
@@ -217,7 +217,7 @@ bool br_allowed_ingress(struct net_bridge *br, struct net_port_vlans *v,
                /* PVID is set on this port.  Any untagged ingress
                 * frame is considered to belong to this vlan.
                 */
-               __vlan_hwaccel_put_tag(skb, pvid);
+               __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), pvid);
                return true;
        }
 
index 07a8e9dc43fc784d8e3c31234dce066f7935e536..3a12ee132b596869336c8eadc24dd3e155377ab1 100644 (file)
@@ -2482,8 +2482,9 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
                features = netif_skb_features(skb);
 
                if (vlan_tx_tag_present(skb) &&
-                   !(features & NETIF_F_HW_VLAN_CTAG_TX)) {
-                       skb = __vlan_put_tag(skb, vlan_tx_tag_get(skb));
+                   !vlan_hw_offload_capable(features, skb->vlan_proto)) {
+                       skb = __vlan_put_tag(skb, skb->vlan_proto,
+                                            vlan_tx_tag_get(skb));
                        if (unlikely(!skb))
                                goto out;
 
index 8de961e67cf7d5df9d150fa8c92bd0d789237a08..209d84253dd50ae02b2b9f2b616cc7ff8d013efe 100644 (file)
@@ -383,8 +383,9 @@ void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb,
                        if (__netif_tx_trylock(txq)) {
                                if (!netif_xmit_stopped(txq)) {
                                        if (vlan_tx_tag_present(skb) &&
-                                           !(netif_skb_features(skb) & NETIF_F_HW_VLAN_CTAG_TX)) {
-                                               skb = __vlan_put_tag(skb, vlan_tx_tag_get(skb));
+                                           !vlan_hw_offload_capable(netif_skb_features(skb),
+                                                                    skb->vlan_proto)) {
+                                               skb = __vlan_put_tag(skb, skb->vlan_proto, vlan_tx_tag_get(skb));
                                                if (unlikely(!skb))
                                                        break;
                                                skb->vlan_tci = 0;
index ba646145cd5c2b00c7a6b975c2ee6b5c819f0606..a92d9e7d10f7fc6baa7cf96c12b29d8075042fcc 100644 (file)
@@ -707,6 +707,7 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
        new->tc_verd            = old->tc_verd;
 #endif
 #endif
+       new->vlan_proto         = old->vlan_proto;
        new->vlan_tci           = old->vlan_tci;
 
        skb_copy_secmark(new, old);
index d4d5363c7ba7868731cb9188ad9bc5ccd28b8304..894b6cbdd9295841e6782268b8743fcb63358391 100644 (file)
@@ -98,7 +98,7 @@ static int pop_vlan(struct sk_buff *skb)
        if (unlikely(err))
                return err;
 
-       __vlan_hwaccel_put_tag(skb, ntohs(tci));
+       __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(tci));
        return 0;
 }
 
@@ -110,7 +110,7 @@ static int push_vlan(struct sk_buff *skb, const struct ovs_action_push_vlan *vla
                /* push down current VLAN tag */
                current_tag = vlan_tx_tag_get(skb);
 
-               if (!__vlan_put_tag(skb, current_tag))
+               if (!__vlan_put_tag(skb, skb->vlan_proto, current_tag))
                        return -ENOMEM;
 
                if (skb->ip_summed == CHECKSUM_COMPLETE)
@@ -118,7 +118,7 @@ static int push_vlan(struct sk_buff *skb, const struct ovs_action_push_vlan *vla
                                        + (2 * ETH_ALEN), VLAN_HLEN, 0));
 
        }
-       __vlan_hwaccel_put_tag(skb, ntohs(vlan->vlan_tci) & ~VLAN_TAG_PRESENT);
+       __vlan_hwaccel_put_tag(skb, vlan->vlan_tpid, ntohs(vlan->vlan_tci) & ~VLAN_TAG_PRESENT);
        return 0;
 }
 
index b7d0b7c3fe2c35234966b499a8e0d31229f3b1e6..7bb5d4f6bb9097c1ad2d2eb877790fdac1c3e39b 100644 (file)
@@ -401,7 +401,7 @@ static int queue_userspace_packet(struct net *net, int dp_ifindex,
                if (!nskb)
                        return -ENOMEM;
 
-               nskb = __vlan_put_tag(nskb, vlan_tx_tag_get(nskb));
+               nskb = __vlan_put_tag(nskb, nskb->vlan_proto, vlan_tx_tag_get(nskb));
                if (!nskb)
                        return -ENOMEM;