aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-04-19 14:46:27 -0400
committerDavid S. Miller <davem@davemloft.net>2013-04-19 14:46:27 -0400
commit447b816fe03898c4dad19b254ca3dd05bae46ec3 (patch)
tree9e3d6af491b1a01b077b927e51d513134e67e1a5
parentc2962897c94605bc8f158a37dee8d867dda9f116 (diff)
parent28d2b136ca6c7bf7173a43a90f747ecda5b0520d (diff)
Merge branch '8021ad'
Patrick McHardy says: ==================== The following patches add support for 802.1ad (provider tagging) to the VLAN driver. The patchset consists of the following parts: - renaming of the NET_F_HW_VLAN feature flags to indicate that they only operate on CTAGs - preparation for 802.1ad VLAN filtering offload by adding a proto argument to the rx_{add,kill}_vid net_device_ops callbacks - preparation of the VLAN code to support multiple protocols by making the protocol used for tagging a property of the VLAN device and converting the device lookup functions accordingly - second step of preparation of the VLAN code by making the packet tagging functions take a protocol argument - introducation of 802.1ad support in the VLAN code, consisting mainly of checking for ETH_P_8021AD in a couple of places and testing the netdevice offload feature checks to take the protocol into account - announcement of STAG offloading capabilities in a couple of drivers for virtual network devices The patchset is based on net-next.git and has been tested with single and double tagging with and without HW acceleration (for CTAGs). ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/infiniband/hw/nes/nes_hw.c2
-rw-r--r--drivers/infiniband/hw/nes/nes_nic.c14
-rw-r--r--drivers/net/bonding/bond_alb.c4
-rw-r--r--drivers/net/bonding/bond_main.c31
-rw-r--r--drivers/net/ethernet/3com/typhoon.c6
-rw-r--r--drivers/net/ethernet/adaptec/starfire.c10
-rw-r--r--drivers/net/ethernet/alteon/acenic.c4
-rw-r--r--drivers/net/ethernet/amd/amd8111e.c6
-rw-r--r--drivers/net/ethernet/atheros/atl1c/atl1c_main.c24
-rw-r--r--drivers/net/ethernet/atheros/atl1e/atl1e_main.c16
-rw-r--r--drivers/net/ethernet/atheros/atlx/atl1.c6
-rw-r--r--drivers/net/ethernet/atheros/atlx/atl2.c18
-rw-r--r--drivers/net/ethernet/atheros/atlx/atlx.c10
-rw-r--r--drivers/net/ethernet/broadcom/bnx2.c12
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c4
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c4
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c4
-rw-r--r--drivers/net/ethernet/brocade/bna/bnad.c12
-rw-r--r--drivers/net/ethernet/chelsio/cxgb/cxgb2.c13
-rw-r--r--drivers/net/ethernet/chelsio/cxgb/sge.c4
-rw-r--r--drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c20
-rw-r--r--drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c2
-rw-r--r--drivers/net/ethernet/chelsio/cxgb3/sge.c4
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c10
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/sge.c4
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c15
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4vf/sge.c5
-rw-r--r--drivers/net/ethernet/cisco/enic/enic_dev.c4
-rw-r--r--drivers/net/ethernet/cisco/enic/enic_dev.h4
-rw-r--r--drivers/net/ethernet/cisco/enic/enic_main.c6
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c14
-rw-r--r--drivers/net/ethernet/freescale/gianfar.c15
-rw-r--r--drivers/net/ethernet/freescale/gianfar_ethtool.c2
-rw-r--r--drivers/net/ethernet/ibm/ehea/ehea_main.c12
-rw-r--r--drivers/net/ethernet/intel/e1000/e1000_main.c40
-rw-r--r--drivers/net/ethernet/intel/e1000e/netdev.c32
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c32
-rw-r--r--drivers/net/ethernet/intel/igbvf/netdev.c16
-rw-r--r--drivers/net/ethernet/intel/ixgb/ixgb_main.c30
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c24
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c2
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c17
-rw-r--r--drivers/net/ethernet/jme.c6
-rw-r--r--drivers/net/ethernet/marvell/sky2.c11
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_netdev.c10
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_rx.c4
-rw-r--r--drivers/net/ethernet/myricom/myri10ge/myri10ge.c9
-rw-r--r--drivers/net/ethernet/natsemi/ns83820.c4
-rw-r--r--drivers/net/ethernet/neterion/s2io.c4
-rw-r--r--drivers/net/ethernet/neterion/vxge/vxge-main.c14
-rw-r--r--drivers/net/ethernet/nvidia/forcedeth.c22
-rw-r--r--drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c2
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c8
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c14
-rw-r--r--drivers/net/ethernet/qlogic/qlge/qlge_main.c28
-rw-r--r--drivers/net/ethernet/realtek/8139cp.c8
-rw-r--r--drivers/net/ethernet/realtek/r8169.c16
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c8
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c2
-rw-r--r--drivers/net/ethernet/tehuti/tehuti.c12
-rw-r--r--drivers/net/ethernet/ti/cpsw.c8
-rw-r--r--drivers/net/ethernet/toshiba/spider_net.c4
-rw-r--r--drivers/net/ethernet/via/via-rhine.c17
-rw-r--r--drivers/net/ethernet/via/via-velocity.c15
-rw-r--r--drivers/net/ethernet/xilinx/ll_temac_main.c6
-rw-r--r--drivers/net/hyperv/netvsc_drv.c2
-rw-r--r--drivers/net/ifb.c3
-rw-r--r--drivers/net/macvlan.c10
-rw-r--r--drivers/net/team/team.c16
-rw-r--r--drivers/net/usb/cdc_mbim.c4
-rw-r--r--drivers/net/veth.c3
-rw-r--r--drivers/net/virtio_net.c8
-rw-r--r--drivers/net/vmxnet3/vmxnet3_drv.c17
-rw-r--r--drivers/net/vmxnet3/vmxnet3_ethtool.c5
-rw-r--r--drivers/s390/net/qeth_l2_main.c8
-rw-r--r--drivers/s390/net/qeth_l3_main.c12
-rw-r--r--drivers/scsi/fcoe/fcoe.c2
-rw-r--r--include/linux/if_vlan.h47
-rw-r--r--include/linux/netdev_features.h18
-rw-r--r--include/linux/netdevice.h14
-rw-r--r--include/linux/skbuff.h2
-rw-r--r--include/uapi/linux/if_link.h1
-rw-r--r--net/8021q/Kconfig2
-rw-r--r--net/8021q/vlan.c97
-rw-r--r--net/8021q/vlan.h57
-rw-r--r--net/8021q/vlan_core.c73
-rw-r--r--net/8021q/vlan_dev.c11
-rw-r--r--net/8021q/vlan_gvrp.c4
-rw-r--r--net/8021q/vlan_mvrp.c4
-rw-r--r--net/8021q/vlan_netlink.c32
-rw-r--r--net/batman-adv/bridge_loop_avoidance.c2
-rw-r--r--net/bridge/br_device.c4
-rw-r--r--net/bridge/br_netfilter.c3
-rw-r--r--net/bridge/br_vlan.c20
-rw-r--r--net/core/dev.c24
-rw-r--r--net/core/ethtool.c25
-rw-r--r--net/core/netpoll.c5
-rw-r--r--net/core/skbuff.c1
-rw-r--r--net/openvswitch/actions.c6
-rw-r--r--net/openvswitch/datapath.c2
-rw-r--r--net/openvswitch/vport-internal_dev.c2
101 files changed, 726 insertions, 566 deletions
diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c
index 67647e264611..418004c93feb 100644
--- a/drivers/infiniband/hw/nes/nes_hw.c
+++ b/drivers/infiniband/hw/nes/nes_hw.c
@@ -2948,7 +2948,7 @@ void nes_nic_ce_handler(struct nes_device *nesdev, struct nes_hw_nic_cq *cq)
2948 nes_debug(NES_DBG_CQ, "%s: Reporting stripped VLAN packet. Tag = 0x%04X\n", 2948 nes_debug(NES_DBG_CQ, "%s: Reporting stripped VLAN packet. Tag = 0x%04X\n",
2949 nesvnic->netdev->name, vlan_tag); 2949 nesvnic->netdev->name, vlan_tag);
2950 2950
2951 __vlan_hwaccel_put_tag(rx_skb, vlan_tag); 2951 __vlan_hwaccel_put_tag(rx_skb, htons(ETH_P_8021Q), vlan_tag);
2952 } 2952 }
2953 if (nes_use_lro) 2953 if (nes_use_lro)
2954 lro_receive_skb(&nesvnic->lro_mgr, rx_skb, NULL); 2954 lro_receive_skb(&nesvnic->lro_mgr, rx_skb, NULL);
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c
index 85cf4d1ac442..49eb5111d2cd 100644
--- a/drivers/infiniband/hw/nes/nes_nic.c
+++ b/drivers/infiniband/hw/nes/nes_nic.c
@@ -1599,7 +1599,7 @@ static void nes_vlan_mode(struct net_device *netdev, struct nes_device *nesdev,
1599 1599
1600 /* Enable/Disable VLAN Stripping */ 1600 /* Enable/Disable VLAN Stripping */
1601 u32temp = nes_read_indexed(nesdev, NES_IDX_PCIX_DIAG); 1601 u32temp = nes_read_indexed(nesdev, NES_IDX_PCIX_DIAG);
1602 if (features & NETIF_F_HW_VLAN_RX) 1602 if (features & NETIF_F_HW_VLAN_CTAG_RX)
1603 u32temp &= 0xfdffffff; 1603 u32temp &= 0xfdffffff;
1604 else 1604 else
1605 u32temp |= 0x02000000; 1605 u32temp |= 0x02000000;
@@ -1614,10 +1614,10 @@ static netdev_features_t nes_fix_features(struct net_device *netdev, netdev_feat
1614 * Since there is no support for separate rx/tx vlan accel 1614 * Since there is no support for separate rx/tx vlan accel
1615 * enable/disable make sure tx flag is always in same state as rx. 1615 * enable/disable make sure tx flag is always in same state as rx.
1616 */ 1616 */
1617 if (features & NETIF_F_HW_VLAN_RX) 1617 if (features & NETIF_F_HW_VLAN_CTAG_RX)
1618 features |= NETIF_F_HW_VLAN_TX; 1618 features |= NETIF_F_HW_VLAN_CTAG_TX;
1619 else 1619 else
1620 features &= ~NETIF_F_HW_VLAN_TX; 1620 features &= ~NETIF_F_HW_VLAN_CTAG_TX;
1621 1621
1622 return features; 1622 return features;
1623} 1623}
@@ -1628,7 +1628,7 @@ static int nes_set_features(struct net_device *netdev, netdev_features_t feature
1628 struct nes_device *nesdev = nesvnic->nesdev; 1628 struct nes_device *nesdev = nesvnic->nesdev;
1629 u32 changed = netdev->features ^ features; 1629 u32 changed = netdev->features ^ features;
1630 1630
1631 if (changed & NETIF_F_HW_VLAN_RX) 1631 if (changed & NETIF_F_HW_VLAN_CTAG_RX)
1632 nes_vlan_mode(netdev, nesdev, features); 1632 nes_vlan_mode(netdev, nesdev, features);
1633 1633
1634 return 0; 1634 return 0;
@@ -1706,11 +1706,11 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
1706 netdev->dev_addr[4] = (u8)(u64temp>>8); 1706 netdev->dev_addr[4] = (u8)(u64temp>>8);
1707 netdev->dev_addr[5] = (u8)u64temp; 1707 netdev->dev_addr[5] = (u8)u64temp;
1708 1708
1709 netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_RX; 1709 netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX;
1710 if ((nesvnic->logical_port < 2) || (nesdev->nesadapter->hw_rev != NE020_REV)) 1710 if ((nesvnic->logical_port < 2) || (nesdev->nesadapter->hw_rev != NE020_REV))
1711 netdev->hw_features |= NETIF_F_TSO; 1711 netdev->hw_features |= NETIF_F_TSO;
1712 1712
1713 netdev->features = netdev->hw_features | NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_TX; 1713 netdev->features = netdev->hw_features | NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_CTAG_TX;
1714 netdev->hw_features |= NETIF_F_LRO; 1714 netdev->hw_features |= NETIF_F_LRO;
1715 1715
1716 nes_debug(NES_DBG_INIT, "nesvnic = %p, reported features = 0x%lX, QPid = %d," 1716 nes_debug(NES_DBG_INIT, "nesvnic = %p, reported features = 0x%lX, QPid = %d,"
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index f5e052723029..e02cc265723a 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -514,7 +514,7 @@ static void rlb_update_client(struct rlb_client_info *client_info)
514 skb->dev = client_info->slave->dev; 514 skb->dev = client_info->slave->dev;
515 515
516 if (client_info->tag) { 516 if (client_info->tag) {
517 skb = vlan_put_tag(skb, client_info->vlan_id); 517 skb = vlan_put_tag(skb, htons(ETH_P_8021Q), client_info->vlan_id);
518 if (!skb) { 518 if (!skb) {
519 pr_err("%s: Error: failed to insert VLAN tag\n", 519 pr_err("%s: Error: failed to insert VLAN tag\n",
520 client_info->slave->bond->dev->name); 520 client_info->slave->bond->dev->name);
@@ -1014,7 +1014,7 @@ static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[])
1014 continue; 1014 continue;
1015 } 1015 }
1016 1016
1017 skb = vlan_put_tag(skb, vlan->vlan_id); 1017 skb = vlan_put_tag(skb, htons(ETH_P_8021Q), vlan->vlan_id);
1018 if (!skb) { 1018 if (!skb) {
1019 pr_err("%s: Error: failed to insert VLAN tag\n", 1019 pr_err("%s: Error: failed to insert VLAN tag\n",
1020 bond->dev->name); 1020 bond->dev->name);
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 2aac890320cb..1e79a7643f08 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -428,14 +428,15 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb,
428 * @bond_dev: bonding net device that got called 428 * @bond_dev: bonding net device that got called
429 * @vid: vlan id being added 429 * @vid: vlan id being added
430 */ 430 */
431static int bond_vlan_rx_add_vid(struct net_device *bond_dev, uint16_t vid) 431static int bond_vlan_rx_add_vid(struct net_device *bond_dev,
432 __be16 proto, u16 vid)
432{ 433{
433 struct bonding *bond = netdev_priv(bond_dev); 434 struct bonding *bond = netdev_priv(bond_dev);
434 struct slave *slave, *stop_at; 435 struct slave *slave, *stop_at;
435 int i, res; 436 int i, res;
436 437
437 bond_for_each_slave(bond, slave, i) { 438 bond_for_each_slave(bond, slave, i) {
438 res = vlan_vid_add(slave->dev, vid); 439 res = vlan_vid_add(slave->dev, proto, vid);
439 if (res) 440 if (res)
440 goto unwind; 441 goto unwind;
441 } 442 }
@@ -453,7 +454,7 @@ unwind:
453 /* unwind from head to the slave that failed */ 454 /* unwind from head to the slave that failed */
454 stop_at = slave; 455 stop_at = slave;
455 bond_for_each_slave_from_to(bond, slave, i, bond->first_slave, stop_at) 456 bond_for_each_slave_from_to(bond, slave, i, bond->first_slave, stop_at)
456 vlan_vid_del(slave->dev, vid); 457 vlan_vid_del(slave->dev, proto, vid);
457 458
458 return res; 459 return res;
459} 460}
@@ -463,14 +464,15 @@ unwind:
463 * @bond_dev: bonding net device that got called 464 * @bond_dev: bonding net device that got called
464 * @vid: vlan id being removed 465 * @vid: vlan id being removed
465 */ 466 */
466static int bond_vlan_rx_kill_vid(struct net_device *bond_dev, uint16_t vid) 467static int bond_vlan_rx_kill_vid(struct net_device *bond_dev,
468 __be16 proto, u16 vid)
467{ 469{
468 struct bonding *bond = netdev_priv(bond_dev); 470 struct bonding *bond = netdev_priv(bond_dev);
469 struct slave *slave; 471 struct slave *slave;
470 int i, res; 472 int i, res;
471 473
472 bond_for_each_slave(bond, slave, i) 474 bond_for_each_slave(bond, slave, i)
473 vlan_vid_del(slave->dev, vid); 475 vlan_vid_del(slave->dev, proto, vid);
474 476
475 res = bond_del_vlan(bond, vid); 477 res = bond_del_vlan(bond, vid);
476 if (res) { 478 if (res) {
@@ -488,7 +490,8 @@ static void bond_add_vlans_on_slave(struct bonding *bond, struct net_device *sla
488 int res; 490 int res;
489 491
490 list_for_each_entry(vlan, &bond->vlan_list, vlan_list) { 492 list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
491 res = vlan_vid_add(slave_dev, vlan->vlan_id); 493 res = vlan_vid_add(slave_dev, htons(ETH_P_8021Q),
494 vlan->vlan_id);
492 if (res) 495 if (res)
493 pr_warning("%s: Failed to add vlan id %d to device %s\n", 496 pr_warning("%s: Failed to add vlan id %d to device %s\n",
494 bond->dev->name, vlan->vlan_id, 497 bond->dev->name, vlan->vlan_id,
@@ -504,7 +507,7 @@ static void bond_del_vlans_from_slave(struct bonding *bond,
504 list_for_each_entry(vlan, &bond->vlan_list, vlan_list) { 507 list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
505 if (!vlan->vlan_id) 508 if (!vlan->vlan_id)
506 continue; 509 continue;
507 vlan_vid_del(slave_dev, vlan->vlan_id); 510 vlan_vid_del(slave_dev, htons(ETH_P_8021Q), vlan->vlan_id);
508 } 511 }
509} 512}
510 513
@@ -779,7 +782,7 @@ static void bond_resend_igmp_join_requests(struct bonding *bond)
779 782
780 /* rejoin all groups on vlan devices */ 783 /* rejoin all groups on vlan devices */
781 list_for_each_entry(vlan, &bond->vlan_list, vlan_list) { 784 list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
782 vlan_dev = __vlan_find_dev_deep(bond_dev, 785 vlan_dev = __vlan_find_dev_deep(bond_dev, htons(ETH_P_8021Q),
783 vlan->vlan_id); 786 vlan->vlan_id);
784 if (vlan_dev) 787 if (vlan_dev)
785 __bond_resend_igmp_join_requests(vlan_dev); 788 __bond_resend_igmp_join_requests(vlan_dev);
@@ -2509,7 +2512,8 @@ static int bond_has_this_ip(struct bonding *bond, __be32 ip)
2509 2512
2510 list_for_each_entry(vlan, &bond->vlan_list, vlan_list) { 2513 list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
2511 rcu_read_lock(); 2514 rcu_read_lock();
2512 vlan_dev = __vlan_find_dev_deep(bond->dev, vlan->vlan_id); 2515 vlan_dev = __vlan_find_dev_deep(bond->dev, htons(ETH_P_8021Q),
2516 vlan->vlan_id);
2513 rcu_read_unlock(); 2517 rcu_read_unlock();
2514 if (vlan_dev && ip == bond_confirm_addr(vlan_dev, 0, ip)) 2518 if (vlan_dev && ip == bond_confirm_addr(vlan_dev, 0, ip))
2515 return 1; 2519 return 1;
@@ -2538,7 +2542,7 @@ static void bond_arp_send(struct net_device *slave_dev, int arp_op, __be32 dest_
2538 return; 2542 return;
2539 } 2543 }
2540 if (vlan_id) { 2544 if (vlan_id) {
2541 skb = vlan_put_tag(skb, vlan_id); 2545 skb = vlan_put_tag(skb, htons(ETH_P_8021Q), vlan_id);
2542 if (!skb) { 2546 if (!skb) {
2543 pr_err("failed to insert VLAN tag\n"); 2547 pr_err("failed to insert VLAN tag\n");
2544 return; 2548 return;
@@ -2600,6 +2604,7 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
2600 list_for_each_entry(vlan, &bond->vlan_list, vlan_list) { 2604 list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
2601 rcu_read_lock(); 2605 rcu_read_lock();
2602 vlan_dev = __vlan_find_dev_deep(bond->dev, 2606 vlan_dev = __vlan_find_dev_deep(bond->dev,
2607 htons(ETH_P_8021Q),
2603 vlan->vlan_id); 2608 vlan->vlan_id);
2604 rcu_read_unlock(); 2609 rcu_read_unlock();
2605 if (vlan_dev == rt->dst.dev) { 2610 if (vlan_dev == rt->dst.dev) {
@@ -4322,9 +4327,9 @@ static void bond_setup(struct net_device *bond_dev)
4322 */ 4327 */
4323 4328
4324 bond_dev->hw_features = BOND_VLAN_FEATURES | 4329 bond_dev->hw_features = BOND_VLAN_FEATURES |
4325 NETIF_F_HW_VLAN_TX | 4330 NETIF_F_HW_VLAN_CTAG_TX |
4326 NETIF_F_HW_VLAN_RX | 4331 NETIF_F_HW_VLAN_CTAG_RX |
4327 NETIF_F_HW_VLAN_FILTER; 4332 NETIF_F_HW_VLAN_CTAG_FILTER;
4328 4333
4329 bond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM); 4334 bond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM);
4330 bond_dev->features |= bond_dev->hw_features; 4335 bond_dev->features |= bond_dev->hw_features;
diff --git a/drivers/net/ethernet/3com/typhoon.c b/drivers/net/ethernet/3com/typhoon.c
index 27aaaf99e73e..144942f6372b 100644
--- a/drivers/net/ethernet/3com/typhoon.c
+++ b/drivers/net/ethernet/3com/typhoon.c
@@ -1690,7 +1690,7 @@ typhoon_rx(struct typhoon *tp, struct basic_ring *rxRing, volatile __le32 * read
1690 skb_checksum_none_assert(new_skb); 1690 skb_checksum_none_assert(new_skb);
1691 1691
1692 if (rx->rxStatus & TYPHOON_RX_VLAN) 1692 if (rx->rxStatus & TYPHOON_RX_VLAN)
1693 __vlan_hwaccel_put_tag(new_skb, 1693 __vlan_hwaccel_put_tag(new_skb, htons(ETH_P_8021Q),
1694 ntohl(rx->vlanTag) & 0xffff); 1694 ntohl(rx->vlanTag) & 0xffff);
1695 netif_receive_skb(new_skb); 1695 netif_receive_skb(new_skb);
1696 1696
@@ -2445,9 +2445,9 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2445 * settings -- so we only allow the user to toggle the TX processing. 2445 * settings -- so we only allow the user to toggle the TX processing.
2446 */ 2446 */
2447 dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | 2447 dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO |
2448 NETIF_F_HW_VLAN_TX; 2448 NETIF_F_HW_VLAN_CTAG_TX;
2449 dev->features = dev->hw_features | 2449 dev->features = dev->hw_features |
2450 NETIF_F_HW_VLAN_RX | NETIF_F_RXCSUM; 2450 NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_RXCSUM;
2451 2451
2452 if(register_netdev(dev) < 0) { 2452 if(register_netdev(dev) < 0) {
2453 err_msg = "unable to register netdev"; 2453 err_msg = "unable to register netdev";
diff --git a/drivers/net/ethernet/adaptec/starfire.c b/drivers/net/ethernet/adaptec/starfire.c
index 549b77500579..8b04bfc20cfb 100644
--- a/drivers/net/ethernet/adaptec/starfire.c
+++ b/drivers/net/ethernet/adaptec/starfire.c
@@ -594,7 +594,8 @@ static const struct ethtool_ops ethtool_ops;
594 594
595 595
596#ifdef VLAN_SUPPORT 596#ifdef VLAN_SUPPORT
597static int netdev_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) 597static int netdev_vlan_rx_add_vid(struct net_device *dev,
598 __be16 proto, u16 vid)
598{ 599{
599 struct netdev_private *np = netdev_priv(dev); 600 struct netdev_private *np = netdev_priv(dev);
600 601
@@ -608,7 +609,8 @@ static int netdev_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
608 return 0; 609 return 0;
609} 610}
610 611
611static int netdev_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) 612static int netdev_vlan_rx_kill_vid(struct net_device *dev,
613 __be16 proto, u16 vid)
612{ 614{
613 struct netdev_private *np = netdev_priv(dev); 615 struct netdev_private *np = netdev_priv(dev);
614 616
@@ -702,7 +704,7 @@ static int starfire_init_one(struct pci_dev *pdev,
702#endif /* ZEROCOPY */ 704#endif /* ZEROCOPY */
703 705
704#ifdef VLAN_SUPPORT 706#ifdef VLAN_SUPPORT
705 dev->features |= NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER; 707 dev->features |= NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER;
706#endif /* VLAN_RX_KILL_VID */ 708#endif /* VLAN_RX_KILL_VID */
707#ifdef ADDR_64BITS 709#ifdef ADDR_64BITS
708 dev->features |= NETIF_F_HIGHDMA; 710 dev->features |= NETIF_F_HIGHDMA;
@@ -1496,7 +1498,7 @@ static int __netdev_rx(struct net_device *dev, int *quota)
1496 printk(KERN_DEBUG " netdev_rx() vlanid = %d\n", 1498 printk(KERN_DEBUG " netdev_rx() vlanid = %d\n",
1497 vlid); 1499 vlid);
1498 } 1500 }
1499 __vlan_hwaccel_put_tag(skb, vlid); 1501 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlid);
1500 } 1502 }
1501#endif /* VLAN_SUPPORT */ 1503#endif /* VLAN_SUPPORT */
1502 netif_receive_skb(skb); 1504 netif_receive_skb(skb);
diff --git a/drivers/net/ethernet/alteon/acenic.c b/drivers/net/ethernet/alteon/acenic.c
index c0bc41a784ca..b7894f8af9d1 100644
--- a/drivers/net/ethernet/alteon/acenic.c
+++ b/drivers/net/ethernet/alteon/acenic.c
@@ -472,7 +472,7 @@ static int acenic_probe_one(struct pci_dev *pdev,
472 ap->name = pci_name(pdev); 472 ap->name = pci_name(pdev);
473 473
474 dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; 474 dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
475 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 475 dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
476 476
477 dev->watchdog_timeo = 5*HZ; 477 dev->watchdog_timeo = 5*HZ;
478 478
@@ -2019,7 +2019,7 @@ static void ace_rx_int(struct net_device *dev, u32 rxretprd, u32 rxretcsm)
2019 2019
2020 /* send it up */ 2020 /* send it up */
2021 if ((bd_flags & BD_FLG_VLAN_TAG)) 2021 if ((bd_flags & BD_FLG_VLAN_TAG))
2022 __vlan_hwaccel_put_tag(skb, retdesc->vlan); 2022 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), retdesc->vlan);
2023 netif_rx(skb); 2023 netif_rx(skb);
2024 2024
2025 dev->stats.rx_packets++; 2025 dev->stats.rx_packets++;
diff --git a/drivers/net/ethernet/amd/amd8111e.c b/drivers/net/ethernet/amd/amd8111e.c
index 42d4e6ad58a5..8e6b665a6726 100644
--- a/drivers/net/ethernet/amd/amd8111e.c
+++ b/drivers/net/ethernet/amd/amd8111e.c
@@ -793,7 +793,7 @@ static int amd8111e_rx_poll(struct napi_struct *napi, int budget)
793#if AMD8111E_VLAN_TAG_USED 793#if AMD8111E_VLAN_TAG_USED
794 if (vtag == TT_VLAN_TAGGED){ 794 if (vtag == TT_VLAN_TAGGED){
795 u16 vlan_tag = le16_to_cpu(lp->rx_ring[rx_index].tag_ctrl_info); 795 u16 vlan_tag = le16_to_cpu(lp->rx_ring[rx_index].tag_ctrl_info);
796 __vlan_hwaccel_put_tag(skb, vlan_tag); 796 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
797 } 797 }
798#endif 798#endif
799 netif_receive_skb(skb); 799 netif_receive_skb(skb);
@@ -1869,7 +1869,7 @@ static int amd8111e_probe_one(struct pci_dev *pdev,
1869 SET_NETDEV_DEV(dev, &pdev->dev); 1869 SET_NETDEV_DEV(dev, &pdev->dev);
1870 1870
1871#if AMD8111E_VLAN_TAG_USED 1871#if AMD8111E_VLAN_TAG_USED
1872 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX ; 1872 dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX ;
1873#endif 1873#endif
1874 1874
1875 lp = netdev_priv(dev); 1875 lp = netdev_priv(dev);
@@ -1907,7 +1907,7 @@ static int amd8111e_probe_one(struct pci_dev *pdev,
1907 netif_napi_add(dev, &lp->napi, amd8111e_rx_poll, 32); 1907 netif_napi_add(dev, &lp->napi, amd8111e_rx_poll, 32);
1908 1908
1909#if AMD8111E_VLAN_TAG_USED 1909#if AMD8111E_VLAN_TAG_USED
1910 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 1910 dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
1911#endif 1911#endif
1912 /* Probe the external PHY */ 1912 /* Probe the external PHY */
1913 amd8111e_probe_ext_phy(dev); 1913 amd8111e_probe_ext_phy(dev);
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index 1f07fc633ab9..0ba900762b13 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -417,7 +417,7 @@ static void atl1c_set_multi(struct net_device *netdev)
417 417
418static void __atl1c_vlan_mode(netdev_features_t features, u32 *mac_ctrl_data) 418static void __atl1c_vlan_mode(netdev_features_t features, u32 *mac_ctrl_data)
419{ 419{
420 if (features & NETIF_F_HW_VLAN_RX) { 420 if (features & NETIF_F_HW_VLAN_CTAG_RX) {
421 /* enable VLAN tag insert/strip */ 421 /* enable VLAN tag insert/strip */
422 *mac_ctrl_data |= MAC_CTRL_RMV_VLAN; 422 *mac_ctrl_data |= MAC_CTRL_RMV_VLAN;
423 } else { 423 } else {
@@ -494,10 +494,10 @@ static netdev_features_t atl1c_fix_features(struct net_device *netdev,
494 * Since there is no support for separate rx/tx vlan accel 494 * Since there is no support for separate rx/tx vlan accel
495 * enable/disable make sure tx flag is always in same state as rx. 495 * enable/disable make sure tx flag is always in same state as rx.
496 */ 496 */
497 if (features & NETIF_F_HW_VLAN_RX) 497 if (features & NETIF_F_HW_VLAN_CTAG_RX)
498 features |= NETIF_F_HW_VLAN_TX; 498 features |= NETIF_F_HW_VLAN_CTAG_TX;
499 else 499 else
500 features &= ~NETIF_F_HW_VLAN_TX; 500 features &= ~NETIF_F_HW_VLAN_CTAG_TX;
501 501
502 if (netdev->mtu > MAX_TSO_FRAME_SIZE) 502 if (netdev->mtu > MAX_TSO_FRAME_SIZE)
503 features &= ~(NETIF_F_TSO | NETIF_F_TSO6); 503 features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
@@ -510,7 +510,7 @@ static int atl1c_set_features(struct net_device *netdev,
510{ 510{
511 netdev_features_t changed = netdev->features ^ features; 511 netdev_features_t changed = netdev->features ^ features;
512 512
513 if (changed & NETIF_F_HW_VLAN_RX) 513 if (changed & NETIF_F_HW_VLAN_CTAG_RX)
514 atl1c_vlan_mode(netdev, features); 514 atl1c_vlan_mode(netdev, features);
515 515
516 return 0; 516 return 0;
@@ -1809,7 +1809,7 @@ rrs_checked:
1809 1809
1810 AT_TAG_TO_VLAN(rrs->vlan_tag, vlan); 1810 AT_TAG_TO_VLAN(rrs->vlan_tag, vlan);
1811 vlan = le16_to_cpu(vlan); 1811 vlan = le16_to_cpu(vlan);
1812 __vlan_hwaccel_put_tag(skb, vlan); 1812 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan);
1813 } 1813 }
1814 netif_receive_skb(skb); 1814 netif_receive_skb(skb);
1815 1815
@@ -2475,13 +2475,13 @@ static int atl1c_init_netdev(struct net_device *netdev, struct pci_dev *pdev)
2475 atl1c_set_ethtool_ops(netdev); 2475 atl1c_set_ethtool_ops(netdev);
2476 2476
2477 /* TODO: add when ready */ 2477 /* TODO: add when ready */
2478 netdev->hw_features = NETIF_F_SG | 2478 netdev->hw_features = NETIF_F_SG |
2479 NETIF_F_HW_CSUM | 2479 NETIF_F_HW_CSUM |
2480 NETIF_F_HW_VLAN_RX | 2480 NETIF_F_HW_VLAN_CTAG_RX |
2481 NETIF_F_TSO | 2481 NETIF_F_TSO |
2482 NETIF_F_TSO6; 2482 NETIF_F_TSO6;
2483 netdev->features = netdev->hw_features | 2483 netdev->features = netdev->hw_features |
2484 NETIF_F_HW_VLAN_TX; 2484 NETIF_F_HW_VLAN_CTAG_TX;
2485 return 0; 2485 return 0;
2486} 2486}
2487 2487
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
index d058d0061ed0..0688bb82b442 100644
--- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
+++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
@@ -315,7 +315,7 @@ static void atl1e_set_multi(struct net_device *netdev)
315 315
316static void __atl1e_vlan_mode(netdev_features_t features, u32 *mac_ctrl_data) 316static void __atl1e_vlan_mode(netdev_features_t features, u32 *mac_ctrl_data)
317{ 317{
318 if (features & NETIF_F_HW_VLAN_RX) { 318 if (features & NETIF_F_HW_VLAN_CTAG_RX) {
319 /* enable VLAN tag insert/strip */ 319 /* enable VLAN tag insert/strip */
320 *mac_ctrl_data |= MAC_CTRL_RMV_VLAN; 320 *mac_ctrl_data |= MAC_CTRL_RMV_VLAN;
321 } else { 321 } else {
@@ -378,10 +378,10 @@ static netdev_features_t atl1e_fix_features(struct net_device *netdev,
378 * Since there is no support for separate rx/tx vlan accel 378 * Since there is no support for separate rx/tx vlan accel
379 * enable/disable make sure tx flag is always in same state as rx. 379 * enable/disable make sure tx flag is always in same state as rx.
380 */ 380 */
381 if (features & NETIF_F_HW_VLAN_RX) 381 if (features & NETIF_F_HW_VLAN_CTAG_RX)
382 features |= NETIF_F_HW_VLAN_TX; 382 features |= NETIF_F_HW_VLAN_CTAG_TX;
383 else 383 else
384 features &= ~NETIF_F_HW_VLAN_TX; 384 features &= ~NETIF_F_HW_VLAN_CTAG_TX;
385 385
386 return features; 386 return features;
387} 387}
@@ -391,7 +391,7 @@ static int atl1e_set_features(struct net_device *netdev,
391{ 391{
392 netdev_features_t changed = netdev->features ^ features; 392 netdev_features_t changed = netdev->features ^ features;
393 393
394 if (changed & NETIF_F_HW_VLAN_RX) 394 if (changed & NETIF_F_HW_VLAN_CTAG_RX)
395 atl1e_vlan_mode(netdev, features); 395 atl1e_vlan_mode(netdev, features);
396 396
397 return 0; 397 return 0;
@@ -1435,7 +1435,7 @@ static void atl1e_clean_rx_irq(struct atl1e_adapter *adapter, u8 que,
1435 netdev_dbg(netdev, 1435 netdev_dbg(netdev,
1436 "RXD VLAN TAG<RRD>=0x%04x\n", 1436 "RXD VLAN TAG<RRD>=0x%04x\n",
1437 prrs->vtag); 1437 prrs->vtag);
1438 __vlan_hwaccel_put_tag(skb, vlan_tag); 1438 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
1439 } 1439 }
1440 netif_receive_skb(skb); 1440 netif_receive_skb(skb);
1441 1441
@@ -2198,9 +2198,9 @@ static int atl1e_init_netdev(struct net_device *netdev, struct pci_dev *pdev)
2198 atl1e_set_ethtool_ops(netdev); 2198 atl1e_set_ethtool_ops(netdev);
2199 2199
2200 netdev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO | 2200 netdev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO |
2201 NETIF_F_HW_VLAN_RX; 2201 NETIF_F_HW_VLAN_CTAG_RX;
2202 netdev->features = netdev->hw_features | NETIF_F_LLTX | 2202 netdev->features = netdev->hw_features | NETIF_F_LLTX |
2203 NETIF_F_HW_VLAN_TX; 2203 NETIF_F_HW_VLAN_CTAG_TX;
2204 2204
2205 return 0; 2205 return 0;
2206} 2206}
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c
index 8338013ab33d..fa0915f3999b 100644
--- a/drivers/net/ethernet/atheros/atlx/atl1.c
+++ b/drivers/net/ethernet/atheros/atlx/atl1.c
@@ -2024,7 +2024,7 @@ rrd_ok:
2024 ((rrd->vlan_tag & 7) << 13) | 2024 ((rrd->vlan_tag & 7) << 13) |
2025 ((rrd->vlan_tag & 8) << 9); 2025 ((rrd->vlan_tag & 8) << 9);
2026 2026
2027 __vlan_hwaccel_put_tag(skb, vlan_tag); 2027 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
2028 } 2028 }
2029 netif_receive_skb(skb); 2029 netif_receive_skb(skb);
2030 2030
@@ -3018,10 +3018,10 @@ static int atl1_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3018 3018
3019 netdev->features = NETIF_F_HW_CSUM; 3019 netdev->features = NETIF_F_HW_CSUM;
3020 netdev->features |= NETIF_F_SG; 3020 netdev->features |= NETIF_F_SG;
3021 netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX); 3021 netdev->features |= (NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX);
3022 3022
3023 netdev->hw_features = NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_TSO | 3023 netdev->hw_features = NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_TSO |
3024 NETIF_F_HW_VLAN_RX; 3024 NETIF_F_HW_VLAN_CTAG_RX;
3025 3025
3026 /* is this valid? see atl1_setup_mac_ctrl() */ 3026 /* is this valid? see atl1_setup_mac_ctrl() */
3027 netdev->features |= NETIF_F_RXCSUM; 3027 netdev->features |= NETIF_F_RXCSUM;
diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c
index a046b6ff847c..265ce1b752ed 100644
--- a/drivers/net/ethernet/atheros/atlx/atl2.c
+++ b/drivers/net/ethernet/atheros/atlx/atl2.c
@@ -363,7 +363,7 @@ static inline void atl2_irq_disable(struct atl2_adapter *adapter)
363 363
364static void __atl2_vlan_mode(netdev_features_t features, u32 *ctrl) 364static void __atl2_vlan_mode(netdev_features_t features, u32 *ctrl)
365{ 365{
366 if (features & NETIF_F_HW_VLAN_RX) { 366 if (features & NETIF_F_HW_VLAN_CTAG_RX) {
367 /* enable VLAN tag insert/strip */ 367 /* enable VLAN tag insert/strip */
368 *ctrl |= MAC_CTRL_RMV_VLAN; 368 *ctrl |= MAC_CTRL_RMV_VLAN;
369 } else { 369 } else {
@@ -399,10 +399,10 @@ static netdev_features_t atl2_fix_features(struct net_device *netdev,
399 * Since there is no support for separate rx/tx vlan accel 399 * Since there is no support for separate rx/tx vlan accel
400 * enable/disable make sure tx flag is always in same state as rx. 400 * enable/disable make sure tx flag is always in same state as rx.
401 */ 401 */
402 if (features & NETIF_F_HW_VLAN_RX) 402 if (features & NETIF_F_HW_VLAN_CTAG_RX)
403 features |= NETIF_F_HW_VLAN_TX; 403 features |= NETIF_F_HW_VLAN_CTAG_TX;
404 else 404 else
405 features &= ~NETIF_F_HW_VLAN_TX; 405 features &= ~NETIF_F_HW_VLAN_CTAG_TX;
406 406
407 return features; 407 return features;
408} 408}
@@ -412,7 +412,7 @@ static int atl2_set_features(struct net_device *netdev,
412{ 412{
413 netdev_features_t changed = netdev->features ^ features; 413 netdev_features_t changed = netdev->features ^ features;
414 414
415 if (changed & NETIF_F_HW_VLAN_RX) 415 if (changed & NETIF_F_HW_VLAN_CTAG_RX)
416 atl2_vlan_mode(netdev, features); 416 atl2_vlan_mode(netdev, features);
417 417
418 return 0; 418 return 0;
@@ -452,7 +452,7 @@ static void atl2_intr_rx(struct atl2_adapter *adapter)
452 ((rxd->status.vtag&7) << 13) | 452 ((rxd->status.vtag&7) << 13) |
453 ((rxd->status.vtag&8) << 9); 453 ((rxd->status.vtag&8) << 9);
454 454
455 __vlan_hwaccel_put_tag(skb, vlan_tag); 455 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
456 } 456 }
457 netif_rx(skb); 457 netif_rx(skb);
458 netdev->stats.rx_bytes += rx_size; 458 netdev->stats.rx_bytes += rx_size;
@@ -887,7 +887,7 @@ static netdev_tx_t atl2_xmit_frame(struct sk_buff *skb,
887 skb->len-copy_len); 887 skb->len-copy_len);
888 offset = ((u32)(skb->len-copy_len + 3) & ~3); 888 offset = ((u32)(skb->len-copy_len + 3) & ~3);
889 } 889 }
890#ifdef NETIF_F_HW_VLAN_TX 890#ifdef NETIF_F_HW_VLAN_CTAG_TX
891 if (vlan_tx_tag_present(skb)) { 891 if (vlan_tx_tag_present(skb)) {
892 u16 vlan_tag = vlan_tx_tag_get(skb); 892 u16 vlan_tag = vlan_tx_tag_get(skb);
893 vlan_tag = (vlan_tag << 4) | 893 vlan_tag = (vlan_tag << 4) |
@@ -1413,8 +1413,8 @@ static int atl2_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1413 1413
1414 err = -EIO; 1414 err = -EIO;
1415 1415
1416 netdev->hw_features = NETIF_F_SG | NETIF_F_HW_VLAN_RX; 1416 netdev->hw_features = NETIF_F_SG | NETIF_F_HW_VLAN_CTAG_RX;
1417 netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX); 1417 netdev->features |= (NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX);
1418 1418
1419 /* Init PHY as early as possible due to power saving issue */ 1419 /* Init PHY as early as possible due to power saving issue */
1420 atl2_phy_init(&adapter->hw); 1420 atl2_phy_init(&adapter->hw);
diff --git a/drivers/net/ethernet/atheros/atlx/atlx.c b/drivers/net/ethernet/atheros/atlx/atlx.c
index f82eb1699464..46a622cceee4 100644
--- a/drivers/net/ethernet/atheros/atlx/atlx.c
+++ b/drivers/net/ethernet/atheros/atlx/atlx.c
@@ -220,7 +220,7 @@ static void atlx_link_chg_task(struct work_struct *work)
220 220
221static void __atlx_vlan_mode(netdev_features_t features, u32 *ctrl) 221static void __atlx_vlan_mode(netdev_features_t features, u32 *ctrl)
222{ 222{
223 if (features & NETIF_F_HW_VLAN_RX) { 223 if (features & NETIF_F_HW_VLAN_CTAG_RX) {
224 /* enable VLAN tag insert/strip */ 224 /* enable VLAN tag insert/strip */
225 *ctrl |= MAC_CTRL_RMV_VLAN; 225 *ctrl |= MAC_CTRL_RMV_VLAN;
226 } else { 226 } else {
@@ -257,10 +257,10 @@ static netdev_features_t atlx_fix_features(struct net_device *netdev,
257 * Since there is no support for separate rx/tx vlan accel 257 * Since there is no support for separate rx/tx vlan accel
258 * enable/disable make sure tx flag is always in same state as rx. 258 * enable/disable make sure tx flag is always in same state as rx.
259 */ 259 */
260 if (features & NETIF_F_HW_VLAN_RX) 260 if (features & NETIF_F_HW_VLAN_CTAG_RX)
261 features |= NETIF_F_HW_VLAN_TX; 261 features |= NETIF_F_HW_VLAN_CTAG_TX;
262 else 262 else
263 features &= ~NETIF_F_HW_VLAN_TX; 263 features &= ~NETIF_F_HW_VLAN_CTAG_TX;
264 264
265 return features; 265 return features;
266} 266}
@@ -270,7 +270,7 @@ static int atlx_set_features(struct net_device *netdev,
270{ 270{
271 netdev_features_t changed = netdev->features ^ features; 271 netdev_features_t changed = netdev->features ^ features;
272 272
273 if (changed & NETIF_F_HW_VLAN_RX) 273 if (changed & NETIF_F_HW_VLAN_CTAG_RX)
274 atlx_vlan_mode(netdev, features); 274 atlx_vlan_mode(netdev, features);
275 275
276 return 0; 276 return 0;
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index f27b549b692d..5d204492c603 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -3211,7 +3211,7 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
3211 } 3211 }
3212 if ((status & L2_FHDR_STATUS_L2_VLAN_TAG) && 3212 if ((status & L2_FHDR_STATUS_L2_VLAN_TAG) &&
3213 !(bp->rx_mode & BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG)) 3213 !(bp->rx_mode & BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG))
3214 __vlan_hwaccel_put_tag(skb, rx_hdr->l2_fhdr_vlan_tag); 3214 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), rx_hdr->l2_fhdr_vlan_tag);
3215 3215
3216 skb->protocol = eth_type_trans(skb, bp->dev); 3216 skb->protocol = eth_type_trans(skb, bp->dev);
3217 3217
@@ -3553,7 +3553,7 @@ bnx2_set_rx_mode(struct net_device *dev)
3553 rx_mode = bp->rx_mode & ~(BNX2_EMAC_RX_MODE_PROMISCUOUS | 3553 rx_mode = bp->rx_mode & ~(BNX2_EMAC_RX_MODE_PROMISCUOUS |
3554 BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG); 3554 BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG);
3555 sort_mode = 1 | BNX2_RPM_SORT_USER0_BC_EN; 3555 sort_mode = 1 | BNX2_RPM_SORT_USER0_BC_EN;
3556 if (!(dev->features & NETIF_F_HW_VLAN_RX) && 3556 if (!(dev->features & NETIF_F_HW_VLAN_CTAG_RX) &&
3557 (bp->flags & BNX2_FLAG_CAN_KEEP_VLAN)) 3557 (bp->flags & BNX2_FLAG_CAN_KEEP_VLAN))
3558 rx_mode |= BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG; 3558 rx_mode |= BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG;
3559 if (dev->flags & IFF_PROMISC) { 3559 if (dev->flags & IFF_PROMISC) {
@@ -7695,7 +7695,7 @@ bnx2_fix_features(struct net_device *dev, netdev_features_t features)
7695 struct bnx2 *bp = netdev_priv(dev); 7695 struct bnx2 *bp = netdev_priv(dev);
7696 7696
7697 if (!(bp->flags & BNX2_FLAG_CAN_KEEP_VLAN)) 7697 if (!(bp->flags & BNX2_FLAG_CAN_KEEP_VLAN))
7698 features |= NETIF_F_HW_VLAN_RX; 7698 features |= NETIF_F_HW_VLAN_CTAG_RX;
7699 7699
7700 return features; 7700 return features;
7701} 7701}
@@ -7706,12 +7706,12 @@ bnx2_set_features(struct net_device *dev, netdev_features_t features)
7706 struct bnx2 *bp = netdev_priv(dev); 7706 struct bnx2 *bp = netdev_priv(dev);
7707 7707
7708 /* TSO with VLAN tag won't work with current firmware */ 7708 /* TSO with VLAN tag won't work with current firmware */
7709 if (features & NETIF_F_HW_VLAN_TX) 7709 if (features & NETIF_F_HW_VLAN_CTAG_TX)
7710 dev->vlan_features |= (dev->hw_features & NETIF_F_ALL_TSO); 7710 dev->vlan_features |= (dev->hw_features & NETIF_F_ALL_TSO);
7711 else 7711 else
7712 dev->vlan_features &= ~NETIF_F_ALL_TSO; 7712 dev->vlan_features &= ~NETIF_F_ALL_TSO;
7713 7713
7714 if ((!!(features & NETIF_F_HW_VLAN_RX) != 7714 if ((!!(features & NETIF_F_HW_VLAN_CTAG_RX) !=
7715 !!(bp->rx_mode & BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG)) && 7715 !!(bp->rx_mode & BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG)) &&
7716 netif_running(dev)) { 7716 netif_running(dev)) {
7717 bnx2_netif_stop(bp, false); 7717 bnx2_netif_stop(bp, false);
@@ -8551,7 +8551,7 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
8551 dev->hw_features |= NETIF_F_IPV6_CSUM | NETIF_F_TSO6; 8551 dev->hw_features |= NETIF_F_IPV6_CSUM | NETIF_F_TSO6;
8552 8552
8553 dev->vlan_features = dev->hw_features; 8553 dev->vlan_features = dev->hw_features;
8554 dev->hw_features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 8554 dev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
8555 dev->features |= dev->hw_features; 8555 dev->features |= dev->hw_features;
8556 dev->priv_flags |= IFF_UNICAST_FLT; 8556 dev->priv_flags |= IFF_UNICAST_FLT;
8557 8557
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 352e58ede4d5..6b50443d3456 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -719,7 +719,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
719 if (!bnx2x_fill_frag_skb(bp, fp, tpa_info, pages, 719 if (!bnx2x_fill_frag_skb(bp, fp, tpa_info, pages,
720 skb, cqe, cqe_idx)) { 720 skb, cqe, cqe_idx)) {
721 if (tpa_info->parsing_flags & PARSING_FLAGS_VLAN) 721 if (tpa_info->parsing_flags & PARSING_FLAGS_VLAN)
722 __vlan_hwaccel_put_tag(skb, tpa_info->vlan_tag); 722 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), tpa_info->vlan_tag);
723 bnx2x_gro_receive(bp, fp, skb); 723 bnx2x_gro_receive(bp, fp, skb);
724 } else { 724 } else {
725 DP(NETIF_MSG_RX_STATUS, 725 DP(NETIF_MSG_RX_STATUS,
@@ -994,7 +994,7 @@ reuse_rx:
994 994
995 if (le16_to_cpu(cqe_fp->pars_flags.flags) & 995 if (le16_to_cpu(cqe_fp->pars_flags.flags) &
996 PARSING_FLAGS_VLAN) 996 PARSING_FLAGS_VLAN)
997 __vlan_hwaccel_put_tag(skb, 997 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
998 le16_to_cpu(cqe_fp->vlan_tag)); 998 le16_to_cpu(cqe_fp->vlan_tag));
999 napi_gro_receive(&fp->napi, skb); 999 napi_gro_receive(&fp->napi, skb);
1000 1000
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index fdfe33bc097b..1e60c5d139d1 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -12027,7 +12027,7 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev,
12027 dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | 12027 dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
12028 NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | 12028 NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 |
12029 NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_GRO | 12029 NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_GRO |
12030 NETIF_F_RXHASH | NETIF_F_HW_VLAN_TX; 12030 NETIF_F_RXHASH | NETIF_F_HW_VLAN_CTAG_TX;
12031 if (!CHIP_IS_E1x(bp)) { 12031 if (!CHIP_IS_E1x(bp)) {
12032 dev->hw_features |= NETIF_F_GSO_GRE; 12032 dev->hw_features |= NETIF_F_GSO_GRE;
12033 dev->hw_enc_features = 12033 dev->hw_enc_features =
@@ -12039,7 +12039,7 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev,
12039 dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | 12039 dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
12040 NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_HIGHDMA; 12040 NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_HIGHDMA;
12041 12041
12042 dev->features |= dev->hw_features | NETIF_F_HW_VLAN_RX; 12042 dev->features |= dev->hw_features | NETIF_F_HW_VLAN_CTAG_RX;
12043 if (bp->flags & USING_DAC_FLAG) 12043 if (bp->flags & USING_DAC_FLAG)
12044 dev->features |= NETIF_F_HIGHDMA; 12044 dev->features |= NETIF_F_HIGHDMA;
12045 12045
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 45719ddfde74..ac83c87e0b1b 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -6715,7 +6715,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
6715 6715
6716 if (desc->type_flags & RXD_FLAG_VLAN && 6716 if (desc->type_flags & RXD_FLAG_VLAN &&
6717 !(tp->rx_mode & RX_MODE_KEEP_VLAN_TAG)) 6717 !(tp->rx_mode & RX_MODE_KEEP_VLAN_TAG))
6718 __vlan_hwaccel_put_tag(skb, 6718 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
6719 desc->err_vlan & RXD_VLAN_MASK); 6719 desc->err_vlan & RXD_VLAN_MASK);
6720 6720
6721 napi_gro_receive(&tnapi->napi, skb); 6721 napi_gro_receive(&tnapi->napi, skb);
@@ -17197,7 +17197,7 @@ static int tg3_init_one(struct pci_dev *pdev,
17197 17197
17198 tg3_init_bufmgr_config(tp); 17198 tg3_init_bufmgr_config(tp);
17199 17199
17200 features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 17200 features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
17201 17201
17202 /* 5700 B0 chips do not support checksumming correctly due 17202 /* 5700 B0 chips do not support checksumming correctly due
17203 * to hardware bugs. 17203 * to hardware bugs.
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c
index d588f842d557..ce4a030d3d0c 100644
--- a/drivers/net/ethernet/brocade/bna/bnad.c
+++ b/drivers/net/ethernet/brocade/bna/bnad.c
@@ -610,7 +610,7 @@ bnad_cq_process(struct bnad *bnad, struct bna_ccb *ccb, int budget)
610 rcb->rxq->rx_bytes += length; 610 rcb->rxq->rx_bytes += length;
611 611
612 if (flags & BNA_CQ_EF_VLAN) 612 if (flags & BNA_CQ_EF_VLAN)
613 __vlan_hwaccel_put_tag(skb, ntohs(cmpl->vlan_tag)); 613 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(cmpl->vlan_tag));
614 614
615 if (BNAD_RXBUF_IS_PAGE(unmap_q->type)) 615 if (BNAD_RXBUF_IS_PAGE(unmap_q->type))
616 napi_gro_frags(&rx_ctrl->napi); 616 napi_gro_frags(&rx_ctrl->napi);
@@ -3068,8 +3068,7 @@ bnad_change_mtu(struct net_device *netdev, int new_mtu)
3068} 3068}
3069 3069
3070static int 3070static int
3071bnad_vlan_rx_add_vid(struct net_device *netdev, 3071bnad_vlan_rx_add_vid(struct net_device *netdev, __be16 proto, u16 vid)
3072 unsigned short vid)
3073{ 3072{
3074 struct bnad *bnad = netdev_priv(netdev); 3073 struct bnad *bnad = netdev_priv(netdev);
3075 unsigned long flags; 3074 unsigned long flags;
@@ -3090,8 +3089,7 @@ bnad_vlan_rx_add_vid(struct net_device *netdev,
3090} 3089}
3091 3090
3092static int 3091static int
3093bnad_vlan_rx_kill_vid(struct net_device *netdev, 3092bnad_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid)
3094 unsigned short vid)
3095{ 3093{
3096 struct bnad *bnad = netdev_priv(netdev); 3094 struct bnad *bnad = netdev_priv(netdev);
3097 unsigned long flags; 3095 unsigned long flags;
@@ -3170,14 +3168,14 @@ bnad_netdev_init(struct bnad *bnad, bool using_dac)
3170 3168
3171 netdev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM | 3169 netdev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM |
3172 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | 3170 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
3173 NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_VLAN_TX; 3171 NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_TX;
3174 3172
3175 netdev->vlan_features = NETIF_F_SG | NETIF_F_HIGHDMA | 3173 netdev->vlan_features = NETIF_F_SG | NETIF_F_HIGHDMA |
3176 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | 3174 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
3177 NETIF_F_TSO | NETIF_F_TSO6; 3175 NETIF_F_TSO | NETIF_F_TSO6;
3178 3176
3179 netdev->features |= netdev->hw_features | 3177 netdev->features |= netdev->hw_features |
3180 NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER; 3178 NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER;
3181 3179
3182 if (using_dac) 3180 if (using_dac)
3183 netdev->features |= NETIF_F_HIGHDMA; 3181 netdev->features |= NETIF_F_HIGHDMA;
diff --git a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c
index 20d2085f61c5..9624cfe7df57 100644
--- a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c
+++ b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c
@@ -856,10 +856,10 @@ static netdev_features_t t1_fix_features(struct net_device *dev,
856 * Since there is no support for separate rx/tx vlan accel 856 * Since there is no support for separate rx/tx vlan accel
857 * enable/disable make sure tx flag is always in same state as rx. 857 * enable/disable make sure tx flag is always in same state as rx.
858 */ 858 */
859 if (features & NETIF_F_HW_VLAN_RX) 859 if (features & NETIF_F_HW_VLAN_CTAG_RX)
860 features |= NETIF_F_HW_VLAN_TX; 860 features |= NETIF_F_HW_VLAN_CTAG_TX;
861 else 861 else
862 features &= ~NETIF_F_HW_VLAN_TX; 862 features &= ~NETIF_F_HW_VLAN_CTAG_TX;
863 863
864 return features; 864 return features;
865} 865}
@@ -869,7 +869,7 @@ static int t1_set_features(struct net_device *dev, netdev_features_t features)
869 netdev_features_t changed = dev->features ^ features; 869 netdev_features_t changed = dev->features ^ features;
870 struct adapter *adapter = dev->ml_priv; 870 struct adapter *adapter = dev->ml_priv;
871 871
872 if (changed & NETIF_F_HW_VLAN_RX) 872 if (changed & NETIF_F_HW_VLAN_CTAG_RX)
873 t1_vlan_mode(adapter, features); 873 t1_vlan_mode(adapter, features);
874 874
875 return 0; 875 return 0;
@@ -1085,8 +1085,9 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1085 netdev->features |= NETIF_F_HIGHDMA; 1085 netdev->features |= NETIF_F_HIGHDMA;
1086 if (vlan_tso_capable(adapter)) { 1086 if (vlan_tso_capable(adapter)) {
1087 netdev->features |= 1087 netdev->features |=
1088 NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 1088 NETIF_F_HW_VLAN_CTAG_TX |
1089 netdev->hw_features |= NETIF_F_HW_VLAN_RX; 1089 NETIF_F_HW_VLAN_CTAG_RX;
1090 netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX;
1090 1091
1091 /* T204: disable TSO */ 1092 /* T204: disable TSO */
1092 if (!(is_T2(adapter)) || bi->port_number != 4) { 1093 if (!(is_T2(adapter)) || bi->port_number != 4) {
diff --git a/drivers/net/ethernet/chelsio/cxgb/sge.c b/drivers/net/ethernet/chelsio/cxgb/sge.c
index 55fe8c9f0484..8061fb0ef7ed 100644
--- a/drivers/net/ethernet/chelsio/cxgb/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb/sge.c
@@ -734,7 +734,7 @@ void t1_vlan_mode(struct adapter *adapter, netdev_features_t features)
734{ 734{
735 struct sge *sge = adapter->sge; 735 struct sge *sge = adapter->sge;
736 736
737 if (features & NETIF_F_HW_VLAN_RX) 737 if (features & NETIF_F_HW_VLAN_CTAG_RX)
738 sge->sge_control |= F_VLAN_XTRACT; 738 sge->sge_control |= F_VLAN_XTRACT;
739 else 739 else
740 sge->sge_control &= ~F_VLAN_XTRACT; 740 sge->sge_control &= ~F_VLAN_XTRACT;
@@ -1386,7 +1386,7 @@ static void sge_rx(struct sge *sge, struct freelQ *fl, unsigned int len)
1386 1386
1387 if (p->vlan_valid) { 1387 if (p->vlan_valid) {
1388 st->vlan_xtract++; 1388 st->vlan_xtract++;
1389 __vlan_hwaccel_put_tag(skb, ntohs(p->vlan)); 1389 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(p->vlan));
1390 } 1390 }
1391 netif_receive_skb(skb); 1391 netif_receive_skb(skb);
1392} 1392}
diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
index 2b5e62193cea..71497e835f42 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
@@ -1181,14 +1181,15 @@ static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features)
1181 1181
1182 if (adapter->params.rev > 0) { 1182 if (adapter->params.rev > 0) {
1183 t3_set_vlan_accel(adapter, 1 << pi->port_id, 1183 t3_set_vlan_accel(adapter, 1 << pi->port_id,
1184 features & NETIF_F_HW_VLAN_RX); 1184 features & NETIF_F_HW_VLAN_CTAG_RX);
1185 } else { 1185 } else {
1186 /* single control for all ports */ 1186 /* single control for all ports */
1187 unsigned int i, have_vlans = features & NETIF_F_HW_VLAN_RX; 1187 unsigned int i, have_vlans = features & NETIF_F_HW_VLAN_CTAG_RX;
1188 1188
1189 for_each_port(adapter, i) 1189 for_each_port(adapter, i)
1190 have_vlans |= 1190 have_vlans |=
1191 adapter->port[i]->features & NETIF_F_HW_VLAN_RX; 1191 adapter->port[i]->features &
1192 NETIF_F_HW_VLAN_CTAG_RX;
1192 1193
1193 t3_set_vlan_accel(adapter, 1, have_vlans); 1194 t3_set_vlan_accel(adapter, 1, have_vlans);
1194 } 1195 }
@@ -2563,10 +2564,10 @@ static netdev_features_t cxgb_fix_features(struct net_device *dev,
2563 * Since there is no support for separate rx/tx vlan accel 2564 * Since there is no support for separate rx/tx vlan accel
2564 * enable/disable make sure tx flag is always in same state as rx. 2565 * enable/disable make sure tx flag is always in same state as rx.
2565 */ 2566 */
2566 if (features & NETIF_F_HW_VLAN_RX) 2567 if (features & NETIF_F_HW_VLAN_CTAG_RX)
2567 features |= NETIF_F_HW_VLAN_TX; 2568 features |= NETIF_F_HW_VLAN_CTAG_TX;
2568 else 2569 else
2569 features &= ~NETIF_F_HW_VLAN_TX; 2570 features &= ~NETIF_F_HW_VLAN_CTAG_TX;
2570 2571
2571 return features; 2572 return features;
2572} 2573}
@@ -2575,7 +2576,7 @@ static int cxgb_set_features(struct net_device *dev, netdev_features_t features)
2575{ 2576{
2576 netdev_features_t changed = dev->features ^ features; 2577 netdev_features_t changed = dev->features ^ features;
2577 2578
2578 if (changed & NETIF_F_HW_VLAN_RX) 2579 if (changed & NETIF_F_HW_VLAN_CTAG_RX)
2579 cxgb_vlan_mode(dev, features); 2580 cxgb_vlan_mode(dev, features);
2580 2581
2581 return 0; 2582 return 0;
@@ -3288,8 +3289,9 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
3288 netdev->mem_start = mmio_start; 3289 netdev->mem_start = mmio_start;
3289 netdev->mem_end = mmio_start + mmio_len - 1; 3290 netdev->mem_end = mmio_start + mmio_len - 1;
3290 netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | 3291 netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM |
3291 NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_RX; 3292 NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX;
3292 netdev->features |= netdev->hw_features | NETIF_F_HW_VLAN_TX; 3293 netdev->features |= netdev->hw_features |
3294 NETIF_F_HW_VLAN_CTAG_TX;
3293 netdev->vlan_features |= netdev->features & VLAN_FEAT; 3295 netdev->vlan_features |= netdev->features & VLAN_FEAT;
3294 if (pci_using_dac) 3296 if (pci_using_dac)
3295 netdev->features |= NETIF_F_HIGHDMA; 3297 netdev->features |= NETIF_F_HIGHDMA;
diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c
index 4232767862b5..0c96e5fe99cc 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c
@@ -185,7 +185,7 @@ static struct net_device *get_iff_from_mac(struct adapter *adapter,
185 if (!memcmp(dev->dev_addr, mac, ETH_ALEN)) { 185 if (!memcmp(dev->dev_addr, mac, ETH_ALEN)) {
186 rcu_read_lock(); 186 rcu_read_lock();
187 if (vlan && vlan != VLAN_VID_MASK) { 187 if (vlan && vlan != VLAN_VID_MASK) {
188 dev = __vlan_find_dev_deep(dev, vlan); 188 dev = __vlan_find_dev_deep(dev, htons(ETH_P_8021Q), vlan);
189 } else if (netif_is_bond_slave(dev)) { 189 } else if (netif_is_bond_slave(dev)) {
190 struct net_device *upper_dev; 190 struct net_device *upper_dev;
191 191
diff --git a/drivers/net/ethernet/chelsio/cxgb3/sge.c b/drivers/net/ethernet/chelsio/cxgb3/sge.c
index 9d67eb794c4b..f12e6b85a653 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/sge.c
@@ -2030,7 +2030,7 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq,
2030 2030
2031 if (p->vlan_valid) { 2031 if (p->vlan_valid) {
2032 qs->port_stats[SGE_PSTAT_VLANEX]++; 2032 qs->port_stats[SGE_PSTAT_VLANEX]++;
2033 __vlan_hwaccel_put_tag(skb, ntohs(p->vlan)); 2033 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(p->vlan));
2034 } 2034 }
2035 if (rq->polling) { 2035 if (rq->polling) {
2036 if (lro) 2036 if (lro)
@@ -2132,7 +2132,7 @@ static void lro_add_page(struct adapter *adap, struct sge_qset *qs,
2132 2132
2133 if (cpl->vlan_valid) { 2133 if (cpl->vlan_valid) {
2134 qs->port_stats[SGE_PSTAT_VLANEX]++; 2134 qs->port_stats[SGE_PSTAT_VLANEX]++;
2135 __vlan_hwaccel_put_tag(skb, ntohs(cpl->vlan)); 2135 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(cpl->vlan));
2136 } 2136 }
2137 napi_gro_frags(&qs->napi); 2137 napi_gro_frags(&qs->napi);
2138} 2138}
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index e76cf035100b..6a6a01af75fd 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -559,7 +559,7 @@ static int link_start(struct net_device *dev)
559 * that step explicitly. 559 * that step explicitly.
560 */ 560 */
561 ret = t4_set_rxmode(pi->adapter, mb, pi->viid, dev->mtu, -1, -1, -1, 561 ret = t4_set_rxmode(pi->adapter, mb, pi->viid, dev->mtu, -1, -1, -1,
562 !!(dev->features & NETIF_F_HW_VLAN_RX), true); 562 !!(dev->features & NETIF_F_HW_VLAN_CTAG_RX), true);
563 if (ret == 0) { 563 if (ret == 0) {
564 ret = t4_change_mac(pi->adapter, mb, pi->viid, 564 ret = t4_change_mac(pi->adapter, mb, pi->viid,
565 pi->xact_addr_filt, dev->dev_addr, true, 565 pi->xact_addr_filt, dev->dev_addr, true,
@@ -2722,14 +2722,14 @@ static int cxgb_set_features(struct net_device *dev, netdev_features_t features)
2722 netdev_features_t changed = dev->features ^ features; 2722 netdev_features_t changed = dev->features ^ features;
2723 int err; 2723 int err;
2724 2724
2725 if (!(changed & NETIF_F_HW_VLAN_RX)) 2725 if (!(changed & NETIF_F_HW_VLAN_CTAG_RX))
2726 return 0; 2726 return 0;
2727 2727
2728 err = t4_set_rxmode(pi->adapter, pi->adapter->fn, pi->viid, -1, 2728 err = t4_set_rxmode(pi->adapter, pi->adapter->fn, pi->viid, -1,
2729 -1, -1, -1, 2729 -1, -1, -1,
2730 !!(features & NETIF_F_HW_VLAN_RX), true); 2730 !!(features & NETIF_F_HW_VLAN_CTAG_RX), true);
2731 if (unlikely(err)) 2731 if (unlikely(err))
2732 dev->features = features ^ NETIF_F_HW_VLAN_RX; 2732 dev->features = features ^ NETIF_F_HW_VLAN_CTAG_RX;
2733 return err; 2733 return err;
2734} 2734}
2735 2735
@@ -5628,7 +5628,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
5628 netdev->hw_features = NETIF_F_SG | TSO_FLAGS | 5628 netdev->hw_features = NETIF_F_SG | TSO_FLAGS |
5629 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | 5629 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
5630 NETIF_F_RXCSUM | NETIF_F_RXHASH | 5630 NETIF_F_RXCSUM | NETIF_F_RXHASH |
5631 NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 5631 NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
5632 if (highdma) 5632 if (highdma)
5633 netdev->hw_features |= NETIF_F_HIGHDMA; 5633 netdev->hw_features |= NETIF_F_HIGHDMA;
5634 netdev->features |= netdev->hw_features; 5634 netdev->features |= netdev->hw_features;
diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c
index 8b47b253e204..2bfbb206b35a 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
@@ -1633,7 +1633,7 @@ static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl,
1633 skb->rxhash = (__force u32)pkt->rsshdr.hash_val; 1633 skb->rxhash = (__force u32)pkt->rsshdr.hash_val;
1634 1634
1635 if (unlikely(pkt->vlan_ex)) { 1635 if (unlikely(pkt->vlan_ex)) {
1636 __vlan_hwaccel_put_tag(skb, ntohs(pkt->vlan)); 1636 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(pkt->vlan));
1637 rxq->stats.vlan_ex++; 1637 rxq->stats.vlan_ex++;
1638 } 1638 }
1639 ret = napi_gro_frags(&rxq->rspq.napi); 1639 ret = napi_gro_frags(&rxq->rspq.napi);
@@ -1705,7 +1705,7 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
1705 skb_checksum_none_assert(skb); 1705 skb_checksum_none_assert(skb);
1706 1706
1707 if (unlikely(pkt->vlan_ex)) { 1707 if (unlikely(pkt->vlan_ex)) {
1708 __vlan_hwaccel_put_tag(skb, ntohs(pkt->vlan)); 1708 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(pkt->vlan));
1709 rxq->stats.vlan_ex++; 1709 rxq->stats.vlan_ex++;
1710 } 1710 }
1711 netif_receive_skb(skb); 1711 netif_receive_skb(skb);
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
index 7fcac2003769..73aef76a526c 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
@@ -1100,10 +1100,10 @@ static netdev_features_t cxgb4vf_fix_features(struct net_device *dev,
1100 * Since there is no support for separate rx/tx vlan accel 1100 * Since there is no support for separate rx/tx vlan accel
1101 * enable/disable make sure tx flag is always in same state as rx. 1101 * enable/disable make sure tx flag is always in same state as rx.
1102 */ 1102 */
1103 if (features & NETIF_F_HW_VLAN_RX) 1103 if (features & NETIF_F_HW_VLAN_CTAG_RX)
1104 features |= NETIF_F_HW_VLAN_TX; 1104 features |= NETIF_F_HW_VLAN_CTAG_TX;
1105 else 1105 else
1106 features &= ~NETIF_F_HW_VLAN_TX; 1106 features &= ~NETIF_F_HW_VLAN_CTAG_TX;
1107 1107
1108 return features; 1108 return features;
1109} 1109}
@@ -1114,9 +1114,9 @@ static int cxgb4vf_set_features(struct net_device *dev,
1114 struct port_info *pi = netdev_priv(dev); 1114 struct port_info *pi = netdev_priv(dev);
1115 netdev_features_t changed = dev->features ^ features; 1115 netdev_features_t changed = dev->features ^ features;
1116 1116
1117 if (changed & NETIF_F_HW_VLAN_RX) 1117 if (changed & NETIF_F_HW_VLAN_CTAG_RX)
1118 t4vf_set_rxmode(pi->adapter, pi->viid, -1, -1, -1, -1, 1118 t4vf_set_rxmode(pi->adapter, pi->viid, -1, -1, -1, -1,
1119 features & NETIF_F_HW_VLAN_TX, 0); 1119 features & NETIF_F_HW_VLAN_CTAG_TX, 0);
1120 1120
1121 return 0; 1121 return 0;
1122} 1122}
@@ -2623,11 +2623,12 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev,
2623 2623
2624 netdev->hw_features = NETIF_F_SG | TSO_FLAGS | 2624 netdev->hw_features = NETIF_F_SG | TSO_FLAGS |
2625 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | 2625 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
2626 NETIF_F_HW_VLAN_RX | NETIF_F_RXCSUM; 2626 NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_RXCSUM;
2627 netdev->vlan_features = NETIF_F_SG | TSO_FLAGS | 2627 netdev->vlan_features = NETIF_F_SG | TSO_FLAGS |
2628 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | 2628 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
2629 NETIF_F_HIGHDMA; 2629 NETIF_F_HIGHDMA;
2630 netdev->features = netdev->hw_features | NETIF_F_HW_VLAN_TX; 2630 netdev->features = netdev->hw_features |
2631 NETIF_F_HW_VLAN_CTAG_TX;
2631 if (pci_using_dac) 2632 if (pci_using_dac)
2632 netdev->features |= NETIF_F_HIGHDMA; 2633 netdev->features |= NETIF_F_HIGHDMA;
2633 2634
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
index 61dfb2a47929..df296af20bd5 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
@@ -1482,7 +1482,8 @@ static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl,
1482 skb_record_rx_queue(skb, rxq->rspq.idx); 1482 skb_record_rx_queue(skb, rxq->rspq.idx);
1483 1483
1484 if (pkt->vlan_ex) { 1484 if (pkt->vlan_ex) {
1485 __vlan_hwaccel_put_tag(skb, be16_to_cpu(pkt->vlan)); 1485 __vlan_hwaccel_put_tag(skb, cpu_to_be16(ETH_P_8021Q),
1486 be16_to_cpu(pkt->vlan));
1486 rxq->stats.vlan_ex++; 1487 rxq->stats.vlan_ex++;
1487 } 1488 }
1488 ret = napi_gro_frags(&rxq->rspq.napi); 1489 ret = napi_gro_frags(&rxq->rspq.napi);
@@ -1551,7 +1552,7 @@ int t4vf_ethrx_handler(struct sge_rspq *rspq, const __be64 *rsp,
1551 1552
1552 if (pkt->vlan_ex) { 1553 if (pkt->vlan_ex) {
1553 rxq->stats.vlan_ex++; 1554 rxq->stats.vlan_ex++;
1554 __vlan_hwaccel_put_tag(skb, be16_to_cpu(pkt->vlan)); 1555 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), be16_to_cpu(pkt->vlan));
1555 } 1556 }
1556 1557
1557 netif_receive_skb(skb); 1558 netif_receive_skb(skb);
diff --git a/drivers/net/ethernet/cisco/enic/enic_dev.c b/drivers/net/ethernet/cisco/enic/enic_dev.c
index bf0fc56dba19..4b6e5695b263 100644
--- a/drivers/net/ethernet/cisco/enic/enic_dev.c
+++ b/drivers/net/ethernet/cisco/enic/enic_dev.c
@@ -212,7 +212,7 @@ int enic_dev_deinit_done(struct enic *enic, int *status)
212} 212}
213 213
214/* rtnl lock is held */ 214/* rtnl lock is held */
215int enic_vlan_rx_add_vid(struct net_device *netdev, u16 vid) 215int enic_vlan_rx_add_vid(struct net_device *netdev, __be16 proto, u16 vid)
216{ 216{
217 struct enic *enic = netdev_priv(netdev); 217 struct enic *enic = netdev_priv(netdev);
218 int err; 218 int err;
@@ -225,7 +225,7 @@ int enic_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
225} 225}
226 226
227/* rtnl lock is held */ 227/* rtnl lock is held */
228int enic_vlan_rx_kill_vid(struct net_device *netdev, u16 vid) 228int enic_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid)
229{ 229{
230 struct enic *enic = netdev_priv(netdev); 230 struct enic *enic = netdev_priv(netdev);
231 int err; 231 int err;
diff --git a/drivers/net/ethernet/cisco/enic/enic_dev.h b/drivers/net/ethernet/cisco/enic/enic_dev.h
index da1cba3c410e..08bded051b93 100644
--- a/drivers/net/ethernet/cisco/enic/enic_dev.h
+++ b/drivers/net/ethernet/cisco/enic/enic_dev.h
@@ -46,8 +46,8 @@ int enic_dev_packet_filter(struct enic *enic, int directed, int multicast,
46 int broadcast, int promisc, int allmulti); 46 int broadcast, int promisc, int allmulti);
47int enic_dev_add_addr(struct enic *enic, u8 *addr); 47int enic_dev_add_addr(struct enic *enic, u8 *addr);
48int enic_dev_del_addr(struct enic *enic, u8 *addr); 48int enic_dev_del_addr(struct enic *enic, u8 *addr);
49int enic_vlan_rx_add_vid(struct net_device *netdev, u16 vid); 49int enic_vlan_rx_add_vid(struct net_device *netdev, __be16 proto, u16 vid);
50int enic_vlan_rx_kill_vid(struct net_device *netdev, u16 vid); 50int enic_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid);
51int enic_dev_notify_unset(struct enic *enic); 51int enic_dev_notify_unset(struct enic *enic);
52int enic_dev_hang_notify(struct enic *enic); 52int enic_dev_hang_notify(struct enic *enic);
53int enic_dev_set_ig_vlan_rewrite_mode(struct enic *enic); 53int enic_dev_set_ig_vlan_rewrite_mode(struct enic *enic);
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index ec1a233622c6..635f55992d7e 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -1300,7 +1300,7 @@ static void enic_rq_indicate_buf(struct vnic_rq *rq,
1300 } 1300 }
1301 1301
1302 if (vlan_stripped) 1302 if (vlan_stripped)
1303 __vlan_hwaccel_put_tag(skb, vlan_tci); 1303 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tci);
1304 1304
1305 if (netdev->features & NETIF_F_GRO) 1305 if (netdev->features & NETIF_F_GRO)
1306 napi_gro_receive(&enic->napi[q_number], skb); 1306 napi_gro_receive(&enic->napi[q_number], skb);
@@ -2496,9 +2496,9 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2496 netdev->watchdog_timeo = 2 * HZ; 2496 netdev->watchdog_timeo = 2 * HZ;
2497 netdev->ethtool_ops = &enic_ethtool_ops; 2497 netdev->ethtool_ops = &enic_ethtool_ops;
2498 2498
2499 netdev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 2499 netdev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
2500 if (ENIC_SETTING(enic, LOOP)) { 2500 if (ENIC_SETTING(enic, LOOP)) {
2501 netdev->features &= ~NETIF_F_HW_VLAN_TX; 2501 netdev->features &= ~NETIF_F_HW_VLAN_CTAG_TX;
2502 enic->loop_enable = 1; 2502 enic->loop_enable = 1;
2503 enic->loop_tag = enic->config.loop_tag; 2503 enic->loop_tag = enic->config.loop_tag;
2504 dev_info(dev, "loopback tag=0x%04x\n", enic->loop_tag); 2504 dev_info(dev, "loopback tag=0x%04x\n", enic->loop_tag);
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 536afa2fb94c..811d0a47d17a 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -771,7 +771,7 @@ static struct sk_buff *be_insert_vlan_in_pkt(struct be_adapter *adapter,
771 771
772 if (vlan_tx_tag_present(skb)) { 772 if (vlan_tx_tag_present(skb)) {
773 vlan_tag = be_get_tx_vlan_tag(adapter, skb); 773 vlan_tag = be_get_tx_vlan_tag(adapter, skb);
774 __vlan_put_tag(skb, vlan_tag); 774 __vlan_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
775 skb->vlan_tci = 0; 775 skb->vlan_tci = 0;
776 } 776 }
777 777
@@ -902,7 +902,7 @@ set_vlan_promisc:
902 return status; 902 return status;
903} 903}
904 904
905static int be_vlan_add_vid(struct net_device *netdev, u16 vid) 905static int be_vlan_add_vid(struct net_device *netdev, __be16 proto, u16 vid)
906{ 906{
907 struct be_adapter *adapter = netdev_priv(netdev); 907 struct be_adapter *adapter = netdev_priv(netdev);
908 int status = 0; 908 int status = 0;
@@ -928,7 +928,7 @@ ret:
928 return status; 928 return status;
929} 929}
930 930
931static int be_vlan_rem_vid(struct net_device *netdev, u16 vid) 931static int be_vlan_rem_vid(struct net_device *netdev, __be16 proto, u16 vid)
932{ 932{
933 struct be_adapter *adapter = netdev_priv(netdev); 933 struct be_adapter *adapter = netdev_priv(netdev);
934 int status = 0; 934 int status = 0;
@@ -1383,7 +1383,7 @@ static void be_rx_compl_process(struct be_rx_obj *rxo,
1383 1383
1384 1384
1385 if (rxcp->vlanf) 1385 if (rxcp->vlanf)
1386 __vlan_hwaccel_put_tag(skb, rxcp->vlan_tag); 1386 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), rxcp->vlan_tag);
1387 1387
1388 netif_receive_skb(skb); 1388 netif_receive_skb(skb);
1389} 1389}
@@ -1439,7 +1439,7 @@ void be_rx_compl_process_gro(struct be_rx_obj *rxo, struct napi_struct *napi,
1439 skb->rxhash = rxcp->rss_hash; 1439 skb->rxhash = rxcp->rss_hash;
1440 1440
1441 if (rxcp->vlanf) 1441 if (rxcp->vlanf)
1442 __vlan_hwaccel_put_tag(skb, rxcp->vlan_tag); 1442 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), rxcp->vlan_tag);
1443 1443
1444 napi_gro_frags(napi); 1444 napi_gro_frags(napi);
1445} 1445}
@@ -3663,12 +3663,12 @@ static void be_netdev_init(struct net_device *netdev)
3663 3663
3664 netdev->hw_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | 3664 netdev->hw_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 |
3665 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | 3665 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM |
3666 NETIF_F_HW_VLAN_TX; 3666 NETIF_F_HW_VLAN_CTAG_TX;
3667 if (be_multi_rxq(adapter)) 3667 if (be_multi_rxq(adapter))
3668 netdev->hw_features |= NETIF_F_RXHASH; 3668 netdev->hw_features |= NETIF_F_RXHASH;
3669 3669
3670 netdev->features |= netdev->hw_features | 3670 netdev->features |= netdev->hw_features |
3671 NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER; 3671 NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER;
3672 3672
3673 netdev->vlan_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | 3673 netdev->vlan_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 |
3674 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; 3674 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 96fbe3548243..51555445ce2f 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -386,7 +386,7 @@ static void gfar_init_mac(struct net_device *ndev)
386 priv->uses_rxfcb = 1; 386 priv->uses_rxfcb = 1;
387 } 387 }
388 388
389 if (ndev->features & NETIF_F_HW_VLAN_RX) { 389 if (ndev->features & NETIF_F_HW_VLAN_CTAG_RX) {
390 rctrl |= RCTRL_VLEX | RCTRL_PRSDEP_INIT; 390 rctrl |= RCTRL_VLEX | RCTRL_PRSDEP_INIT;
391 priv->uses_rxfcb = 1; 391 priv->uses_rxfcb = 1;
392 } 392 }
@@ -1050,8 +1050,9 @@ static int gfar_probe(struct platform_device *ofdev)
1050 } 1050 }
1051 1051
1052 if (priv->device_flags & FSL_GIANFAR_DEV_HAS_VLAN) { 1052 if (priv->device_flags & FSL_GIANFAR_DEV_HAS_VLAN) {
1053 dev->hw_features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 1053 dev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX |
1054 dev->features |= NETIF_F_HW_VLAN_RX; 1054 NETIF_F_HW_VLAN_CTAG_RX;
1055 dev->features |= NETIF_F_HW_VLAN_CTAG_RX;
1055 } 1056 }
1056 1057
1057 if (priv->device_flags & FSL_GIANFAR_DEV_HAS_EXTENDED_HASH) { 1058 if (priv->device_flags & FSL_GIANFAR_DEV_HAS_EXTENDED_HASH) {
@@ -2348,7 +2349,7 @@ void gfar_vlan_mode(struct net_device *dev, netdev_features_t features)
2348 local_irq_save(flags); 2349 local_irq_save(flags);
2349 lock_rx_qs(priv); 2350 lock_rx_qs(priv);
2350 2351
2351 if (features & NETIF_F_HW_VLAN_TX) { 2352 if (features & NETIF_F_HW_VLAN_CTAG_TX) {
2352 /* Enable VLAN tag insertion */ 2353 /* Enable VLAN tag insertion */
2353 tempval = gfar_read(&regs->tctrl); 2354 tempval = gfar_read(&regs->tctrl);
2354 tempval |= TCTRL_VLINS; 2355 tempval |= TCTRL_VLINS;
@@ -2360,7 +2361,7 @@ void gfar_vlan_mode(struct net_device *dev, netdev_features_t features)
2360 gfar_write(&regs->tctrl, tempval); 2361 gfar_write(&regs->tctrl, tempval);
2361 } 2362 }
2362 2363
2363 if (features & NETIF_F_HW_VLAN_RX) { 2364 if (features & NETIF_F_HW_VLAN_CTAG_RX) {
2364 /* Enable VLAN tag extraction */ 2365 /* Enable VLAN tag extraction */
2365 tempval = gfar_read(&regs->rctrl); 2366 tempval = gfar_read(&regs->rctrl);
2366 tempval |= (RCTRL_VLEX | RCTRL_PRSDEP_INIT); 2367 tempval |= (RCTRL_VLEX | RCTRL_PRSDEP_INIT);
@@ -2724,11 +2725,11 @@ static void gfar_process_frame(struct net_device *dev, struct sk_buff *skb,
2724 /* Tell the skb what kind of packet this is */ 2725 /* Tell the skb what kind of packet this is */
2725 skb->protocol = eth_type_trans(skb, dev); 2726 skb->protocol = eth_type_trans(skb, dev);
2726 2727
2727 /* There's need to check for NETIF_F_HW_VLAN_RX here. 2728 /* There's need to check for NETIF_F_HW_VLAN_CTAG_RX here.
2728 * Even if vlan rx accel is disabled, on some chips 2729 * Even if vlan rx accel is disabled, on some chips
2729 * RXFCB_VLN is pseudo randomly set. 2730 * RXFCB_VLN is pseudo randomly set.
2730 */ 2731 */
2731 if (dev->features & NETIF_F_HW_VLAN_RX && 2732 if (dev->features & NETIF_F_HW_VLAN_CTAG_RX &&
2732 fcb->flags & RXFCB_VLN) 2733 fcb->flags & RXFCB_VLN)
2733 __vlan_hwaccel_put_tag(skb, fcb->vlctl); 2734 __vlan_hwaccel_put_tag(skb, fcb->vlctl);
2734 2735
diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c
index 083603f6bec0..21cd88124ca9 100644
--- a/drivers/net/ethernet/freescale/gianfar_ethtool.c
+++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c
@@ -542,7 +542,7 @@ int gfar_set_features(struct net_device *dev, netdev_features_t features)
542 int err = 0, i = 0; 542 int err = 0, i = 0;
543 netdev_features_t changed = dev->features ^ features; 543 netdev_features_t changed = dev->features ^ features;
544 544
545 if (changed & (NETIF_F_HW_VLAN_TX|NETIF_F_HW_VLAN_RX)) 545 if (changed & (NETIF_F_HW_VLAN_CTAG_TX|NETIF_F_HW_VLAN_CTAG_RX))
546 gfar_vlan_mode(dev, features); 546 gfar_vlan_mode(dev, features);
547 547
548 if (!(changed & NETIF_F_RXCSUM)) 548 if (!(changed & NETIF_F_RXCSUM))
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c
index 029633434474..d1812aacbc7b 100644
--- a/drivers/net/ethernet/ibm/ehea/ehea_main.c
+++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c
@@ -2110,7 +2110,7 @@ static int ehea_start_xmit(struct sk_buff *skb, struct net_device *dev)
2110 return NETDEV_TX_OK; 2110 return NETDEV_TX_OK;
2111} 2111}
2112 2112
2113static int ehea_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) 2113static int ehea_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid)
2114{ 2114{
2115 struct ehea_port *port = netdev_priv(dev); 2115 struct ehea_port *port = netdev_priv(dev);
2116 struct ehea_adapter *adapter = port->adapter; 2116 struct ehea_adapter *adapter = port->adapter;
@@ -2148,7 +2148,7 @@ out:
2148 return err; 2148 return err;
2149} 2149}
2150 2150
2151static int ehea_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) 2151static int ehea_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid)
2152{ 2152{
2153 struct ehea_port *port = netdev_priv(dev); 2153 struct ehea_port *port = netdev_priv(dev);
2154 struct ehea_adapter *adapter = port->adapter; 2154 struct ehea_adapter *adapter = port->adapter;
@@ -3021,11 +3021,11 @@ static struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter,
3021 ehea_set_ethtool_ops(dev); 3021 ehea_set_ethtool_ops(dev);
3022 3022
3023 dev->hw_features = NETIF_F_SG | NETIF_F_TSO 3023 dev->hw_features = NETIF_F_SG | NETIF_F_TSO
3024 | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_TX; 3024 | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_CTAG_TX;
3025 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO 3025 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO
3026 | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_TX 3026 | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM |
3027 | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER 3027 | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX |
3028 | NETIF_F_RXCSUM; 3028 | NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXCSUM;
3029 dev->vlan_features = NETIF_F_SG | NETIF_F_TSO | NETIF_F_HIGHDMA | 3029 dev->vlan_features = NETIF_F_SG | NETIF_F_TSO | NETIF_F_HIGHDMA |
3030 NETIF_F_IP_CSUM; 3030 NETIF_F_IP_CSUM;
3031 dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT; 3031 dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT;
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index d98e1d0996d4..59ad007dd5aa 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -166,8 +166,10 @@ static void e1000_vlan_mode(struct net_device *netdev,
166 netdev_features_t features); 166 netdev_features_t features);
167static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter, 167static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter,
168 bool filter_on); 168 bool filter_on);
169static int e1000_vlan_rx_add_vid(struct net_device *netdev, u16 vid); 169static int e1000_vlan_rx_add_vid(struct net_device *netdev,
170static int e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid); 170 __be16 proto, u16 vid);
171static int e1000_vlan_rx_kill_vid(struct net_device *netdev,
172 __be16 proto, u16 vid);
171static void e1000_restore_vlan(struct e1000_adapter *adapter); 173static void e1000_restore_vlan(struct e1000_adapter *adapter);
172 174
173#ifdef CONFIG_PM 175#ifdef CONFIG_PM
@@ -333,7 +335,7 @@ static void e1000_update_mng_vlan(struct e1000_adapter *adapter)
333 if (!test_bit(vid, adapter->active_vlans)) { 335 if (!test_bit(vid, adapter->active_vlans)) {
334 if (hw->mng_cookie.status & 336 if (hw->mng_cookie.status &
335 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) { 337 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) {
336 e1000_vlan_rx_add_vid(netdev, vid); 338 e1000_vlan_rx_add_vid(netdev, htons(ETH_P_8021Q), vid);
337 adapter->mng_vlan_id = vid; 339 adapter->mng_vlan_id = vid;
338 } else { 340 } else {
339 adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; 341 adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
@@ -341,7 +343,8 @@ static void e1000_update_mng_vlan(struct e1000_adapter *adapter)
341 if ((old_vid != (u16)E1000_MNG_VLAN_NONE) && 343 if ((old_vid != (u16)E1000_MNG_VLAN_NONE) &&
342 (vid != old_vid) && 344 (vid != old_vid) &&
343 !test_bit(old_vid, adapter->active_vlans)) 345 !test_bit(old_vid, adapter->active_vlans))
344 e1000_vlan_rx_kill_vid(netdev, old_vid); 346 e1000_vlan_rx_kill_vid(netdev, htons(ETH_P_8021Q),
347 old_vid);
345 } else { 348 } else {
346 adapter->mng_vlan_id = vid; 349 adapter->mng_vlan_id = vid;
347 } 350 }
@@ -809,10 +812,10 @@ static netdev_features_t e1000_fix_features(struct net_device *netdev,
809 /* Since there is no support for separate Rx/Tx vlan accel 812 /* Since there is no support for separate Rx/Tx vlan accel
810 * enable/disable make sure Tx flag is always in same state as Rx. 813 * enable/disable make sure Tx flag is always in same state as Rx.
811 */ 814 */
812 if (features & NETIF_F_HW_VLAN_RX) 815 if (features & NETIF_F_HW_VLAN_CTAG_RX)
813 features |= NETIF_F_HW_VLAN_TX; 816 features |= NETIF_F_HW_VLAN_CTAG_TX;
814 else 817 else
815 features &= ~NETIF_F_HW_VLAN_TX; 818 features &= ~NETIF_F_HW_VLAN_CTAG_TX;
816 819
817 return features; 820 return features;
818} 821}
@@ -823,7 +826,7 @@ static int e1000_set_features(struct net_device *netdev,
823 struct e1000_adapter *adapter = netdev_priv(netdev); 826 struct e1000_adapter *adapter = netdev_priv(netdev);
824 netdev_features_t changed = features ^ netdev->features; 827 netdev_features_t changed = features ^ netdev->features;
825 828
826 if (changed & NETIF_F_HW_VLAN_RX) 829 if (changed & NETIF_F_HW_VLAN_CTAG_RX)
827 e1000_vlan_mode(netdev, features); 830 e1000_vlan_mode(netdev, features);
828 831
829 if (!(changed & (NETIF_F_RXCSUM | NETIF_F_RXALL))) 832 if (!(changed & (NETIF_F_RXCSUM | NETIF_F_RXALL)))
@@ -1058,9 +1061,9 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1058 if (hw->mac_type >= e1000_82543) { 1061 if (hw->mac_type >= e1000_82543) {
1059 netdev->hw_features = NETIF_F_SG | 1062 netdev->hw_features = NETIF_F_SG |
1060 NETIF_F_HW_CSUM | 1063 NETIF_F_HW_CSUM |
1061 NETIF_F_HW_VLAN_RX; 1064 NETIF_F_HW_VLAN_CTAG_RX;
1062 netdev->features = NETIF_F_HW_VLAN_TX | 1065 netdev->features = NETIF_F_HW_VLAN_CTAG_TX |
1063 NETIF_F_HW_VLAN_FILTER; 1066 NETIF_F_HW_VLAN_CTAG_FILTER;
1064 } 1067 }
1065 1068
1066 if ((hw->mac_type >= e1000_82544) && 1069 if ((hw->mac_type >= e1000_82544) &&
@@ -1457,7 +1460,8 @@ static int e1000_close(struct net_device *netdev)
1457 if ((hw->mng_cookie.status & 1460 if ((hw->mng_cookie.status &
1458 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) && 1461 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) &&
1459 !test_bit(adapter->mng_vlan_id, adapter->active_vlans)) { 1462 !test_bit(adapter->mng_vlan_id, adapter->active_vlans)) {
1460 e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id); 1463 e1000_vlan_rx_kill_vid(netdev, htons(ETH_P_8021Q),
1464 adapter->mng_vlan_id);
1461 } 1465 }
1462 1466
1463 return 0; 1467 return 0;
@@ -3999,7 +4003,7 @@ static void e1000_receive_skb(struct e1000_adapter *adapter, u8 status,
3999 if (status & E1000_RXD_STAT_VP) { 4003 if (status & E1000_RXD_STAT_VP) {
4000 u16 vid = le16_to_cpu(vlan) & E1000_RXD_SPC_VLAN_MASK; 4004 u16 vid = le16_to_cpu(vlan) & E1000_RXD_SPC_VLAN_MASK;
4001 4005
4002 __vlan_hwaccel_put_tag(skb, vid); 4006 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
4003 } 4007 }
4004 napi_gro_receive(&adapter->napi, skb); 4008 napi_gro_receive(&adapter->napi, skb);
4005} 4009}
@@ -4785,7 +4789,7 @@ static void __e1000_vlan_mode(struct e1000_adapter *adapter,
4785 u32 ctrl; 4789 u32 ctrl;
4786 4790
4787 ctrl = er32(CTRL); 4791 ctrl = er32(CTRL);
4788 if (features & NETIF_F_HW_VLAN_RX) { 4792 if (features & NETIF_F_HW_VLAN_CTAG_RX) {
4789 /* enable VLAN tag insert/strip */ 4793 /* enable VLAN tag insert/strip */
4790 ctrl |= E1000_CTRL_VME; 4794 ctrl |= E1000_CTRL_VME;
4791 } else { 4795 } else {
@@ -4837,7 +4841,8 @@ static void e1000_vlan_mode(struct net_device *netdev,
4837 e1000_irq_enable(adapter); 4841 e1000_irq_enable(adapter);
4838} 4842}
4839 4843
4840static int e1000_vlan_rx_add_vid(struct net_device *netdev, u16 vid) 4844static int e1000_vlan_rx_add_vid(struct net_device *netdev,
4845 __be16 proto, u16 vid)
4841{ 4846{
4842 struct e1000_adapter *adapter = netdev_priv(netdev); 4847 struct e1000_adapter *adapter = netdev_priv(netdev);
4843 struct e1000_hw *hw = &adapter->hw; 4848 struct e1000_hw *hw = &adapter->hw;
@@ -4862,7 +4867,8 @@ static int e1000_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
4862 return 0; 4867 return 0;
4863} 4868}
4864 4869
4865static int e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid) 4870static int e1000_vlan_rx_kill_vid(struct net_device *netdev,
4871 __be16 proto, u16 vid)
4866{ 4872{
4867 struct e1000_adapter *adapter = netdev_priv(netdev); 4873 struct e1000_adapter *adapter = netdev_priv(netdev);
4868 struct e1000_hw *hw = &adapter->hw; 4874 struct e1000_hw *hw = &adapter->hw;
@@ -4896,7 +4902,7 @@ static void e1000_restore_vlan(struct e1000_adapter *adapter)
4896 4902
4897 e1000_vlan_filter_on_off(adapter, true); 4903 e1000_vlan_filter_on_off(adapter, true);
4898 for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID) 4904 for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID)
4899 e1000_vlan_rx_add_vid(adapter->netdev, vid); 4905 e1000_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), vid);
4900} 4906}
4901 4907
4902int e1000_set_spd_dplx(struct e1000_adapter *adapter, u32 spd, u8 dplx) 4908int e1000_set_spd_dplx(struct e1000_adapter *adapter, u32 spd, u8 dplx)
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index b18fad5b579e..da7f2fad5ba4 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -554,7 +554,7 @@ static void e1000_receive_skb(struct e1000_adapter *adapter,
554 skb->protocol = eth_type_trans(skb, netdev); 554 skb->protocol = eth_type_trans(skb, netdev);
555 555
556 if (staterr & E1000_RXD_STAT_VP) 556 if (staterr & E1000_RXD_STAT_VP)
557 __vlan_hwaccel_put_tag(skb, tag); 557 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), tag);
558 558
559 napi_gro_receive(&adapter->napi, skb); 559 napi_gro_receive(&adapter->napi, skb);
560} 560}
@@ -2672,7 +2672,8 @@ static int e1000e_poll(struct napi_struct *napi, int weight)
2672 return work_done; 2672 return work_done;
2673} 2673}
2674 2674
2675static int e1000_vlan_rx_add_vid(struct net_device *netdev, u16 vid) 2675static int e1000_vlan_rx_add_vid(struct net_device *netdev,
2676 __be16 proto, u16 vid)
2676{ 2677{
2677 struct e1000_adapter *adapter = netdev_priv(netdev); 2678 struct e1000_adapter *adapter = netdev_priv(netdev);
2678 struct e1000_hw *hw = &adapter->hw; 2679 struct e1000_hw *hw = &adapter->hw;
@@ -2697,7 +2698,8 @@ static int e1000_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
2697 return 0; 2698 return 0;
2698} 2699}
2699 2700
2700static int e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid) 2701static int e1000_vlan_rx_kill_vid(struct net_device *netdev,
2702 __be16 proto, u16 vid)
2701{ 2703{
2702 struct e1000_adapter *adapter = netdev_priv(netdev); 2704 struct e1000_adapter *adapter = netdev_priv(netdev);
2703 struct e1000_hw *hw = &adapter->hw; 2705 struct e1000_hw *hw = &adapter->hw;
@@ -2741,7 +2743,8 @@ static void e1000e_vlan_filter_disable(struct e1000_adapter *adapter)
2741 ew32(RCTL, rctl); 2743 ew32(RCTL, rctl);
2742 2744
2743 if (adapter->mng_vlan_id != (u16)E1000_MNG_VLAN_NONE) { 2745 if (adapter->mng_vlan_id != (u16)E1000_MNG_VLAN_NONE) {
2744 e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id); 2746 e1000_vlan_rx_kill_vid(netdev, htons(ETH_P_8021Q),
2747 adapter->mng_vlan_id);
2745 adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; 2748 adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
2746 } 2749 }
2747 } 2750 }
@@ -2802,22 +2805,22 @@ static void e1000_update_mng_vlan(struct e1000_adapter *adapter)
2802 u16 old_vid = adapter->mng_vlan_id; 2805 u16 old_vid = adapter->mng_vlan_id;
2803 2806
2804 if (adapter->hw.mng_cookie.status & E1000_MNG_DHCP_COOKIE_STATUS_VLAN) { 2807 if (adapter->hw.mng_cookie.status & E1000_MNG_DHCP_COOKIE_STATUS_VLAN) {
2805 e1000_vlan_rx_add_vid(netdev, vid); 2808 e1000_vlan_rx_add_vid(netdev, htons(ETH_P_8021Q), vid);
2806 adapter->mng_vlan_id = vid; 2809 adapter->mng_vlan_id = vid;
2807 } 2810 }
2808 2811
2809 if ((old_vid != (u16)E1000_MNG_VLAN_NONE) && (vid != old_vid)) 2812 if ((old_vid != (u16)E1000_MNG_VLAN_NONE) && (vid != old_vid))
2810 e1000_vlan_rx_kill_vid(netdev, old_vid); 2813 e1000_vlan_rx_kill_vid(netdev, htons(ETH_P_8021Q), old_vid);
2811} 2814}
2812 2815
2813static void e1000_restore_vlan(struct e1000_adapter *adapter) 2816static void e1000_restore_vlan(struct e1000_adapter *adapter)
2814{ 2817{
2815 u16 vid; 2818 u16 vid;
2816 2819
2817 e1000_vlan_rx_add_vid(adapter->netdev, 0); 2820 e1000_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), 0);
2818 2821
2819 for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID) 2822 for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID)
2820 e1000_vlan_rx_add_vid(adapter->netdev, vid); 2823 e1000_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), vid);
2821} 2824}
2822 2825
2823static void e1000_init_manageability_pt(struct e1000_adapter *adapter) 2826static void e1000_init_manageability_pt(struct e1000_adapter *adapter)
@@ -3373,7 +3376,7 @@ static void e1000e_set_rx_mode(struct net_device *netdev)
3373 3376
3374 ew32(RCTL, rctl); 3377 ew32(RCTL, rctl);
3375 3378
3376 if (netdev->features & NETIF_F_HW_VLAN_RX) 3379 if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX)
3377 e1000e_vlan_strip_enable(adapter); 3380 e1000e_vlan_strip_enable(adapter);
3378 else 3381 else
3379 e1000e_vlan_strip_disable(adapter); 3382 e1000e_vlan_strip_disable(adapter);
@@ -4384,7 +4387,8 @@ static int e1000_close(struct net_device *netdev)
4384 * the same ID is registered on the host OS (let 8021q kill it) 4387 * the same ID is registered on the host OS (let 8021q kill it)
4385 */ 4388 */
4386 if (adapter->hw.mng_cookie.status & E1000_MNG_DHCP_COOKIE_STATUS_VLAN) 4389 if (adapter->hw.mng_cookie.status & E1000_MNG_DHCP_COOKIE_STATUS_VLAN)
4387 e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id); 4390 e1000_vlan_rx_kill_vid(netdev, htons(ETH_P_8021Q),
4391 adapter->mng_vlan_id);
4388 4392
4389 /* If AMT is enabled, let the firmware know that the network 4393 /* If AMT is enabled, let the firmware know that the network
4390 * interface is now closed 4394 * interface is now closed
@@ -6418,7 +6422,7 @@ static int e1000_set_features(struct net_device *netdev,
6418 if (changed & (NETIF_F_TSO | NETIF_F_TSO6)) 6422 if (changed & (NETIF_F_TSO | NETIF_F_TSO6))
6419 adapter->flags |= FLAG_TSO_FORCE; 6423 adapter->flags |= FLAG_TSO_FORCE;
6420 6424
6421 if (!(changed & (NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX | 6425 if (!(changed & (NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX |
6422 NETIF_F_RXCSUM | NETIF_F_RXHASH | NETIF_F_RXFCS | 6426 NETIF_F_RXCSUM | NETIF_F_RXHASH | NETIF_F_RXFCS |
6423 NETIF_F_RXALL))) 6427 NETIF_F_RXALL)))
6424 return 0; 6428 return 0;
@@ -6629,8 +6633,8 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
6629 6633
6630 /* Set initial default active device features */ 6634 /* Set initial default active device features */
6631 netdev->features = (NETIF_F_SG | 6635 netdev->features = (NETIF_F_SG |
6632 NETIF_F_HW_VLAN_RX | 6636 NETIF_F_HW_VLAN_CTAG_RX |
6633 NETIF_F_HW_VLAN_TX | 6637 NETIF_F_HW_VLAN_CTAG_TX |
6634 NETIF_F_TSO | 6638 NETIF_F_TSO |
6635 NETIF_F_TSO6 | 6639 NETIF_F_TSO6 |
6636 NETIF_F_RXHASH | 6640 NETIF_F_RXHASH |
@@ -6644,7 +6648,7 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
6644 netdev->hw_features |= NETIF_F_RXALL; 6648 netdev->hw_features |= NETIF_F_RXALL;
6645 6649
6646 if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) 6650 if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER)
6647 netdev->features |= NETIF_F_HW_VLAN_FILTER; 6651 netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
6648 6652
6649 netdev->vlan_features |= (NETIF_F_SG | 6653 netdev->vlan_features |= (NETIF_F_SG |
6650 NETIF_F_TSO | 6654 NETIF_F_TSO |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 38590252be64..9bf08b977daa 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -159,8 +159,8 @@ static int igb_ioctl(struct net_device *, struct ifreq *, int cmd);
159static void igb_tx_timeout(struct net_device *); 159static void igb_tx_timeout(struct net_device *);
160static void igb_reset_task(struct work_struct *); 160static void igb_reset_task(struct work_struct *);
161static void igb_vlan_mode(struct net_device *netdev, netdev_features_t features); 161static void igb_vlan_mode(struct net_device *netdev, netdev_features_t features);
162static int igb_vlan_rx_add_vid(struct net_device *, u16); 162static int igb_vlan_rx_add_vid(struct net_device *, __be16, u16);
163static int igb_vlan_rx_kill_vid(struct net_device *, u16); 163static int igb_vlan_rx_kill_vid(struct net_device *, __be16, u16);
164static void igb_restore_vlan(struct igb_adapter *); 164static void igb_restore_vlan(struct igb_adapter *);
165static void igb_rar_set_qsel(struct igb_adapter *, u8 *, u32 , u8); 165static void igb_rar_set_qsel(struct igb_adapter *, u8 *, u32 , u8);
166static void igb_ping_all_vfs(struct igb_adapter *); 166static void igb_ping_all_vfs(struct igb_adapter *);
@@ -1860,10 +1860,10 @@ static netdev_features_t igb_fix_features(struct net_device *netdev,
1860 /* Since there is no support for separate Rx/Tx vlan accel 1860 /* Since there is no support for separate Rx/Tx vlan accel
1861 * enable/disable make sure Tx flag is always in same state as Rx. 1861 * enable/disable make sure Tx flag is always in same state as Rx.
1862 */ 1862 */
1863 if (features & NETIF_F_HW_VLAN_RX) 1863 if (features & NETIF_F_HW_VLAN_CTAG_RX)
1864 features |= NETIF_F_HW_VLAN_TX; 1864 features |= NETIF_F_HW_VLAN_CTAG_TX;
1865 else 1865 else
1866 features &= ~NETIF_F_HW_VLAN_TX; 1866 features &= ~NETIF_F_HW_VLAN_CTAG_TX;
1867 1867
1868 return features; 1868 return features;
1869} 1869}
@@ -1874,7 +1874,7 @@ static int igb_set_features(struct net_device *netdev,
1874 netdev_features_t changed = netdev->features ^ features; 1874 netdev_features_t changed = netdev->features ^ features;
1875 struct igb_adapter *adapter = netdev_priv(netdev); 1875 struct igb_adapter *adapter = netdev_priv(netdev);
1876 1876
1877 if (changed & NETIF_F_HW_VLAN_RX) 1877 if (changed & NETIF_F_HW_VLAN_CTAG_RX)
1878 igb_vlan_mode(netdev, features); 1878 igb_vlan_mode(netdev, features);
1879 1879
1880 if (!(changed & NETIF_F_RXALL)) 1880 if (!(changed & NETIF_F_RXALL))
@@ -2127,15 +2127,15 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2127 NETIF_F_TSO6 | 2127 NETIF_F_TSO6 |
2128 NETIF_F_RXHASH | 2128 NETIF_F_RXHASH |
2129 NETIF_F_RXCSUM | 2129 NETIF_F_RXCSUM |
2130 NETIF_F_HW_VLAN_RX | 2130 NETIF_F_HW_VLAN_CTAG_RX |
2131 NETIF_F_HW_VLAN_TX; 2131 NETIF_F_HW_VLAN_CTAG_TX;
2132 2132
2133 /* copy netdev features into list of user selectable features */ 2133 /* copy netdev features into list of user selectable features */
2134 netdev->hw_features |= netdev->features; 2134 netdev->hw_features |= netdev->features;
2135 netdev->hw_features |= NETIF_F_RXALL; 2135 netdev->hw_features |= NETIF_F_RXALL;
2136 2136
2137 /* set this bit last since it cannot be part of hw_features */ 2137 /* set this bit last since it cannot be part of hw_features */
2138 netdev->features |= NETIF_F_HW_VLAN_FILTER; 2138 netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
2139 2139
2140 netdev->vlan_features |= NETIF_F_TSO | 2140 netdev->vlan_features |= NETIF_F_TSO |
2141 NETIF_F_TSO6 | 2141 NETIF_F_TSO6 |
@@ -6674,7 +6674,7 @@ static void igb_process_skb_fields(struct igb_ring *rx_ring,
6674 6674
6675 igb_ptp_rx_hwtstamp(rx_ring->q_vector, rx_desc, skb); 6675 igb_ptp_rx_hwtstamp(rx_ring->q_vector, rx_desc, skb);
6676 6676
6677 if ((dev->features & NETIF_F_HW_VLAN_RX) && 6677 if ((dev->features & NETIF_F_HW_VLAN_CTAG_RX) &&
6678 igb_test_staterr(rx_desc, E1000_RXD_STAT_VP)) { 6678 igb_test_staterr(rx_desc, E1000_RXD_STAT_VP)) {
6679 u16 vid; 6679 u16 vid;
6680 if (igb_test_staterr(rx_desc, E1000_RXDEXT_STATERR_LB) && 6680 if (igb_test_staterr(rx_desc, E1000_RXDEXT_STATERR_LB) &&
@@ -6683,7 +6683,7 @@ static void igb_process_skb_fields(struct igb_ring *rx_ring,
6683 else 6683 else
6684 vid = le16_to_cpu(rx_desc->wb.upper.vlan); 6684 vid = le16_to_cpu(rx_desc->wb.upper.vlan);
6685 6685
6686 __vlan_hwaccel_put_tag(skb, vid); 6686 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
6687 } 6687 }
6688 6688
6689 skb_record_rx_queue(skb, rx_ring->queue_index); 6689 skb_record_rx_queue(skb, rx_ring->queue_index);
@@ -6954,7 +6954,7 @@ static void igb_vlan_mode(struct net_device *netdev, netdev_features_t features)
6954 struct igb_adapter *adapter = netdev_priv(netdev); 6954 struct igb_adapter *adapter = netdev_priv(netdev);
6955 struct e1000_hw *hw = &adapter->hw; 6955 struct e1000_hw *hw = &adapter->hw;
6956 u32 ctrl, rctl; 6956 u32 ctrl, rctl;
6957 bool enable = !!(features & NETIF_F_HW_VLAN_RX); 6957 bool enable = !!(features & NETIF_F_HW_VLAN_CTAG_RX);
6958 6958
6959 if (enable) { 6959 if (enable) {
6960 /* enable VLAN tag insert/strip */ 6960 /* enable VLAN tag insert/strip */
@@ -6976,7 +6976,8 @@ static void igb_vlan_mode(struct net_device *netdev, netdev_features_t features)
6976 igb_rlpml_set(adapter); 6976 igb_rlpml_set(adapter);
6977} 6977}
6978 6978
6979static int igb_vlan_rx_add_vid(struct net_device *netdev, u16 vid) 6979static int igb_vlan_rx_add_vid(struct net_device *netdev,
6980 __be16 proto, u16 vid)
6980{ 6981{
6981 struct igb_adapter *adapter = netdev_priv(netdev); 6982 struct igb_adapter *adapter = netdev_priv(netdev);
6982 struct e1000_hw *hw = &adapter->hw; 6983 struct e1000_hw *hw = &adapter->hw;
@@ -6993,7 +6994,8 @@ static int igb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
6993 return 0; 6994 return 0;
6994} 6995}
6995 6996
6996static int igb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid) 6997static int igb_vlan_rx_kill_vid(struct net_device *netdev,
6998 __be16 proto, u16 vid)
6997{ 6999{
6998 struct igb_adapter *adapter = netdev_priv(netdev); 7000 struct igb_adapter *adapter = netdev_priv(netdev);
6999 struct e1000_hw *hw = &adapter->hw; 7001 struct e1000_hw *hw = &adapter->hw;
@@ -7019,7 +7021,7 @@ static void igb_restore_vlan(struct igb_adapter *adapter)
7019 igb_vlan_mode(adapter->netdev, adapter->netdev->features); 7021 igb_vlan_mode(adapter->netdev, adapter->netdev->features);
7020 7022
7021 for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID) 7023 for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID)
7022 igb_vlan_rx_add_vid(adapter->netdev, vid); 7024 igb_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), vid);
7023} 7025}
7024 7026
7025int igb_set_spd_dplx(struct igb_adapter *adapter, u32 spd, u8 dplx) 7027int igb_set_spd_dplx(struct igb_adapter *adapter, u32 spd, u8 dplx)
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c
index bea46bb26061..93eb7ee06d3e 100644
--- a/drivers/net/ethernet/intel/igbvf/netdev.c
+++ b/drivers/net/ethernet/intel/igbvf/netdev.c
@@ -116,7 +116,7 @@ static void igbvf_receive_skb(struct igbvf_adapter *adapter,
116 else 116 else
117 vid = le16_to_cpu(vlan) & E1000_RXD_SPC_VLAN_MASK; 117 vid = le16_to_cpu(vlan) & E1000_RXD_SPC_VLAN_MASK;
118 if (test_bit(vid, adapter->active_vlans)) 118 if (test_bit(vid, adapter->active_vlans))
119 __vlan_hwaccel_put_tag(skb, vid); 119 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
120 } 120 }
121 121
122 napi_gro_receive(&adapter->rx_ring->napi, skb); 122 napi_gro_receive(&adapter->rx_ring->napi, skb);
@@ -1230,7 +1230,8 @@ static void igbvf_set_rlpml(struct igbvf_adapter *adapter)
1230 e1000_rlpml_set_vf(hw, max_frame_size); 1230 e1000_rlpml_set_vf(hw, max_frame_size);
1231} 1231}
1232 1232
1233static int igbvf_vlan_rx_add_vid(struct net_device *netdev, u16 vid) 1233static int igbvf_vlan_rx_add_vid(struct net_device *netdev,
1234 __be16 proto, u16 vid)
1234{ 1235{
1235 struct igbvf_adapter *adapter = netdev_priv(netdev); 1236 struct igbvf_adapter *adapter = netdev_priv(netdev);
1236 struct e1000_hw *hw = &adapter->hw; 1237 struct e1000_hw *hw = &adapter->hw;
@@ -1243,7 +1244,8 @@ static int igbvf_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
1243 return 0; 1244 return 0;
1244} 1245}
1245 1246
1246static int igbvf_vlan_rx_kill_vid(struct net_device *netdev, u16 vid) 1247static int igbvf_vlan_rx_kill_vid(struct net_device *netdev,
1248 __be16 proto, u16 vid)
1247{ 1249{
1248 struct igbvf_adapter *adapter = netdev_priv(netdev); 1250 struct igbvf_adapter *adapter = netdev_priv(netdev);
1249 struct e1000_hw *hw = &adapter->hw; 1251 struct e1000_hw *hw = &adapter->hw;
@@ -1262,7 +1264,7 @@ static void igbvf_restore_vlan(struct igbvf_adapter *adapter)
1262 u16 vid; 1264 u16 vid;
1263 1265
1264 for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID) 1266 for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID)
1265 igbvf_vlan_rx_add_vid(adapter->netdev, vid); 1267 igbvf_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), vid);
1266} 1268}
1267 1269
1268/** 1270/**
@@ -2722,9 +2724,9 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2722 NETIF_F_RXCSUM; 2724 NETIF_F_RXCSUM;
2723 2725
2724 netdev->features = netdev->hw_features | 2726 netdev->features = netdev->hw_features |
2725 NETIF_F_HW_VLAN_TX | 2727 NETIF_F_HW_VLAN_CTAG_TX |
2726 NETIF_F_HW_VLAN_RX | 2728 NETIF_F_HW_VLAN_CTAG_RX |
2727 NETIF_F_HW_VLAN_FILTER; 2729 NETIF_F_HW_VLAN_CTAG_FILTER;
2728 2730
2729 if (pci_using_dac) 2731 if (pci_using_dac)
2730 netdev->features |= NETIF_F_HIGHDMA; 2732 netdev->features |= NETIF_F_HIGHDMA;
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
index 5dc119fd95a8..fce3e92f9d11 100644
--- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c
+++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
@@ -101,8 +101,10 @@ static void ixgb_tx_timeout_task(struct work_struct *work);
101 101
102static void ixgb_vlan_strip_enable(struct ixgb_adapter *adapter); 102static void ixgb_vlan_strip_enable(struct ixgb_adapter *adapter);
103static void ixgb_vlan_strip_disable(struct ixgb_adapter *adapter); 103static void ixgb_vlan_strip_disable(struct ixgb_adapter *adapter);
104static int ixgb_vlan_rx_add_vid(struct net_device *netdev, u16 vid); 104static int ixgb_vlan_rx_add_vid(struct net_device *netdev,
105static int ixgb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid); 105 __be16 proto, u16 vid);
106static int ixgb_vlan_rx_kill_vid(struct net_device *netdev,
107 __be16 proto, u16 vid);
106static void ixgb_restore_vlan(struct ixgb_adapter *adapter); 108static void ixgb_restore_vlan(struct ixgb_adapter *adapter);
107 109
108#ifdef CONFIG_NET_POLL_CONTROLLER 110#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -332,8 +334,8 @@ ixgb_fix_features(struct net_device *netdev, netdev_features_t features)
332 * Tx VLAN insertion does not work per HW design when Rx stripping is 334 * Tx VLAN insertion does not work per HW design when Rx stripping is
333 * disabled. 335 * disabled.
334 */ 336 */
335 if (!(features & NETIF_F_HW_VLAN_RX)) 337 if (!(features & NETIF_F_HW_VLAN_CTAG_RX))
336 features &= ~NETIF_F_HW_VLAN_TX; 338 features &= ~NETIF_F_HW_VLAN_CTAG_TX;
337 339
338 return features; 340 return features;
339} 341}
@@ -344,7 +346,7 @@ ixgb_set_features(struct net_device *netdev, netdev_features_t features)
344 struct ixgb_adapter *adapter = netdev_priv(netdev); 346 struct ixgb_adapter *adapter = netdev_priv(netdev);
345 netdev_features_t changed = features ^ netdev->features; 347 netdev_features_t changed = features ^ netdev->features;
346 348
347 if (!(changed & (NETIF_F_RXCSUM|NETIF_F_HW_VLAN_RX))) 349 if (!(changed & (NETIF_F_RXCSUM|NETIF_F_HW_VLAN_CTAG_RX)))
348 return 0; 350 return 0;
349 351
350 adapter->rx_csum = !!(features & NETIF_F_RXCSUM); 352 adapter->rx_csum = !!(features & NETIF_F_RXCSUM);
@@ -479,10 +481,10 @@ ixgb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
479 netdev->hw_features = NETIF_F_SG | 481 netdev->hw_features = NETIF_F_SG |
480 NETIF_F_TSO | 482 NETIF_F_TSO |
481 NETIF_F_HW_CSUM | 483 NETIF_F_HW_CSUM |
482 NETIF_F_HW_VLAN_TX | 484 NETIF_F_HW_VLAN_CTAG_TX |
483 NETIF_F_HW_VLAN_RX; 485 NETIF_F_HW_VLAN_CTAG_RX;
484 netdev->features = netdev->hw_features | 486 netdev->features = netdev->hw_features |
485 NETIF_F_HW_VLAN_FILTER; 487 NETIF_F_HW_VLAN_CTAG_FILTER;
486 netdev->hw_features |= NETIF_F_RXCSUM; 488 netdev->hw_features |= NETIF_F_RXCSUM;
487 489
488 if (pci_using_dac) { 490 if (pci_using_dac) {
@@ -1140,7 +1142,7 @@ ixgb_set_multi(struct net_device *netdev)
1140 } 1142 }
1141 1143
1142alloc_failed: 1144alloc_failed:
1143 if (netdev->features & NETIF_F_HW_VLAN_RX) 1145 if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX)
1144 ixgb_vlan_strip_enable(adapter); 1146 ixgb_vlan_strip_enable(adapter);
1145 else 1147 else
1146 ixgb_vlan_strip_disable(adapter); 1148 ixgb_vlan_strip_disable(adapter);
@@ -2080,8 +2082,8 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter, int *work_done, int work_to_do)
2080 2082
2081 skb->protocol = eth_type_trans(skb, netdev); 2083 skb->protocol = eth_type_trans(skb, netdev);
2082 if (status & IXGB_RX_DESC_STATUS_VP) 2084 if (status & IXGB_RX_DESC_STATUS_VP)
2083 __vlan_hwaccel_put_tag(skb, 2085 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
2084 le16_to_cpu(rx_desc->special)); 2086 le16_to_cpu(rx_desc->special));
2085 2087
2086 netif_receive_skb(skb); 2088 netif_receive_skb(skb);
2087 2089
@@ -2209,7 +2211,7 @@ ixgb_vlan_strip_disable(struct ixgb_adapter *adapter)
2209} 2211}
2210 2212
2211static int 2213static int
2212ixgb_vlan_rx_add_vid(struct net_device *netdev, u16 vid) 2214ixgb_vlan_rx_add_vid(struct net_device *netdev, __be16 proto, u16 vid)
2213{ 2215{
2214 struct ixgb_adapter *adapter = netdev_priv(netdev); 2216 struct ixgb_adapter *adapter = netdev_priv(netdev);
2215 u32 vfta, index; 2217 u32 vfta, index;
@@ -2226,7 +2228,7 @@ ixgb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
2226} 2228}
2227 2229
2228static int 2230static int
2229ixgb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid) 2231ixgb_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid)
2230{ 2232{
2231 struct ixgb_adapter *adapter = netdev_priv(netdev); 2233 struct ixgb_adapter *adapter = netdev_priv(netdev);
2232 u32 vfta, index; 2234 u32 vfta, index;
@@ -2248,7 +2250,7 @@ ixgb_restore_vlan(struct ixgb_adapter *adapter)
2248 u16 vid; 2250 u16 vid;
2249 2251
2250 for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID) 2252 for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID)
2251 ixgb_vlan_rx_add_vid(adapter->netdev, vid); 2253 ixgb_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), vid);
2252} 2254}
2253 2255
2254#ifdef CONFIG_NET_POLL_CONTROLLER 2256#ifdef CONFIG_NET_POLL_CONTROLLER
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index c022f9c417a6..6225f880a3f4 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -1488,10 +1488,10 @@ static void ixgbe_process_skb_fields(struct ixgbe_ring *rx_ring,
1488 1488
1489 ixgbe_ptp_rx_hwtstamp(rx_ring, rx_desc, skb); 1489 ixgbe_ptp_rx_hwtstamp(rx_ring, rx_desc, skb);
1490 1490
1491 if ((dev->features & NETIF_F_HW_VLAN_RX) && 1491 if ((dev->features & NETIF_F_HW_VLAN_CTAG_RX) &&
1492 ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_VP)) { 1492 ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_VP)) {
1493 u16 vid = le16_to_cpu(rx_desc->wb.upper.vlan); 1493 u16 vid = le16_to_cpu(rx_desc->wb.upper.vlan);
1494 __vlan_hwaccel_put_tag(skb, vid); 1494 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
1495 } 1495 }
1496 1496
1497 skb_record_rx_queue(skb, rx_ring->queue_index); 1497 skb_record_rx_queue(skb, rx_ring->queue_index);
@@ -3467,7 +3467,8 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
3467 hw->mac.ops.enable_rx_dma(hw, rxctrl); 3467 hw->mac.ops.enable_rx_dma(hw, rxctrl);
3468} 3468}
3469 3469
3470static int ixgbe_vlan_rx_add_vid(struct net_device *netdev, u16 vid) 3470static int ixgbe_vlan_rx_add_vid(struct net_device *netdev,
3471 __be16 proto, u16 vid)
3471{ 3472{
3472 struct ixgbe_adapter *adapter = netdev_priv(netdev); 3473 struct ixgbe_adapter *adapter = netdev_priv(netdev);
3473 struct ixgbe_hw *hw = &adapter->hw; 3474 struct ixgbe_hw *hw = &adapter->hw;
@@ -3479,7 +3480,8 @@ static int ixgbe_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
3479 return 0; 3480 return 0;
3480} 3481}
3481 3482
3482static int ixgbe_vlan_rx_kill_vid(struct net_device *netdev, u16 vid) 3483static int ixgbe_vlan_rx_kill_vid(struct net_device *netdev,
3484 __be16 proto, u16 vid)
3483{ 3485{
3484 struct ixgbe_adapter *adapter = netdev_priv(netdev); 3486 struct ixgbe_adapter *adapter = netdev_priv(netdev);
3485 struct ixgbe_hw *hw = &adapter->hw; 3487 struct ixgbe_hw *hw = &adapter->hw;
@@ -3584,10 +3586,10 @@ static void ixgbe_restore_vlan(struct ixgbe_adapter *adapter)
3584{ 3586{
3585 u16 vid; 3587 u16 vid;
3586 3588
3587 ixgbe_vlan_rx_add_vid(adapter->netdev, 0); 3589 ixgbe_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), 0);
3588 3590
3589 for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID) 3591 for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID)
3590 ixgbe_vlan_rx_add_vid(adapter->netdev, vid); 3592 ixgbe_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), vid);
3591} 3593}
3592 3594
3593/** 3595/**
@@ -3722,7 +3724,7 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
3722 3724
3723 IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl); 3725 IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl);
3724 3726
3725 if (netdev->features & NETIF_F_HW_VLAN_RX) 3727 if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX)
3726 ixgbe_vlan_strip_enable(adapter); 3728 ixgbe_vlan_strip_enable(adapter);
3727 else 3729 else
3728 ixgbe_vlan_strip_disable(adapter); 3730 ixgbe_vlan_strip_disable(adapter);
@@ -7024,7 +7026,7 @@ static int ixgbe_set_features(struct net_device *netdev,
7024 break; 7026 break;
7025 } 7027 }
7026 7028
7027 if (features & NETIF_F_HW_VLAN_RX) 7029 if (features & NETIF_F_HW_VLAN_CTAG_RX)
7028 ixgbe_vlan_strip_enable(adapter); 7030 ixgbe_vlan_strip_enable(adapter);
7029 else 7031 else
7030 ixgbe_vlan_strip_disable(adapter); 7032 ixgbe_vlan_strip_disable(adapter);
@@ -7431,9 +7433,9 @@ skip_sriov:
7431 netdev->features = NETIF_F_SG | 7433 netdev->features = NETIF_F_SG |
7432 NETIF_F_IP_CSUM | 7434 NETIF_F_IP_CSUM |
7433 NETIF_F_IPV6_CSUM | 7435 NETIF_F_IPV6_CSUM |
7434 NETIF_F_HW_VLAN_TX | 7436 NETIF_F_HW_VLAN_CTAG_TX |
7435 NETIF_F_HW_VLAN_RX | 7437 NETIF_F_HW_VLAN_CTAG_RX |
7436 NETIF_F_HW_VLAN_FILTER | 7438 NETIF_F_HW_VLAN_CTAG_FILTER |
7437 NETIF_F_TSO | 7439 NETIF_F_TSO |
7438 NETIF_F_TSO6 | 7440 NETIF_F_TSO6 |
7439 NETIF_F_RXHASH | 7441 NETIF_F_RXHASH |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index b3e6530637e3..2d4bdcc4fdbe 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -35,7 +35,7 @@
35#include <linux/ip.h> 35#include <linux/ip.h>
36#include <linux/tcp.h> 36#include <linux/tcp.h>
37#include <linux/ipv6.h> 37#include <linux/ipv6.h>
38#ifdef NETIF_F_HW_VLAN_TX 38#ifdef NETIF_F_HW_VLAN_CTAG_TX
39#include <linux/if_vlan.h> 39#include <linux/if_vlan.h>
40#endif 40#endif
41 41
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index eeae9349f78b..1f5166ad6bb5 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -291,7 +291,7 @@ static void ixgbevf_receive_skb(struct ixgbevf_q_vector *q_vector,
291 u16 tag = le16_to_cpu(rx_desc->wb.upper.vlan); 291 u16 tag = le16_to_cpu(rx_desc->wb.upper.vlan);
292 292
293 if (is_vlan && test_bit(tag & VLAN_VID_MASK, adapter->active_vlans)) 293 if (is_vlan && test_bit(tag & VLAN_VID_MASK, adapter->active_vlans))
294 __vlan_hwaccel_put_tag(skb, tag); 294 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), tag);
295 295
296 if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL)) 296 if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL))
297 napi_gro_receive(&q_vector->napi, skb); 297 napi_gro_receive(&q_vector->napi, skb);
@@ -1179,7 +1179,8 @@ static void ixgbevf_configure_rx(struct ixgbevf_adapter *adapter)
1179 } 1179 }
1180} 1180}
1181 1181
1182static int ixgbevf_vlan_rx_add_vid(struct net_device *netdev, u16 vid) 1182static int ixgbevf_vlan_rx_add_vid(struct net_device *netdev,
1183 __be16 proto, u16 vid)
1183{ 1184{
1184 struct ixgbevf_adapter *adapter = netdev_priv(netdev); 1185 struct ixgbevf_adapter *adapter = netdev_priv(netdev);
1185 struct ixgbe_hw *hw = &adapter->hw; 1186 struct ixgbe_hw *hw = &adapter->hw;
@@ -1204,7 +1205,8 @@ static int ixgbevf_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
1204 return err; 1205 return err;
1205} 1206}
1206 1207
1207static int ixgbevf_vlan_rx_kill_vid(struct net_device *netdev, u16 vid) 1208static int ixgbevf_vlan_rx_kill_vid(struct net_device *netdev,
1209 __be16 proto, u16 vid)
1208{ 1210{
1209 struct ixgbevf_adapter *adapter = netdev_priv(netdev); 1211 struct ixgbevf_adapter *adapter = netdev_priv(netdev);
1210 struct ixgbe_hw *hw = &adapter->hw; 1212 struct ixgbe_hw *hw = &adapter->hw;
@@ -1227,7 +1229,8 @@ static void ixgbevf_restore_vlan(struct ixgbevf_adapter *adapter)
1227 u16 vid; 1229 u16 vid;
1228 1230
1229 for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID) 1231 for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID)
1230 ixgbevf_vlan_rx_add_vid(adapter->netdev, vid); 1232 ixgbevf_vlan_rx_add_vid(adapter->netdev,
1233 htons(ETH_P_8021Q), vid);
1231} 1234}
1232 1235
1233static int ixgbevf_write_uc_addr_list(struct net_device *netdev) 1236static int ixgbevf_write_uc_addr_list(struct net_device *netdev)
@@ -3410,9 +3413,9 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3410 NETIF_F_RXCSUM; 3413 NETIF_F_RXCSUM;
3411 3414
3412 netdev->features = netdev->hw_features | 3415 netdev->features = netdev->hw_features |
3413 NETIF_F_HW_VLAN_TX | 3416 NETIF_F_HW_VLAN_CTAG_TX |
3414 NETIF_F_HW_VLAN_RX | 3417 NETIF_F_HW_VLAN_CTAG_RX |
3415 NETIF_F_HW_VLAN_FILTER; 3418 NETIF_F_HW_VLAN_CTAG_FILTER;
3416 3419
3417 netdev->vlan_features |= NETIF_F_TSO; 3420 netdev->vlan_features |= NETIF_F_TSO;
3418 netdev->vlan_features |= NETIF_F_TSO6; 3421 netdev->vlan_features |= NETIF_F_TSO6;
diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c
index 0519afa413d2..070a6f1a0577 100644
--- a/drivers/net/ethernet/jme.c
+++ b/drivers/net/ethernet/jme.c
@@ -1059,7 +1059,7 @@ jme_alloc_and_feed_skb(struct jme_adapter *jme, int idx)
1059 if (rxdesc->descwb.flags & cpu_to_le16(RXWBFLAG_TAGON)) { 1059 if (rxdesc->descwb.flags & cpu_to_le16(RXWBFLAG_TAGON)) {
1060 u16 vid = le16_to_cpu(rxdesc->descwb.vlan); 1060 u16 vid = le16_to_cpu(rxdesc->descwb.vlan);
1061 1061
1062 __vlan_hwaccel_put_tag(skb, vid); 1062 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
1063 NET_STAT(jme).rx_bytes += 4; 1063 NET_STAT(jme).rx_bytes += 4;
1064 } 1064 }
1065 jme->jme_rx(skb); 1065 jme->jme_rx(skb);
@@ -3030,8 +3030,8 @@ jme_init_one(struct pci_dev *pdev,
3030 NETIF_F_SG | 3030 NETIF_F_SG |
3031 NETIF_F_TSO | 3031 NETIF_F_TSO |
3032 NETIF_F_TSO6 | 3032 NETIF_F_TSO6 |
3033 NETIF_F_HW_VLAN_TX | 3033 NETIF_F_HW_VLAN_CTAG_TX |
3034 NETIF_F_HW_VLAN_RX; 3034 NETIF_F_HW_VLAN_CTAG_RX;
3035 if (using_dac) 3035 if (using_dac)
3036 netdev->features |= NETIF_F_HIGHDMA; 3036 netdev->features |= NETIF_F_HIGHDMA;
3037 3037
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index 6a0e671fcecd..256ae789c143 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -1421,14 +1421,14 @@ static void sky2_vlan_mode(struct net_device *dev, netdev_features_t features)
1421 struct sky2_hw *hw = sky2->hw; 1421 struct sky2_hw *hw = sky2->hw;
1422 u16 port = sky2->port; 1422 u16 port = sky2->port;
1423 1423
1424 if (features & NETIF_F_HW_VLAN_RX) 1424 if (features & NETIF_F_HW_VLAN_CTAG_RX)
1425 sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), 1425 sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T),
1426 RX_VLAN_STRIP_ON); 1426 RX_VLAN_STRIP_ON);
1427 else 1427 else
1428 sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), 1428 sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T),
1429 RX_VLAN_STRIP_OFF); 1429 RX_VLAN_STRIP_OFF);
1430 1430
1431 if (features & NETIF_F_HW_VLAN_TX) { 1431 if (features & NETIF_F_HW_VLAN_CTAG_TX) {
1432 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), 1432 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
1433 TX_VLAN_TAG_ON); 1433 TX_VLAN_TAG_ON);
1434 1434
@@ -2713,7 +2713,7 @@ static void sky2_rx_tag(struct sky2_port *sky2, u16 length)
2713 struct sk_buff *skb; 2713 struct sk_buff *skb;
2714 2714
2715 skb = sky2->rx_ring[sky2->rx_next].skb; 2715 skb = sky2->rx_ring[sky2->rx_next].skb;
2716 __vlan_hwaccel_put_tag(skb, be16_to_cpu(length)); 2716 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), be16_to_cpu(length));
2717} 2717}
2718 2718
2719static void sky2_rx_hash(struct sky2_port *sky2, u32 status) 2719static void sky2_rx_hash(struct sky2_port *sky2, u32 status)
@@ -4406,7 +4406,7 @@ static int sky2_set_features(struct net_device *dev, netdev_features_t features)
4406 if (changed & NETIF_F_RXHASH) 4406 if (changed & NETIF_F_RXHASH)
4407 rx_set_rss(dev, features); 4407 rx_set_rss(dev, features);
4408 4408
4409 if (changed & (NETIF_F_HW_VLAN_TX|NETIF_F_HW_VLAN_RX)) 4409 if (changed & (NETIF_F_HW_VLAN_CTAG_TX|NETIF_F_HW_VLAN_CTAG_RX))
4410 sky2_vlan_mode(dev, features); 4410 sky2_vlan_mode(dev, features);
4411 4411
4412 return 0; 4412 return 0;
@@ -4793,7 +4793,8 @@ static struct net_device *sky2_init_netdev(struct sky2_hw *hw, unsigned port,
4793 dev->hw_features |= NETIF_F_RXHASH; 4793 dev->hw_features |= NETIF_F_RXHASH;
4794 4794
4795 if (!(hw->flags & SKY2_HW_VLAN_BROKEN)) { 4795 if (!(hw->flags & SKY2_HW_VLAN_BROKEN)) {
4796 dev->hw_features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 4796 dev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX |
4797 NETIF_F_HW_VLAN_CTAG_RX;
4797 dev->vlan_features |= SKY2_VLAN_OFFLOADS; 4798 dev->vlan_features |= SKY2_VLAN_OFFLOADS;
4798 } 4799 }
4799 4800
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index d2a4f919bf1f..e7e27842d8d4 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -356,7 +356,8 @@ static void mlx4_en_filter_rfs_expire(struct mlx4_en_priv *priv)
356} 356}
357#endif 357#endif
358 358
359static int mlx4_en_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) 359static int mlx4_en_vlan_rx_add_vid(struct net_device *dev,
360 __be16 proto, u16 vid)
360{ 361{
361 struct mlx4_en_priv *priv = netdev_priv(dev); 362 struct mlx4_en_priv *priv = netdev_priv(dev);
362 struct mlx4_en_dev *mdev = priv->mdev; 363 struct mlx4_en_dev *mdev = priv->mdev;
@@ -381,7 +382,8 @@ static int mlx4_en_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
381 return 0; 382 return 0;
382} 383}
383 384
384static int mlx4_en_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) 385static int mlx4_en_vlan_rx_kill_vid(struct net_device *dev,
386 __be16 proto, u16 vid)
385{ 387{
386 struct mlx4_en_priv *priv = netdev_priv(dev); 388 struct mlx4_en_priv *priv = netdev_priv(dev);
387 struct mlx4_en_dev *mdev = priv->mdev; 389 struct mlx4_en_dev *mdev = priv->mdev;
@@ -2082,8 +2084,8 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
2082 2084
2083 dev->hw_features |= NETIF_F_RXCSUM | NETIF_F_RXHASH; 2085 dev->hw_features |= NETIF_F_RXCSUM | NETIF_F_RXHASH;
2084 dev->features = dev->hw_features | NETIF_F_HIGHDMA | 2086 dev->features = dev->hw_features | NETIF_F_HIGHDMA |
2085 NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX | 2087 NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX |
2086 NETIF_F_HW_VLAN_FILTER; 2088 NETIF_F_HW_VLAN_CTAG_FILTER;
2087 dev->hw_features |= NETIF_F_LOOPBACK; 2089 dev->hw_features |= NETIF_F_LOOPBACK;
2088 2090
2089 if (mdev->dev->caps.steering_mode == 2091 if (mdev->dev->caps.steering_mode ==
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index c7f856308e1a..4006f8857cb5 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -673,7 +673,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
673 cpu_to_be32(MLX4_CQE_VLAN_PRESENT_MASK)) { 673 cpu_to_be32(MLX4_CQE_VLAN_PRESENT_MASK)) {
674 u16 vid = be16_to_cpu(cqe->sl_vid); 674 u16 vid = be16_to_cpu(cqe->sl_vid);
675 675
676 __vlan_hwaccel_put_tag(gro_skb, vid); 676 __vlan_hwaccel_put_tag(gro_skb, htons(ETH_P_8021Q), vid);
677 } 677 }
678 678
679 if (dev->features & NETIF_F_RXHASH) 679 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
716 716
717 if (be32_to_cpu(cqe->vlan_my_qpn) & 717 if (be32_to_cpu(cqe->vlan_my_qpn) &
718 MLX4_CQE_VLAN_PRESENT_MASK) 718 MLX4_CQE_VLAN_PRESENT_MASK)
719 __vlan_hwaccel_put_tag(skb, be16_to_cpu(cqe->sl_vid)); 719 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), be16_to_cpu(cqe->sl_vid));
720 720
721 /* Push it up the stack */ 721 /* Push it up the stack */
722 netif_receive_skb(skb); 722 netif_receive_skb(skb);
diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
index d5ffdc8264eb..7be9788ed0f6 100644
--- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
+++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
@@ -1281,7 +1281,8 @@ myri10ge_vlan_rx(struct net_device *dev, void *addr, struct sk_buff *skb)
1281 va = addr; 1281 va = addr;
1282 va += MXGEFW_PAD; 1282 va += MXGEFW_PAD;
1283 veh = (struct vlan_ethhdr *)va; 1283 veh = (struct vlan_ethhdr *)va;
1284 if ((dev->features & NETIF_F_HW_VLAN_RX) == NETIF_F_HW_VLAN_RX && 1284 if ((dev->features & NETIF_F_HW_VLAN_CTAG_RX) ==
1285 NETIF_F_HW_VLAN_CTAG_RX &&
1285 veh->h_vlan_proto == htons(ETH_P_8021Q)) { 1286 veh->h_vlan_proto == htons(ETH_P_8021Q)) {
1286 /* fixup csum if needed */ 1287 /* fixup csum if needed */
1287 if (skb->ip_summed == CHECKSUM_COMPLETE) { 1288 if (skb->ip_summed == CHECKSUM_COMPLETE) {
@@ -1289,7 +1290,7 @@ myri10ge_vlan_rx(struct net_device *dev, void *addr, struct sk_buff *skb)
1289 skb->csum = csum_sub(skb->csum, vsum); 1290 skb->csum = csum_sub(skb->csum, vsum);
1290 } 1291 }
1291 /* pop tag */ 1292 /* pop tag */
1292 __vlan_hwaccel_put_tag(skb, ntohs(veh->h_vlan_TCI)); 1293 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(veh->h_vlan_TCI));
1293 memmove(va + VLAN_HLEN, va, 2 * ETH_ALEN); 1294 memmove(va + VLAN_HLEN, va, 2 * ETH_ALEN);
1294 skb->len -= VLAN_HLEN; 1295 skb->len -= VLAN_HLEN;
1295 skb->data_len -= VLAN_HLEN; 1296 skb->data_len -= VLAN_HLEN;
@@ -3887,8 +3888,8 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3887 netdev->mtu = myri10ge_initial_mtu; 3888 netdev->mtu = myri10ge_initial_mtu;
3888 netdev->hw_features = mgp->features | NETIF_F_RXCSUM; 3889 netdev->hw_features = mgp->features | NETIF_F_RXCSUM;
3889 3890
3890 /* fake NETIF_F_HW_VLAN_RX for good GRO performance */ 3891 /* fake NETIF_F_HW_VLAN_CTAG_RX for good GRO performance */
3891 netdev->hw_features |= NETIF_F_HW_VLAN_RX; 3892 netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX;
3892 3893
3893 netdev->features = netdev->hw_features; 3894 netdev->features = netdev->hw_features;
3894 3895
diff --git a/drivers/net/ethernet/natsemi/ns83820.c b/drivers/net/ethernet/natsemi/ns83820.c
index 77c070de621e..d3b47003a575 100644
--- a/drivers/net/ethernet/natsemi/ns83820.c
+++ b/drivers/net/ethernet/natsemi/ns83820.c
@@ -911,7 +911,7 @@ static void rx_irq(struct net_device *ndev)
911 unsigned short tag; 911 unsigned short tag;
912 912
913 tag = ntohs(extsts & EXTSTS_VTG_MASK); 913 tag = ntohs(extsts & EXTSTS_VTG_MASK);
914 __vlan_hwaccel_put_tag(skb, tag); 914 __vlan_hwaccel_put_tag(skb, htons(ETH_P_IPV6), tag);
915 } 915 }
916#endif 916#endif
917 rx_rc = netif_rx(skb); 917 rx_rc = netif_rx(skb);
@@ -2193,7 +2193,7 @@ static int ns83820_init_one(struct pci_dev *pci_dev,
2193 2193
2194#ifdef NS83820_VLAN_ACCEL_SUPPORT 2194#ifdef NS83820_VLAN_ACCEL_SUPPORT
2195 /* We also support hardware vlan acceleration */ 2195 /* We also support hardware vlan acceleration */
2196 ndev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 2196 ndev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
2197#endif 2197#endif
2198 2198
2199 if (using_dac) { 2199 if (using_dac) {
diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c
index 3371ff41bb34..51b00941302c 100644
--- a/drivers/net/ethernet/neterion/s2io.c
+++ b/drivers/net/ethernet/neterion/s2io.c
@@ -7920,7 +7920,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
7920 NETIF_F_TSO | NETIF_F_TSO6 | 7920 NETIF_F_TSO | NETIF_F_TSO6 |
7921 NETIF_F_RXCSUM | NETIF_F_LRO; 7921 NETIF_F_RXCSUM | NETIF_F_LRO;
7922 dev->features |= dev->hw_features | 7922 dev->features |= dev->hw_features |
7923 NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 7923 NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
7924 if (sp->device_type & XFRAME_II_DEVICE) { 7924 if (sp->device_type & XFRAME_II_DEVICE) {
7925 dev->hw_features |= NETIF_F_UFO; 7925 dev->hw_features |= NETIF_F_UFO;
7926 if (ufo) 7926 if (ufo)
@@ -8555,7 +8555,7 @@ static void queue_rx_frame(struct sk_buff *skb, u16 vlan_tag)
8555 8555
8556 skb->protocol = eth_type_trans(skb, dev); 8556 skb->protocol = eth_type_trans(skb, dev);
8557 if (vlan_tag && sp->vlan_strip_flag) 8557 if (vlan_tag && sp->vlan_strip_flag)
8558 __vlan_hwaccel_put_tag(skb, vlan_tag); 8558 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
8559 if (sp->config.napi) 8559 if (sp->config.napi)
8560 netif_receive_skb(skb); 8560 netif_receive_skb(skb);
8561 else 8561 else
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.c b/drivers/net/ethernet/neterion/vxge/vxge-main.c
index 794444e09492..cbfaed5f2f8d 100644
--- a/drivers/net/ethernet/neterion/vxge/vxge-main.c
+++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c
@@ -312,7 +312,7 @@ vxge_rx_complete(struct vxge_ring *ring, struct sk_buff *skb, u16 vlan,
312 312
313 if (ext_info->vlan && 313 if (ext_info->vlan &&
314 ring->vlan_tag_strip == VXGE_HW_VPATH_RPA_STRIP_VLAN_TAG_ENABLE) 314 ring->vlan_tag_strip == VXGE_HW_VPATH_RPA_STRIP_VLAN_TAG_ENABLE)
315 __vlan_hwaccel_put_tag(skb, ext_info->vlan); 315 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ext_info->vlan);
316 napi_gro_receive(ring->napi_p, skb); 316 napi_gro_receive(ring->napi_p, skb);
317 317
318 vxge_debug_entryexit(VXGE_TRACE, 318 vxge_debug_entryexit(VXGE_TRACE,
@@ -3300,12 +3300,13 @@ static void vxge_tx_watchdog(struct net_device *dev)
3300/** 3300/**
3301 * vxge_vlan_rx_add_vid 3301 * vxge_vlan_rx_add_vid
3302 * @dev: net device pointer. 3302 * @dev: net device pointer.
3303 * @proto: vlan protocol
3303 * @vid: vid 3304 * @vid: vid
3304 * 3305 *
3305 * Add the vlan id to the devices vlan id table 3306 * Add the vlan id to the devices vlan id table
3306 */ 3307 */
3307static int 3308static int
3308vxge_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) 3309vxge_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid)
3309{ 3310{
3310 struct vxgedev *vdev = netdev_priv(dev); 3311 struct vxgedev *vdev = netdev_priv(dev);
3311 struct vxge_vpath *vpath; 3312 struct vxge_vpath *vpath;
@@ -3323,14 +3324,15 @@ vxge_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
3323} 3324}
3324 3325
3325/** 3326/**
3326 * vxge_vlan_rx_add_vid 3327 * vxge_vlan_rx_kill_vid
3327 * @dev: net device pointer. 3328 * @dev: net device pointer.
3329 * @proto: vlan protocol
3328 * @vid: vid 3330 * @vid: vid
3329 * 3331 *
3330 * Remove the vlan id from the device's vlan id table 3332 * Remove the vlan id from the device's vlan id table
3331 */ 3333 */
3332static int 3334static int
3333vxge_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) 3335vxge_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid)
3334{ 3336{
3335 struct vxgedev *vdev = netdev_priv(dev); 3337 struct vxgedev *vdev = netdev_priv(dev);
3336 struct vxge_vpath *vpath; 3338 struct vxge_vpath *vpath;
@@ -3415,12 +3417,12 @@ static int vxge_device_register(struct __vxge_hw_device *hldev,
3415 ndev->hw_features = NETIF_F_RXCSUM | NETIF_F_SG | 3417 ndev->hw_features = NETIF_F_RXCSUM | NETIF_F_SG |
3416 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | 3418 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
3417 NETIF_F_TSO | NETIF_F_TSO6 | 3419 NETIF_F_TSO | NETIF_F_TSO6 |
3418 NETIF_F_HW_VLAN_TX; 3420 NETIF_F_HW_VLAN_CTAG_TX;
3419 if (vdev->config.rth_steering != NO_STEERING) 3421 if (vdev->config.rth_steering != NO_STEERING)
3420 ndev->hw_features |= NETIF_F_RXHASH; 3422 ndev->hw_features |= NETIF_F_RXHASH;
3421 3423
3422 ndev->features |= ndev->hw_features | 3424 ndev->features |= ndev->hw_features |
3423 NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER; 3425 NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER;
3424 3426
3425 3427
3426 ndev->netdev_ops = &vxge_netdev_ops; 3428 ndev->netdev_ops = &vxge_netdev_ops;
diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c
index 5ae124719790..b003fe53c8e2 100644
--- a/drivers/net/ethernet/nvidia/forcedeth.c
+++ b/drivers/net/ethernet/nvidia/forcedeth.c
@@ -2961,15 +2961,15 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit)
2961 vlanflags = le32_to_cpu(np->get_rx.ex->buflow); 2961 vlanflags = le32_to_cpu(np->get_rx.ex->buflow);
2962 2962
2963 /* 2963 /*
2964 * There's need to check for NETIF_F_HW_VLAN_RX here. 2964 * There's need to check for NETIF_F_HW_VLAN_CTAG_RX
2965 * Even if vlan rx accel is disabled, 2965 * here. Even if vlan rx accel is disabled,
2966 * NV_RX3_VLAN_TAG_PRESENT is pseudo randomly set. 2966 * NV_RX3_VLAN_TAG_PRESENT is pseudo randomly set.
2967 */ 2967 */
2968 if (dev->features & NETIF_F_HW_VLAN_RX && 2968 if (dev->features & NETIF_F_HW_VLAN_CTAG_RX &&
2969 vlanflags & NV_RX3_VLAN_TAG_PRESENT) { 2969 vlanflags & NV_RX3_VLAN_TAG_PRESENT) {
2970 u16 vid = vlanflags & NV_RX3_VLAN_TAG_MASK; 2970 u16 vid = vlanflags & NV_RX3_VLAN_TAG_MASK;
2971 2971
2972 __vlan_hwaccel_put_tag(skb, vid); 2972 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
2973 } 2973 }
2974 napi_gro_receive(&np->napi, skb); 2974 napi_gro_receive(&np->napi, skb);
2975 u64_stats_update_begin(&np->swstats_rx_syncp); 2975 u64_stats_update_begin(&np->swstats_rx_syncp);
@@ -4816,7 +4816,7 @@ static netdev_features_t nv_fix_features(struct net_device *dev,
4816 netdev_features_t features) 4816 netdev_features_t features)
4817{ 4817{
4818 /* vlan is dependent on rx checksum offload */ 4818 /* vlan is dependent on rx checksum offload */
4819 if (features & (NETIF_F_HW_VLAN_TX|NETIF_F_HW_VLAN_RX)) 4819 if (features & (NETIF_F_HW_VLAN_CTAG_TX|NETIF_F_HW_VLAN_CTAG_RX))
4820 features |= NETIF_F_RXCSUM; 4820 features |= NETIF_F_RXCSUM;
4821 4821
4822 return features; 4822 return features;
@@ -4828,12 +4828,12 @@ static void nv_vlan_mode(struct net_device *dev, netdev_features_t features)
4828 4828
4829 spin_lock_irq(&np->lock); 4829 spin_lock_irq(&np->lock);
4830 4830
4831 if (features & NETIF_F_HW_VLAN_RX) 4831 if (features & NETIF_F_HW_VLAN_CTAG_RX)
4832 np->txrxctl_bits |= NVREG_TXRXCTL_VLANSTRIP; 4832 np->txrxctl_bits |= NVREG_TXRXCTL_VLANSTRIP;
4833 else 4833 else
4834 np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANSTRIP; 4834 np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANSTRIP;
4835 4835
4836 if (features & NETIF_F_HW_VLAN_TX) 4836 if (features & NETIF_F_HW_VLAN_CTAG_TX)
4837 np->txrxctl_bits |= NVREG_TXRXCTL_VLANINS; 4837 np->txrxctl_bits |= NVREG_TXRXCTL_VLANINS;
4838 else 4838 else
4839 np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANINS; 4839 np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANINS;
@@ -4870,7 +4870,7 @@ static int nv_set_features(struct net_device *dev, netdev_features_t features)
4870 spin_unlock_irq(&np->lock); 4870 spin_unlock_irq(&np->lock);
4871 } 4871 }
4872 4872
4873 if (changed & (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX)) 4873 if (changed & (NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX))
4874 nv_vlan_mode(dev, features); 4874 nv_vlan_mode(dev, features);
4875 4875
4876 return 0; 4876 return 0;
@@ -5705,7 +5705,8 @@ static int nv_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
5705 np->vlanctl_bits = 0; 5705 np->vlanctl_bits = 0;
5706 if (id->driver_data & DEV_HAS_VLAN) { 5706 if (id->driver_data & DEV_HAS_VLAN) {
5707 np->vlanctl_bits = NVREG_VLANCONTROL_ENABLE; 5707 np->vlanctl_bits = NVREG_VLANCONTROL_ENABLE;
5708 dev->hw_features |= NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX; 5708 dev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX |
5709 NETIF_F_HW_VLAN_CTAG_TX;
5709 } 5710 }
5710 5711
5711 dev->features |= dev->hw_features; 5712 dev->features |= dev->hw_features;
@@ -5996,7 +5997,8 @@ static int nv_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
5996 dev->features & NETIF_F_HIGHDMA ? "highdma " : "", 5997 dev->features & NETIF_F_HIGHDMA ? "highdma " : "",
5997 dev->features & (NETIF_F_IP_CSUM | NETIF_F_SG) ? 5998 dev->features & (NETIF_F_IP_CSUM | NETIF_F_SG) ?
5998 "csum " : "", 5999 "csum " : "",
5999 dev->features & (NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX) ? 6000 dev->features & (NETIF_F_HW_VLAN_CTAG_RX |
6001 NETIF_F_HW_VLAN_CTAG_TX) ?
6000 "vlan " : "", 6002 "vlan " : "",
6001 dev->features & (NETIF_F_LOOPBACK) ? 6003 dev->features & (NETIF_F_LOOPBACK) ?
6002 "loopback " : "", 6004 "loopback " : "",
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
index 7867aebc05f2..af951f343ff6 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
@@ -1345,7 +1345,7 @@ netxen_setup_netdev(struct netxen_adapter *adapter,
1345 } 1345 }
1346 1346
1347 if (adapter->capabilities & NX_FW_CAPABILITY_FVLANTX) 1347 if (adapter->capabilities & NX_FW_CAPABILITY_FVLANTX)
1348 netdev->hw_features |= NETIF_F_HW_VLAN_TX; 1348 netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX;
1349 1349
1350 if (adapter->capabilities & NX_FW_CAPABILITY_HW_LRO) 1350 if (adapter->capabilities & NX_FW_CAPABILITY_HW_LRO)
1351 netdev->hw_features |= NETIF_F_LRO; 1351 netdev->hw_features |= NETIF_F_LRO;
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
index a85ca63a2c9e..56223a6aa408 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
@@ -1050,7 +1050,7 @@ qlcnic_process_rcv(struct qlcnic_adapter *adapter,
1050 skb->protocol = eth_type_trans(skb, netdev); 1050 skb->protocol = eth_type_trans(skb, netdev);
1051 1051
1052 if (vid != 0xffff) 1052 if (vid != 0xffff)
1053 __vlan_hwaccel_put_tag(skb, vid); 1053 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
1054 1054
1055 napi_gro_receive(&sds_ring->napi, skb); 1055 napi_gro_receive(&sds_ring->napi, skb);
1056 1056
@@ -1153,7 +1153,7 @@ qlcnic_process_lro(struct qlcnic_adapter *adapter,
1153 } 1153 }
1154 1154
1155 if (vid != 0xffff) 1155 if (vid != 0xffff)
1156 __vlan_hwaccel_put_tag(skb, vid); 1156 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
1157 netif_receive_skb(skb); 1157 netif_receive_skb(skb);
1158 1158
1159 adapter->stats.lro_pkts++; 1159 adapter->stats.lro_pkts++;
@@ -1518,7 +1518,7 @@ qlcnic_83xx_process_rcv(struct qlcnic_adapter *adapter,
1518 skb->protocol = eth_type_trans(skb, netdev); 1518 skb->protocol = eth_type_trans(skb, netdev);
1519 1519
1520 if (vid != 0xffff) 1520 if (vid != 0xffff)
1521 __vlan_hwaccel_put_tag(skb, vid); 1521 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
1522 1522
1523 napi_gro_receive(&sds_ring->napi, skb); 1523 napi_gro_receive(&sds_ring->napi, skb);
1524 1524
@@ -1615,7 +1615,7 @@ qlcnic_83xx_process_lro(struct qlcnic_adapter *adapter,
1615 } 1615 }
1616 1616
1617 if (vid != 0xffff) 1617 if (vid != 0xffff)
1618 __vlan_hwaccel_put_tag(skb, vid); 1618 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
1619 1619
1620 netif_receive_skb(skb); 1620 netif_receive_skb(skb);
1621 1621
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index 0d00b2bd2c81..d132765f92af 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -86,8 +86,8 @@ static void qlcnic_dev_set_npar_ready(struct qlcnic_adapter *);
86static int qlcnicvf_start_firmware(struct qlcnic_adapter *); 86static int qlcnicvf_start_firmware(struct qlcnic_adapter *);
87static void qlcnic_set_netdev_features(struct qlcnic_adapter *, 87static void qlcnic_set_netdev_features(struct qlcnic_adapter *,
88 struct qlcnic_esw_func_cfg *); 88 struct qlcnic_esw_func_cfg *);
89static int qlcnic_vlan_rx_add(struct net_device *, u16); 89static int qlcnic_vlan_rx_add(struct net_device *, __be16, u16);
90static int qlcnic_vlan_rx_del(struct net_device *, u16); 90static int qlcnic_vlan_rx_del(struct net_device *, __be16, u16);
91 91
92#define QLCNIC_IS_TSO_CAPABLE(adapter) \ 92#define QLCNIC_IS_TSO_CAPABLE(adapter) \
93 ((adapter)->ahw->capabilities & QLCNIC_FW_CAPABILITY_TSO) 93 ((adapter)->ahw->capabilities & QLCNIC_FW_CAPABILITY_TSO)
@@ -902,7 +902,7 @@ void qlcnic_set_vlan_config(struct qlcnic_adapter *adapter,
902} 902}
903 903
904static int 904static int
905qlcnic_vlan_rx_add(struct net_device *netdev, u16 vid) 905qlcnic_vlan_rx_add(struct net_device *netdev, __be16 proto, u16 vid)
906{ 906{
907 struct qlcnic_adapter *adapter = netdev_priv(netdev); 907 struct qlcnic_adapter *adapter = netdev_priv(netdev);
908 set_bit(vid, adapter->vlans); 908 set_bit(vid, adapter->vlans);
@@ -910,7 +910,7 @@ qlcnic_vlan_rx_add(struct net_device *netdev, u16 vid)
910} 910}
911 911
912static int 912static int
913qlcnic_vlan_rx_del(struct net_device *netdev, u16 vid) 913qlcnic_vlan_rx_del(struct net_device *netdev, __be16 proto, u16 vid)
914{ 914{
915 struct qlcnic_adapter *adapter = netdev_priv(netdev); 915 struct qlcnic_adapter *adapter = netdev_priv(netdev);
916 916
@@ -1714,7 +1714,7 @@ qlcnic_setup_netdev(struct qlcnic_adapter *adapter, struct net_device *netdev,
1714 1714
1715 netdev->features |= (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | 1715 netdev->features |= (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
1716 NETIF_F_IPV6_CSUM | NETIF_F_GRO | 1716 NETIF_F_IPV6_CSUM | NETIF_F_GRO |
1717 NETIF_F_HW_VLAN_RX); 1717 NETIF_F_HW_VLAN_CTAG_RX);
1718 netdev->vlan_features |= (NETIF_F_SG | NETIF_F_IP_CSUM | 1718 netdev->vlan_features |= (NETIF_F_SG | NETIF_F_IP_CSUM |
1719 NETIF_F_IPV6_CSUM); 1719 NETIF_F_IPV6_CSUM);
1720 1720
@@ -1729,7 +1729,7 @@ qlcnic_setup_netdev(struct qlcnic_adapter *adapter, struct net_device *netdev,
1729 } 1729 }
1730 1730
1731 if (qlcnic_vlan_tx_check(adapter)) 1731 if (qlcnic_vlan_tx_check(adapter))
1732 netdev->features |= (NETIF_F_HW_VLAN_TX); 1732 netdev->features |= (NETIF_F_HW_VLAN_CTAG_TX);
1733 1733
1734 if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO) 1734 if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO)
1735 netdev->features |= NETIF_F_LRO; 1735 netdev->features |= NETIF_F_LRO;
@@ -3346,7 +3346,7 @@ void qlcnic_restore_indev_addr(struct net_device *netdev, unsigned long event)
3346 3346
3347 rcu_read_lock(); 3347 rcu_read_lock();
3348 for_each_set_bit(vid, adapter->vlans, VLAN_N_VID) { 3348 for_each_set_bit(vid, adapter->vlans, VLAN_N_VID) {
3349 dev = __vlan_find_dev_deep(netdev, vid); 3349 dev = __vlan_find_dev_deep(netdev, htons(ETH_P_8021Q), vid);
3350 if (!dev) 3350 if (!dev)
3351 continue; 3351 continue;
3352 qlcnic_config_indev_addr(adapter, dev, event); 3352 qlcnic_config_indev_addr(adapter, dev, event);
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
index 1dd778a6f01e..44cf72ac2489 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
@@ -409,7 +409,7 @@ static int ql_set_mac_addr_reg(struct ql_adapter *qdev, u8 *addr, u32 type,
409 (qdev-> 409 (qdev->
410 func << CAM_OUT_FUNC_SHIFT) | 410 func << CAM_OUT_FUNC_SHIFT) |
411 (0 << CAM_OUT_CQ_ID_SHIFT)); 411 (0 << CAM_OUT_CQ_ID_SHIFT));
412 if (qdev->ndev->features & NETIF_F_HW_VLAN_RX) 412 if (qdev->ndev->features & NETIF_F_HW_VLAN_CTAG_RX)
413 cam_output |= CAM_OUT_RV; 413 cam_output |= CAM_OUT_RV;
414 /* route to NIC core */ 414 /* route to NIC core */
415 ql_write32(qdev, MAC_ADDR_DATA, cam_output); 415 ql_write32(qdev, MAC_ADDR_DATA, cam_output);
@@ -1498,7 +1498,7 @@ static void ql_process_mac_rx_gro_page(struct ql_adapter *qdev,
1498 skb->ip_summed = CHECKSUM_UNNECESSARY; 1498 skb->ip_summed = CHECKSUM_UNNECESSARY;
1499 skb_record_rx_queue(skb, rx_ring->cq_id); 1499 skb_record_rx_queue(skb, rx_ring->cq_id);
1500 if (vlan_id != 0xffff) 1500 if (vlan_id != 0xffff)
1501 __vlan_hwaccel_put_tag(skb, vlan_id); 1501 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_id);
1502 napi_gro_frags(napi); 1502 napi_gro_frags(napi);
1503} 1503}
1504 1504
@@ -1574,7 +1574,7 @@ static void ql_process_mac_rx_page(struct ql_adapter *qdev,
1574 1574
1575 skb_record_rx_queue(skb, rx_ring->cq_id); 1575 skb_record_rx_queue(skb, rx_ring->cq_id);
1576 if (vlan_id != 0xffff) 1576 if (vlan_id != 0xffff)
1577 __vlan_hwaccel_put_tag(skb, vlan_id); 1577 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_id);
1578 if (skb->ip_summed == CHECKSUM_UNNECESSARY) 1578 if (skb->ip_summed == CHECKSUM_UNNECESSARY)
1579 napi_gro_receive(napi, skb); 1579 napi_gro_receive(napi, skb);
1580 else 1580 else
@@ -1670,7 +1670,7 @@ static void ql_process_mac_rx_skb(struct ql_adapter *qdev,
1670 1670
1671 skb_record_rx_queue(skb, rx_ring->cq_id); 1671 skb_record_rx_queue(skb, rx_ring->cq_id);
1672 if (vlan_id != 0xffff) 1672 if (vlan_id != 0xffff)
1673 __vlan_hwaccel_put_tag(skb, vlan_id); 1673 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_id);
1674 if (skb->ip_summed == CHECKSUM_UNNECESSARY) 1674 if (skb->ip_summed == CHECKSUM_UNNECESSARY)
1675 napi_gro_receive(&rx_ring->napi, skb); 1675 napi_gro_receive(&rx_ring->napi, skb);
1676 else 1676 else
@@ -1975,7 +1975,7 @@ static void ql_process_mac_split_rx_intr(struct ql_adapter *qdev,
1975 rx_ring->rx_bytes += skb->len; 1975 rx_ring->rx_bytes += skb->len;
1976 skb_record_rx_queue(skb, rx_ring->cq_id); 1976 skb_record_rx_queue(skb, rx_ring->cq_id);
1977 if ((ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_V) && (vlan_id != 0)) 1977 if ((ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_V) && (vlan_id != 0))
1978 __vlan_hwaccel_put_tag(skb, vlan_id); 1978 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_id);
1979 if (skb->ip_summed == CHECKSUM_UNNECESSARY) 1979 if (skb->ip_summed == CHECKSUM_UNNECESSARY)
1980 napi_gro_receive(&rx_ring->napi, skb); 1980 napi_gro_receive(&rx_ring->napi, skb);
1981 else 1981 else
@@ -2279,7 +2279,7 @@ static void qlge_vlan_mode(struct net_device *ndev, netdev_features_t features)
2279{ 2279{
2280 struct ql_adapter *qdev = netdev_priv(ndev); 2280 struct ql_adapter *qdev = netdev_priv(ndev);
2281 2281
2282 if (features & NETIF_F_HW_VLAN_RX) { 2282 if (features & NETIF_F_HW_VLAN_CTAG_RX) {
2283 ql_write32(qdev, NIC_RCV_CFG, NIC_RCV_CFG_VLAN_MASK | 2283 ql_write32(qdev, NIC_RCV_CFG, NIC_RCV_CFG_VLAN_MASK |
2284 NIC_RCV_CFG_VLAN_MATCH_AND_NON); 2284 NIC_RCV_CFG_VLAN_MATCH_AND_NON);
2285 } else { 2285 } else {
@@ -2294,10 +2294,10 @@ static netdev_features_t qlge_fix_features(struct net_device *ndev,
2294 * Since there is no support for separate rx/tx vlan accel 2294 * Since there is no support for separate rx/tx vlan accel
2295 * enable/disable make sure tx flag is always in same state as rx. 2295 * enable/disable make sure tx flag is always in same state as rx.
2296 */ 2296 */
2297 if (features & NETIF_F_HW_VLAN_RX) 2297 if (features & NETIF_F_HW_VLAN_CTAG_RX)
2298 features |= NETIF_F_HW_VLAN_TX; 2298 features |= NETIF_F_HW_VLAN_CTAG_TX;
2299 else 2299 else
2300 features &= ~NETIF_F_HW_VLAN_TX; 2300 features &= ~NETIF_F_HW_VLAN_CTAG_TX;
2301 2301
2302 return features; 2302 return features;
2303} 2303}
@@ -2307,7 +2307,7 @@ static int qlge_set_features(struct net_device *ndev,
2307{ 2307{
2308 netdev_features_t changed = ndev->features ^ features; 2308 netdev_features_t changed = ndev->features ^ features;
2309 2309
2310 if (changed & NETIF_F_HW_VLAN_RX) 2310 if (changed & NETIF_F_HW_VLAN_CTAG_RX)
2311 qlge_vlan_mode(ndev, features); 2311 qlge_vlan_mode(ndev, features);
2312 2312
2313 return 0; 2313 return 0;
@@ -2326,7 +2326,7 @@ static int __qlge_vlan_rx_add_vid(struct ql_adapter *qdev, u16 vid)
2326 return err; 2326 return err;
2327} 2327}
2328 2328
2329static int qlge_vlan_rx_add_vid(struct net_device *ndev, u16 vid) 2329static int qlge_vlan_rx_add_vid(struct net_device *ndev, __be16 proto, u16 vid)
2330{ 2330{
2331 struct ql_adapter *qdev = netdev_priv(ndev); 2331 struct ql_adapter *qdev = netdev_priv(ndev);
2332 int status; 2332 int status;
@@ -2357,7 +2357,7 @@ static int __qlge_vlan_rx_kill_vid(struct ql_adapter *qdev, u16 vid)
2357 return err; 2357 return err;
2358} 2358}
2359 2359
2360static int qlge_vlan_rx_kill_vid(struct net_device *ndev, u16 vid) 2360static int qlge_vlan_rx_kill_vid(struct net_device *ndev, __be16 proto, u16 vid)
2361{ 2361{
2362 struct ql_adapter *qdev = netdev_priv(ndev); 2362 struct ql_adapter *qdev = netdev_priv(ndev);
2363 int status; 2363 int status;
@@ -4665,9 +4665,9 @@ static int qlge_probe(struct pci_dev *pdev,
4665 SET_NETDEV_DEV(ndev, &pdev->dev); 4665 SET_NETDEV_DEV(ndev, &pdev->dev);
4666 ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | 4666 ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM |
4667 NETIF_F_TSO | NETIF_F_TSO_ECN | 4667 NETIF_F_TSO | NETIF_F_TSO_ECN |
4668 NETIF_F_HW_VLAN_TX | NETIF_F_RXCSUM; 4668 NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_RXCSUM;
4669 ndev->features = ndev->hw_features | 4669 ndev->features = ndev->hw_features |
4670 NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER; 4670 NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER;
4671 ndev->vlan_features = ndev->hw_features; 4671 ndev->vlan_features = ndev->hw_features;
4672 4672
4673 if (test_bit(QL_DMA64, &qdev->flags)) 4673 if (test_bit(QL_DMA64, &qdev->flags))
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c
index b62a32484f6a..7d1fb9ad1296 100644
--- a/drivers/net/ethernet/realtek/8139cp.c
+++ b/drivers/net/ethernet/realtek/8139cp.c
@@ -431,7 +431,7 @@ static inline void cp_rx_skb (struct cp_private *cp, struct sk_buff *skb,
431 cp->dev->stats.rx_bytes += skb->len; 431 cp->dev->stats.rx_bytes += skb->len;
432 432
433 if (opts2 & RxVlanTagged) 433 if (opts2 & RxVlanTagged)
434 __vlan_hwaccel_put_tag(skb, swab16(opts2 & 0xffff)); 434 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), swab16(opts2 & 0xffff));
435 435
436 napi_gro_receive(&cp->napi, skb); 436 napi_gro_receive(&cp->napi, skb);
437} 437}
@@ -1438,7 +1438,7 @@ static int cp_set_features(struct net_device *dev, netdev_features_t features)
1438 else 1438 else
1439 cp->cpcmd &= ~RxChkSum; 1439 cp->cpcmd &= ~RxChkSum;
1440 1440
1441 if (features & NETIF_F_HW_VLAN_RX) 1441 if (features & NETIF_F_HW_VLAN_CTAG_RX)
1442 cp->cpcmd |= RxVlanOn; 1442 cp->cpcmd |= RxVlanOn;
1443 else 1443 else
1444 cp->cpcmd &= ~RxVlanOn; 1444 cp->cpcmd &= ~RxVlanOn;
@@ -1955,14 +1955,14 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1955 dev->ethtool_ops = &cp_ethtool_ops; 1955 dev->ethtool_ops = &cp_ethtool_ops;
1956 dev->watchdog_timeo = TX_TIMEOUT; 1956 dev->watchdog_timeo = TX_TIMEOUT;
1957 1957
1958 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 1958 dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
1959 1959
1960 if (pci_using_dac) 1960 if (pci_using_dac)
1961 dev->features |= NETIF_F_HIGHDMA; 1961 dev->features |= NETIF_F_HIGHDMA;
1962 1962
1963 /* disabled by default until verified */ 1963 /* disabled by default until verified */
1964 dev->hw_features |= NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | 1964 dev->hw_features |= NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO |
1965 NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 1965 NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
1966 dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | 1966 dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO |
1967 NETIF_F_HIGHDMA; 1967 NETIF_F_HIGHDMA;
1968 1968
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 9a1bc1a23854..c6dac38fd9cc 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -1793,16 +1793,17 @@ static void __rtl8169_set_features(struct net_device *dev,
1793 netdev_features_t changed = features ^ dev->features; 1793 netdev_features_t changed = features ^ dev->features;
1794 void __iomem *ioaddr = tp->mmio_addr; 1794 void __iomem *ioaddr = tp->mmio_addr;
1795 1795
1796 if (!(changed & (NETIF_F_RXALL | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_RX))) 1796 if (!(changed & (NETIF_F_RXALL | NETIF_F_RXCSUM |
1797 NETIF_F_HW_VLAN_CTAG_RX)))
1797 return; 1798 return;
1798 1799
1799 if (changed & (NETIF_F_RXCSUM | NETIF_F_HW_VLAN_RX)) { 1800 if (changed & (NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX)) {
1800 if (features & NETIF_F_RXCSUM) 1801 if (features & NETIF_F_RXCSUM)
1801 tp->cp_cmd |= RxChkSum; 1802 tp->cp_cmd |= RxChkSum;
1802 else 1803 else
1803 tp->cp_cmd &= ~RxChkSum; 1804 tp->cp_cmd &= ~RxChkSum;
1804 1805
1805 if (dev->features & NETIF_F_HW_VLAN_RX) 1806 if (dev->features & NETIF_F_HW_VLAN_CTAG_RX)
1806 tp->cp_cmd |= RxVlan; 1807 tp->cp_cmd |= RxVlan;
1807 else 1808 else
1808 tp->cp_cmd &= ~RxVlan; 1809 tp->cp_cmd &= ~RxVlan;
@@ -1842,7 +1843,7 @@ static void rtl8169_rx_vlan_tag(struct RxDesc *desc, struct sk_buff *skb)
1842 u32 opts2 = le32_to_cpu(desc->opts2); 1843 u32 opts2 = le32_to_cpu(desc->opts2);
1843 1844
1844 if (opts2 & RxVlanTag) 1845 if (opts2 & RxVlanTag)
1845 __vlan_hwaccel_put_tag(skb, swab16(opts2 & 0xffff)); 1846 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), swab16(opts2 & 0xffff));
1846} 1847}
1847 1848
1848static int rtl8169_gset_tbi(struct net_device *dev, struct ethtool_cmd *cmd) 1849static int rtl8169_gset_tbi(struct net_device *dev, struct ethtool_cmd *cmd)
@@ -7036,16 +7037,17 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
7036 /* don't enable SG, IP_CSUM and TSO by default - it might not work 7037 /* don't enable SG, IP_CSUM and TSO by default - it might not work
7037 * properly for all devices */ 7038 * properly for all devices */
7038 dev->features |= NETIF_F_RXCSUM | 7039 dev->features |= NETIF_F_RXCSUM |
7039 NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 7040 NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
7040 7041
7041 dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | 7042 dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO |
7042 NETIF_F_RXCSUM | NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 7043 NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_TX |
7044 NETIF_F_HW_VLAN_CTAG_RX;
7043 dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | 7045 dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO |
7044 NETIF_F_HIGHDMA; 7046 NETIF_F_HIGHDMA;
7045 7047
7046 if (tp->mac_version == RTL_GIGA_MAC_VER_05) 7048 if (tp->mac_version == RTL_GIGA_MAC_VER_05)
7047 /* 8110SCd requires hardware Rx VLAN - disallow toggling */ 7049 /* 8110SCd requires hardware Rx VLAN - disallow toggling */
7048 dev->hw_features &= ~NETIF_F_HW_VLAN_RX; 7050 dev->hw_features &= ~NETIF_F_HW_VLAN_CTAG_RX;
7049 7051
7050 dev->hw_features |= NETIF_F_RXALL; 7052 dev->hw_features |= NETIF_F_RXALL;
7051 dev->hw_features |= NETIF_F_RXFCS; 7053 dev->hw_features |= NETIF_F_RXFCS;
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index a7499cbf4503..b8e52cd1a698 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -2448,7 +2448,8 @@ static int sh_eth_get_vtag_index(struct sh_eth_private *mdp)
2448 return TSU_VTAG1; 2448 return TSU_VTAG1;
2449} 2449}
2450 2450
2451static int sh_eth_vlan_rx_add_vid(struct net_device *ndev, u16 vid) 2451static int sh_eth_vlan_rx_add_vid(struct net_device *ndev,
2452 __be16 proto, u16 vid)
2452{ 2453{
2453 struct sh_eth_private *mdp = netdev_priv(ndev); 2454 struct sh_eth_private *mdp = netdev_priv(ndev);
2454 int vtag_reg_index = sh_eth_get_vtag_index(mdp); 2455 int vtag_reg_index = sh_eth_get_vtag_index(mdp);
@@ -2478,7 +2479,8 @@ static int sh_eth_vlan_rx_add_vid(struct net_device *ndev, u16 vid)
2478 return 0; 2479 return 0;
2479} 2480}
2480 2481
2481static int sh_eth_vlan_rx_kill_vid(struct net_device *ndev, u16 vid) 2482static int sh_eth_vlan_rx_kill_vid(struct net_device *ndev,
2483 __be16 proto, u16 vid)
2482{ 2484{
2483 struct sh_eth_private *mdp = netdev_priv(ndev); 2485 struct sh_eth_private *mdp = netdev_priv(ndev);
2484 int vtag_reg_index = sh_eth_get_vtag_index(mdp); 2486 int vtag_reg_index = sh_eth_get_vtag_index(mdp);
@@ -2749,7 +2751,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
2749 goto out_release; 2751 goto out_release;
2750 } 2752 }
2751 mdp->port = devno % 2; 2753 mdp->port = devno % 2;
2752 ndev->features = NETIF_F_HW_VLAN_FILTER; 2754 ndev->features = NETIF_F_HW_VLAN_CTAG_FILTER;
2753 } 2755 }
2754 2756
2755 /* initialize first or needed device */ 2757 /* initialize first or needed device */
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 71b64857e3a6..618446ae1ec1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2679,7 +2679,7 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
2679 ndev->watchdog_timeo = msecs_to_jiffies(watchdog); 2679 ndev->watchdog_timeo = msecs_to_jiffies(watchdog);
2680#ifdef STMMAC_VLAN_TAG_USED 2680#ifdef STMMAC_VLAN_TAG_USED
2681 /* Both mac100 and gmac support receive VLAN tag detection */ 2681 /* Both mac100 and gmac support receive VLAN tag detection */
2682 ndev->features |= NETIF_F_HW_VLAN_RX; 2682 ndev->features |= NETIF_F_HW_VLAN_CTAG_RX;
2683#endif 2683#endif
2684 priv->msg_enable = netif_msg_init(debug, default_msg_level); 2684 priv->msg_enable = netif_msg_init(debug, default_msg_level);
2685 2685
diff --git a/drivers/net/ethernet/tehuti/tehuti.c b/drivers/net/ethernet/tehuti/tehuti.c
index e8824cea093b..571452e786d5 100644
--- a/drivers/net/ethernet/tehuti/tehuti.c
+++ b/drivers/net/ethernet/tehuti/tehuti.c
@@ -733,7 +733,7 @@ static void __bdx_vlan_rx_vid(struct net_device *ndev, uint16_t vid, int enable)
733 * @ndev: network device 733 * @ndev: network device
734 * @vid: VLAN vid to add 734 * @vid: VLAN vid to add
735 */ 735 */
736static int bdx_vlan_rx_add_vid(struct net_device *ndev, uint16_t vid) 736static int bdx_vlan_rx_add_vid(struct net_device *ndev, __be16 proto, u16 vid)
737{ 737{
738 __bdx_vlan_rx_vid(ndev, vid, 1); 738 __bdx_vlan_rx_vid(ndev, vid, 1);
739 return 0; 739 return 0;
@@ -744,7 +744,7 @@ static int bdx_vlan_rx_add_vid(struct net_device *ndev, uint16_t vid)
744 * @ndev: network device 744 * @ndev: network device
745 * @vid: VLAN vid to kill 745 * @vid: VLAN vid to kill
746 */ 746 */
747static int bdx_vlan_rx_kill_vid(struct net_device *ndev, unsigned short vid) 747static int bdx_vlan_rx_kill_vid(struct net_device *ndev, __be16 proto, u16 vid)
748{ 748{
749 __bdx_vlan_rx_vid(ndev, vid, 0); 749 __bdx_vlan_rx_vid(ndev, vid, 0);
750 return 0; 750 return 0;
@@ -1148,7 +1148,7 @@ NETIF_RX_MUX(struct bdx_priv *priv, u32 rxd_val1, u16 rxd_vlan,
1148 priv->ndev->name, 1148 priv->ndev->name,
1149 GET_RXD_VLAN_ID(rxd_vlan), 1149 GET_RXD_VLAN_ID(rxd_vlan),
1150 GET_RXD_VTAG(rxd_val1)); 1150 GET_RXD_VTAG(rxd_val1));
1151 __vlan_hwaccel_put_tag(skb, GET_RXD_VLAN_TCI(rxd_vlan)); 1151 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), GET_RXD_VLAN_TCI(rxd_vlan));
1152 } 1152 }
1153 netif_receive_skb(skb); 1153 netif_receive_skb(skb);
1154} 1154}
@@ -2017,12 +2017,12 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2017 * so we can have them same for all ports of the board */ 2017 * so we can have them same for all ports of the board */
2018 ndev->if_port = port; 2018 ndev->if_port = port;
2019 ndev->features = NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO 2019 ndev->features = NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO
2020 | NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX | 2020 | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX |
2021 NETIF_F_HW_VLAN_FILTER | NETIF_F_RXCSUM 2021 NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXCSUM
2022 /*| NETIF_F_FRAGLIST */ 2022 /*| NETIF_F_FRAGLIST */
2023 ; 2023 ;
2024 ndev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG | 2024 ndev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG |
2025 NETIF_F_TSO | NETIF_F_HW_VLAN_TX; 2025 NETIF_F_TSO | NETIF_F_HW_VLAN_CTAG_TX;
2026 2026
2027 if (pci_using_dac) 2027 if (pci_using_dac)
2028 ndev->features |= NETIF_F_HIGHDMA; 2028 ndev->features |= NETIF_F_HIGHDMA;
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 1d740423a053..5cf8d03b8cae 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1251,7 +1251,7 @@ clean_vid:
1251} 1251}
1252 1252
1253static int cpsw_ndo_vlan_rx_add_vid(struct net_device *ndev, 1253static int cpsw_ndo_vlan_rx_add_vid(struct net_device *ndev,
1254 unsigned short vid) 1254 __be16 proto, u16 vid)
1255{ 1255{
1256 struct cpsw_priv *priv = netdev_priv(ndev); 1256 struct cpsw_priv *priv = netdev_priv(ndev);
1257 1257
@@ -1263,7 +1263,7 @@ static int cpsw_ndo_vlan_rx_add_vid(struct net_device *ndev,
1263} 1263}
1264 1264
1265static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev, 1265static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev,
1266 unsigned short vid) 1266 __be16 proto, u16 vid)
1267{ 1267{
1268 struct cpsw_priv *priv = netdev_priv(ndev); 1268 struct cpsw_priv *priv = netdev_priv(ndev);
1269 int ret; 1269 int ret;
@@ -1599,7 +1599,7 @@ static int cpsw_probe_dual_emac(struct platform_device *pdev,
1599 priv_sl2->num_irqs = priv->num_irqs; 1599 priv_sl2->num_irqs = priv->num_irqs;
1600 } 1600 }
1601 1601
1602 ndev->features |= NETIF_F_HW_VLAN_FILTER; 1602 ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
1603 1603
1604 ndev->netdev_ops = &cpsw_netdev_ops; 1604 ndev->netdev_ops = &cpsw_netdev_ops;
1605 SET_ETHTOOL_OPS(ndev, &cpsw_ethtool_ops); 1605 SET_ETHTOOL_OPS(ndev, &cpsw_ethtool_ops);
@@ -1837,7 +1837,7 @@ static int cpsw_probe(struct platform_device *pdev)
1837 k++; 1837 k++;
1838 } 1838 }
1839 1839
1840 ndev->features |= NETIF_F_HW_VLAN_FILTER; 1840 ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
1841 1841
1842 ndev->netdev_ops = &cpsw_netdev_ops; 1842 ndev->netdev_ops = &cpsw_netdev_ops;
1843 SET_ETHTOOL_OPS(ndev, &cpsw_ethtool_ops); 1843 SET_ETHTOOL_OPS(ndev, &cpsw_ethtool_ops);
diff --git a/drivers/net/ethernet/toshiba/spider_net.c b/drivers/net/ethernet/toshiba/spider_net.c
index fef6b59e69c9..c655fe60121e 100644
--- a/drivers/net/ethernet/toshiba/spider_net.c
+++ b/drivers/net/ethernet/toshiba/spider_net.c
@@ -2329,8 +2329,8 @@ spider_net_setup_netdev(struct spider_net_card *card)
2329 if (SPIDER_NET_RX_CSUM_DEFAULT) 2329 if (SPIDER_NET_RX_CSUM_DEFAULT)
2330 netdev->features |= NETIF_F_RXCSUM; 2330 netdev->features |= NETIF_F_RXCSUM;
2331 netdev->features |= NETIF_F_IP_CSUM | NETIF_F_LLTX; 2331 netdev->features |= NETIF_F_IP_CSUM | NETIF_F_LLTX;
2332 /* some time: NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX | 2332 /* some time: NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX |
2333 * NETIF_F_HW_VLAN_FILTER */ 2333 * NETIF_F_HW_VLAN_CTAG_FILTER */
2334 2334
2335 netdev->irq = card->pdev->irq; 2335 netdev->irq = card->pdev->irq;
2336 card->num_rx_ints = 0; 2336 card->num_rx_ints = 0;
diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c
index 185c721c52d7..ca98acabf1b4 100644
--- a/drivers/net/ethernet/via/via-rhine.c
+++ b/drivers/net/ethernet/via/via-rhine.c
@@ -508,8 +508,10 @@ static struct rtnl_link_stats64 *rhine_get_stats64(struct net_device *dev,
508static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 508static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
509static const struct ethtool_ops netdev_ethtool_ops; 509static const struct ethtool_ops netdev_ethtool_ops;
510static int rhine_close(struct net_device *dev); 510static int rhine_close(struct net_device *dev);
511static int rhine_vlan_rx_add_vid(struct net_device *dev, unsigned short vid); 511static int rhine_vlan_rx_add_vid(struct net_device *dev,
512static int rhine_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid); 512 __be16 proto, u16 vid);
513static int rhine_vlan_rx_kill_vid(struct net_device *dev,
514 __be16 proto, u16 vid);
513static void rhine_restart_tx(struct net_device *dev); 515static void rhine_restart_tx(struct net_device *dev);
514 516
515static void rhine_wait_bit(struct rhine_private *rp, u8 reg, u8 mask, bool low) 517static void rhine_wait_bit(struct rhine_private *rp, u8 reg, u8 mask, bool low)
@@ -1026,8 +1028,9 @@ static int rhine_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1026 dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM; 1028 dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM;
1027 1029
1028 if (pdev->revision >= VT6105M) 1030 if (pdev->revision >= VT6105M)
1029 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX | 1031 dev->features |= NETIF_F_HW_VLAN_CTAG_TX |
1030 NETIF_F_HW_VLAN_FILTER; 1032 NETIF_F_HW_VLAN_CTAG_RX |
1033 NETIF_F_HW_VLAN_CTAG_FILTER;
1031 1034
1032 /* dev->name not defined before register_netdev()! */ 1035 /* dev->name not defined before register_netdev()! */
1033 rc = register_netdev(dev); 1036 rc = register_netdev(dev);
@@ -1414,7 +1417,7 @@ static void rhine_update_vcam(struct net_device *dev)
1414 rhine_set_vlan_cam_mask(ioaddr, vCAMmask); 1417 rhine_set_vlan_cam_mask(ioaddr, vCAMmask);
1415} 1418}
1416 1419
1417static int rhine_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) 1420static int rhine_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid)
1418{ 1421{
1419 struct rhine_private *rp = netdev_priv(dev); 1422 struct rhine_private *rp = netdev_priv(dev);
1420 1423
@@ -1425,7 +1428,7 @@ static int rhine_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
1425 return 0; 1428 return 0;
1426} 1429}
1427 1430
1428static int rhine_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) 1431static int rhine_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid)
1429{ 1432{
1430 struct rhine_private *rp = netdev_priv(dev); 1433 struct rhine_private *rp = netdev_priv(dev);
1431 1434
@@ -1933,7 +1936,7 @@ static int rhine_rx(struct net_device *dev, int limit)
1933 skb->protocol = eth_type_trans(skb, dev); 1936 skb->protocol = eth_type_trans(skb, dev);
1934 1937
1935 if (unlikely(desc_length & DescTag)) 1938 if (unlikely(desc_length & DescTag))
1936 __vlan_hwaccel_put_tag(skb, vlan_tci); 1939 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tci);
1937 netif_receive_skb(skb); 1940 netif_receive_skb(skb);
1938 1941
1939 u64_stats_update_begin(&rp->rx_stats.syncp); 1942 u64_stats_update_begin(&rp->rx_stats.syncp);
diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c
index 1bc7f9fd2583..fb6248956ee2 100644
--- a/drivers/net/ethernet/via/via-velocity.c
+++ b/drivers/net/ethernet/via/via-velocity.c
@@ -525,7 +525,8 @@ static void velocity_init_cam_filter(struct velocity_info *vptr)
525 mac_set_vlan_cam_mask(regs, vptr->vCAMmask); 525 mac_set_vlan_cam_mask(regs, vptr->vCAMmask);
526} 526}
527 527
528static int velocity_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) 528static int velocity_vlan_rx_add_vid(struct net_device *dev,
529 __be16 proto, u16 vid)
529{ 530{
530 struct velocity_info *vptr = netdev_priv(dev); 531 struct velocity_info *vptr = netdev_priv(dev);
531 532
@@ -536,7 +537,8 @@ static int velocity_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
536 return 0; 537 return 0;
537} 538}
538 539
539static int velocity_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) 540static int velocity_vlan_rx_kill_vid(struct net_device *dev,
541 __be16 proto, u16 vid)
540{ 542{
541 struct velocity_info *vptr = netdev_priv(dev); 543 struct velocity_info *vptr = netdev_priv(dev);
542 544
@@ -2078,7 +2080,7 @@ static int velocity_receive_frame(struct velocity_info *vptr, int idx)
2078 if (rd->rdesc0.RSR & RSR_DETAG) { 2080 if (rd->rdesc0.RSR & RSR_DETAG) {
2079 u16 vid = swab16(le16_to_cpu(rd->rdesc1.PQTAG)); 2081 u16 vid = swab16(le16_to_cpu(rd->rdesc1.PQTAG));
2080 2082
2081 __vlan_hwaccel_put_tag(skb, vid); 2083 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
2082 } 2084 }
2083 netif_rx(skb); 2085 netif_rx(skb);
2084 2086
@@ -2810,9 +2812,10 @@ static int velocity_found1(struct pci_dev *pdev,
2810 dev->ethtool_ops = &velocity_ethtool_ops; 2812 dev->ethtool_ops = &velocity_ethtool_ops;
2811 netif_napi_add(dev, &vptr->napi, velocity_poll, VELOCITY_NAPI_WEIGHT); 2813 netif_napi_add(dev, &vptr->napi, velocity_poll, VELOCITY_NAPI_WEIGHT);
2812 2814
2813 dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_HW_VLAN_TX; 2815 dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG |
2814 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_FILTER | 2816 NETIF_F_HW_VLAN_CTAG_TX;
2815 NETIF_F_HW_VLAN_RX | NETIF_F_IP_CSUM; 2817 dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_FILTER |
2818 NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_IP_CSUM;
2816 2819
2817 ret = register_netdev(dev); 2820 ret = register_netdev(dev);
2818 if (ret < 0) 2821 if (ret < 0)
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index 4a7c60f4c83d..57c2e5ef2804 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -1018,9 +1018,9 @@ static int temac_of_probe(struct platform_device *op)
1018 ndev->features |= NETIF_F_HW_CSUM; /* Can checksum all the packets. */ 1018 ndev->features |= NETIF_F_HW_CSUM; /* Can checksum all the packets. */
1019 ndev->features |= NETIF_F_IPV6_CSUM; /* Can checksum IPV6 TCP/UDP */ 1019 ndev->features |= NETIF_F_IPV6_CSUM; /* Can checksum IPV6 TCP/UDP */
1020 ndev->features |= NETIF_F_HIGHDMA; /* Can DMA to high memory. */ 1020 ndev->features |= NETIF_F_HIGHDMA; /* Can DMA to high memory. */
1021 ndev->features |= NETIF_F_HW_VLAN_TX; /* Transmit VLAN hw accel */ 1021 ndev->features |= NETIF_F_HW_VLAN_CTAG_TX; /* Transmit VLAN hw accel */
1022 ndev->features |= NETIF_F_HW_VLAN_RX; /* Receive VLAN hw acceleration */ 1022 ndev->features |= NETIF_F_HW_VLAN_CTAG_RX; /* Receive VLAN hw acceleration */
1023 ndev->features |= NETIF_F_HW_VLAN_FILTER; /* Receive VLAN filtering */ 1023 ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; /* Receive VLAN filtering */
1024 ndev->features |= NETIF_F_VLAN_CHALLENGED; /* cannot handle VLAN pkts */ 1024 ndev->features |= NETIF_F_VLAN_CHALLENGED; /* cannot handle VLAN pkts */
1025 ndev->features |= NETIF_F_GSO; /* Enable software GSO. */ 1025 ndev->features |= NETIF_F_GSO; /* Enable software GSO. */
1026 ndev->features |= NETIF_F_MULTI_QUEUE; /* Has multiple TX/RX queues */ 1026 ndev->features |= NETIF_F_MULTI_QUEUE; /* Has multiple TX/RX queues */
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 5f85205cd12b..4559bb8115bf 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -431,7 +431,7 @@ static int netvsc_probe(struct hv_device *dev,
431 431
432 /* TODO: Add GSO and Checksum offload */ 432 /* TODO: Add GSO and Checksum offload */
433 net->hw_features = NETIF_F_SG; 433 net->hw_features = NETIF_F_SG;
434 net->features = NETIF_F_SG | NETIF_F_HW_VLAN_TX; 434 net->features = NETIF_F_SG | NETIF_F_HW_VLAN_CTAG_TX;
435 435
436 SET_ETHTOOL_OPS(net, &ethtool_ops); 436 SET_ETHTOOL_OPS(net, &ethtool_ops);
437 SET_NETDEV_DEV(net, &dev->device); 437 SET_NETDEV_DEV(net, &dev->device);
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index 82164381f778..dc9f6a45515d 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -166,7 +166,8 @@ static const struct net_device_ops ifb_netdev_ops = {
166 166
167#define IFB_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_FRAGLIST | \ 167#define IFB_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_FRAGLIST | \
168 NETIF_F_TSO_ECN | NETIF_F_TSO | NETIF_F_TSO6 | \ 168 NETIF_F_TSO_ECN | NETIF_F_TSO | NETIF_F_TSO6 | \
169 NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_TX) 169 NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_CTAG_TX | \
170 NETIF_F_HW_VLAN_STAG_TX)
170 171
171static void ifb_setup(struct net_device *dev) 172static void ifb_setup(struct net_device *dev)
172{ 173{
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 70af6dc07d40..d5a141c7c4e7 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -471,7 +471,7 @@ static struct lock_class_key macvlan_netdev_addr_lock_key;
471 (NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \ 471 (NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \
472 NETIF_F_GSO | NETIF_F_TSO | NETIF_F_UFO | NETIF_F_GSO_ROBUST | \ 472 NETIF_F_GSO | NETIF_F_TSO | NETIF_F_UFO | NETIF_F_GSO_ROBUST | \
473 NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_GRO | NETIF_F_RXCSUM | \ 473 NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_GRO | NETIF_F_RXCSUM | \
474 NETIF_F_HW_VLAN_FILTER) 474 NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_STAG_FILTER)
475 475
476#define MACVLAN_STATE_MASK \ 476#define MACVLAN_STATE_MASK \
477 ((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT)) 477 ((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT))
@@ -567,21 +567,21 @@ static struct rtnl_link_stats64 *macvlan_dev_get_stats64(struct net_device *dev,
567} 567}
568 568
569static int macvlan_vlan_rx_add_vid(struct net_device *dev, 569static int macvlan_vlan_rx_add_vid(struct net_device *dev,
570 unsigned short vid) 570 __be16 proto, u16 vid)
571{ 571{
572 struct macvlan_dev *vlan = netdev_priv(dev); 572 struct macvlan_dev *vlan = netdev_priv(dev);
573 struct net_device *lowerdev = vlan->lowerdev; 573 struct net_device *lowerdev = vlan->lowerdev;
574 574
575 return vlan_vid_add(lowerdev, vid); 575 return vlan_vid_add(lowerdev, proto, vid);
576} 576}
577 577
578static int macvlan_vlan_rx_kill_vid(struct net_device *dev, 578static int macvlan_vlan_rx_kill_vid(struct net_device *dev,
579 unsigned short vid) 579 __be16 proto, u16 vid)
580{ 580{
581 struct macvlan_dev *vlan = netdev_priv(dev); 581 struct macvlan_dev *vlan = netdev_priv(dev);
582 struct net_device *lowerdev = vlan->lowerdev; 582 struct net_device *lowerdev = vlan->lowerdev;
583 583
584 vlan_vid_del(lowerdev, vid); 584 vlan_vid_del(lowerdev, proto, vid);
585 return 0; 585 return 0;
586} 586}
587 587
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 9a31e8e50fac..7c43261975bd 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1598,7 +1598,7 @@ team_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
1598 return stats; 1598 return stats;
1599} 1599}
1600 1600
1601static int team_vlan_rx_add_vid(struct net_device *dev, uint16_t vid) 1601static int team_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid)
1602{ 1602{
1603 struct team *team = netdev_priv(dev); 1603 struct team *team = netdev_priv(dev);
1604 struct team_port *port; 1604 struct team_port *port;
@@ -1610,7 +1610,7 @@ static int team_vlan_rx_add_vid(struct net_device *dev, uint16_t vid)
1610 */ 1610 */
1611 mutex_lock(&team->lock); 1611 mutex_lock(&team->lock);
1612 list_for_each_entry(port, &team->port_list, list) { 1612 list_for_each_entry(port, &team->port_list, list) {
1613 err = vlan_vid_add(port->dev, vid); 1613 err = vlan_vid_add(port->dev, proto, vid);
1614 if (err) 1614 if (err)
1615 goto unwind; 1615 goto unwind;
1616 } 1616 }
@@ -1620,20 +1620,20 @@ static int team_vlan_rx_add_vid(struct net_device *dev, uint16_t vid)
1620 1620
1621unwind: 1621unwind:
1622 list_for_each_entry_continue_reverse(port, &team->port_list, list) 1622 list_for_each_entry_continue_reverse(port, &team->port_list, list)
1623 vlan_vid_del(port->dev, vid); 1623 vlan_vid_del(port->dev, proto, vid);
1624 mutex_unlock(&team->lock); 1624 mutex_unlock(&team->lock);
1625 1625
1626 return err; 1626 return err;
1627} 1627}
1628 1628
1629static int team_vlan_rx_kill_vid(struct net_device *dev, uint16_t vid) 1629static int team_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid)
1630{ 1630{
1631 struct team *team = netdev_priv(dev); 1631 struct team *team = netdev_priv(dev);
1632 struct team_port *port; 1632 struct team_port *port;
1633 1633
1634 rcu_read_lock(); 1634 rcu_read_lock();
1635 list_for_each_entry_rcu(port, &team->port_list, list) 1635 list_for_each_entry_rcu(port, &team->port_list, list)
1636 vlan_vid_del(port->dev, vid); 1636 vlan_vid_del(port->dev, proto, vid);
1637 rcu_read_unlock(); 1637 rcu_read_unlock();
1638 1638
1639 return 0; 1639 return 0;
@@ -1841,9 +1841,9 @@ static void team_setup(struct net_device *dev)
1841 dev->features |= NETIF_F_LLTX; 1841 dev->features |= NETIF_F_LLTX;
1842 dev->features |= NETIF_F_GRO; 1842 dev->features |= NETIF_F_GRO;
1843 dev->hw_features = TEAM_VLAN_FEATURES | 1843 dev->hw_features = TEAM_VLAN_FEATURES |
1844 NETIF_F_HW_VLAN_TX | 1844 NETIF_F_HW_VLAN_CTAG_TX |
1845 NETIF_F_HW_VLAN_RX | 1845 NETIF_F_HW_VLAN_CTAG_RX |
1846 NETIF_F_HW_VLAN_FILTER; 1846 NETIF_F_HW_VLAN_CTAG_FILTER;
1847 1847
1848 dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM); 1848 dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM);
1849 dev->features |= dev->hw_features; 1849 dev->features |= dev->hw_features;
diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c
index 16c842997291..cc6dfe4102fd 100644
--- a/drivers/net/usb/cdc_mbim.c
+++ b/drivers/net/usb/cdc_mbim.c
@@ -101,7 +101,7 @@ static int cdc_mbim_bind(struct usbnet *dev, struct usb_interface *intf)
101 dev->net->flags |= IFF_NOARP; 101 dev->net->flags |= IFF_NOARP;
102 102
103 /* no need to put the VLAN tci in the packet headers */ 103 /* no need to put the VLAN tci in the packet headers */
104 dev->net->features |= NETIF_F_HW_VLAN_TX; 104 dev->net->features |= NETIF_F_HW_VLAN_CTAG_TX;
105err: 105err:
106 return ret; 106 return ret;
107} 107}
@@ -221,7 +221,7 @@ static struct sk_buff *cdc_mbim_process_dgram(struct usbnet *dev, u8 *buf, size_
221 221
222 /* map MBIM session to VLAN */ 222 /* map MBIM session to VLAN */
223 if (tci) 223 if (tci)
224 vlan_put_tag(skb, tci); 224 vlan_put_tag(skb, htons(ETH_P_8021Q), tci);
225err: 225err:
226 return skb; 226 return skb;
227} 227}
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 07a4af0aa3dc..177f911f5946 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -255,7 +255,8 @@ static const struct net_device_ops veth_netdev_ops = {
255 255
256#define VETH_FEATURES (NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \ 256#define VETH_FEATURES (NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \
257 NETIF_F_HW_CSUM | NETIF_F_RXCSUM | NETIF_F_HIGHDMA | \ 257 NETIF_F_HW_CSUM | NETIF_F_RXCSUM | NETIF_F_HIGHDMA | \
258 NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX) 258 NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | \
259 NETIF_F_HW_VLAN_STAG_TX | NETIF_F_HW_VLAN_STAG_RX )
259 260
260static void veth_setup(struct net_device *dev) 261static void veth_setup(struct net_device *dev)
261{ 262{
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 8fdfde6832ab..50077753a0e5 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1006,7 +1006,8 @@ static void virtnet_set_rx_mode(struct net_device *dev)
1006 kfree(buf); 1006 kfree(buf);
1007} 1007}
1008 1008
1009static int virtnet_vlan_rx_add_vid(struct net_device *dev, u16 vid) 1009static int virtnet_vlan_rx_add_vid(struct net_device *dev,
1010 __be16 proto, u16 vid)
1010{ 1011{
1011 struct virtnet_info *vi = netdev_priv(dev); 1012 struct virtnet_info *vi = netdev_priv(dev);
1012 struct scatterlist sg; 1013 struct scatterlist sg;
@@ -1019,7 +1020,8 @@ static int virtnet_vlan_rx_add_vid(struct net_device *dev, u16 vid)
1019 return 0; 1020 return 0;
1020} 1021}
1021 1022
1022static int virtnet_vlan_rx_kill_vid(struct net_device *dev, u16 vid) 1023static int virtnet_vlan_rx_kill_vid(struct net_device *dev,
1024 __be16 proto, u16 vid)
1023{ 1025{
1024 struct virtnet_info *vi = netdev_priv(dev); 1026 struct virtnet_info *vi = netdev_priv(dev);
1025 struct scatterlist sg; 1027 struct scatterlist sg;
@@ -1376,7 +1378,7 @@ static int virtnet_find_vqs(struct virtnet_info *vi)
1376 if (vi->has_cvq) { 1378 if (vi->has_cvq) {
1377 vi->cvq = vqs[total_vqs - 1]; 1379 vi->cvq = vqs[total_vqs - 1];
1378 if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VLAN)) 1380 if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VLAN))
1379 vi->dev->features |= NETIF_F_HW_VLAN_FILTER; 1381 vi->dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
1380 } 1382 }
1381 1383
1382 for (i = 0; i < vi->max_queue_pairs; i++) { 1384 for (i = 0; i < vi->max_queue_pairs; i++) {
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index eae7a03d4f9b..55a62cae2cb4 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -1293,7 +1293,7 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
1293 skb->protocol = eth_type_trans(skb, adapter->netdev); 1293 skb->protocol = eth_type_trans(skb, adapter->netdev);
1294 1294
1295 if (unlikely(rcd->ts)) 1295 if (unlikely(rcd->ts))
1296 __vlan_hwaccel_put_tag(skb, rcd->tci); 1296 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), rcd->tci);
1297 1297
1298 if (adapter->netdev->features & NETIF_F_LRO) 1298 if (adapter->netdev->features & NETIF_F_LRO)
1299 netif_receive_skb(skb); 1299 netif_receive_skb(skb);
@@ -1931,7 +1931,7 @@ vmxnet3_restore_vlan(struct vmxnet3_adapter *adapter)
1931 1931
1932 1932
1933static int 1933static int
1934vmxnet3_vlan_rx_add_vid(struct net_device *netdev, u16 vid) 1934vmxnet3_vlan_rx_add_vid(struct net_device *netdev, __be16 proto, u16 vid)
1935{ 1935{
1936 struct vmxnet3_adapter *adapter = netdev_priv(netdev); 1936 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
1937 1937
@@ -1953,7 +1953,7 @@ vmxnet3_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
1953 1953
1954 1954
1955static int 1955static int
1956vmxnet3_vlan_rx_kill_vid(struct net_device *netdev, u16 vid) 1956vmxnet3_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid)
1957{ 1957{
1958 struct vmxnet3_adapter *adapter = netdev_priv(netdev); 1958 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
1959 1959
@@ -2107,7 +2107,7 @@ vmxnet3_setup_driver_shared(struct vmxnet3_adapter *adapter)
2107 devRead->misc.uptFeatures |= UPT1_F_LRO; 2107 devRead->misc.uptFeatures |= UPT1_F_LRO;
2108 devRead->misc.maxNumRxSG = cpu_to_le16(1 + MAX_SKB_FRAGS); 2108 devRead->misc.maxNumRxSG = cpu_to_le16(1 + MAX_SKB_FRAGS);
2109 } 2109 }
2110 if (adapter->netdev->features & NETIF_F_HW_VLAN_RX) 2110 if (adapter->netdev->features & NETIF_F_HW_VLAN_CTAG_RX)
2111 devRead->misc.uptFeatures |= UPT1_F_RXVLAN; 2111 devRead->misc.uptFeatures |= UPT1_F_RXVLAN;
2112 2112
2113 devRead->misc.mtu = cpu_to_le32(adapter->netdev->mtu); 2113 devRead->misc.mtu = cpu_to_le32(adapter->netdev->mtu);
@@ -2669,14 +2669,15 @@ vmxnet3_declare_features(struct vmxnet3_adapter *adapter, bool dma64)
2669 struct net_device *netdev = adapter->netdev; 2669 struct net_device *netdev = adapter->netdev;
2670 2670
2671 netdev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM | 2671 netdev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM |
2672 NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_TX | 2672 NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_TX |
2673 NETIF_F_HW_VLAN_RX | NETIF_F_TSO | NETIF_F_TSO6 | 2673 NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_TSO | NETIF_F_TSO6 |
2674 NETIF_F_LRO; 2674 NETIF_F_LRO;
2675 if (dma64) 2675 if (dma64)
2676 netdev->hw_features |= NETIF_F_HIGHDMA; 2676 netdev->hw_features |= NETIF_F_HIGHDMA;
2677 netdev->vlan_features = netdev->hw_features & 2677 netdev->vlan_features = netdev->hw_features &
2678 ~(NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX); 2678 ~(NETIF_F_HW_VLAN_CTAG_TX |
2679 netdev->features = netdev->hw_features | NETIF_F_HW_VLAN_FILTER; 2679 NETIF_F_HW_VLAN_CTAG_RX);
2680 netdev->features = netdev->hw_features | NETIF_F_HW_VLAN_CTAG_FILTER;
2680} 2681}
2681 2682
2682 2683
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c
index 63a124340cbe..600ab56c0008 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethtool.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c
@@ -263,7 +263,8 @@ int vmxnet3_set_features(struct net_device *netdev, netdev_features_t features)
263 unsigned long flags; 263 unsigned long flags;
264 netdev_features_t changed = features ^ netdev->features; 264 netdev_features_t changed = features ^ netdev->features;
265 265
266 if (changed & (NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_HW_VLAN_RX)) { 266 if (changed & (NETIF_F_RXCSUM | NETIF_F_LRO |
267 NETIF_F_HW_VLAN_CTAG_RX)) {
267 if (features & NETIF_F_RXCSUM) 268 if (features & NETIF_F_RXCSUM)
268 adapter->shared->devRead.misc.uptFeatures |= 269 adapter->shared->devRead.misc.uptFeatures |=
269 UPT1_F_RXCSUM; 270 UPT1_F_RXCSUM;
@@ -279,7 +280,7 @@ int vmxnet3_set_features(struct net_device *netdev, netdev_features_t features)
279 adapter->shared->devRead.misc.uptFeatures &= 280 adapter->shared->devRead.misc.uptFeatures &=
280 ~UPT1_F_LRO; 281 ~UPT1_F_LRO;
281 282
282 if (features & NETIF_F_HW_VLAN_RX) 283 if (features & NETIF_F_HW_VLAN_CTAG_RX)
283 adapter->shared->devRead.misc.uptFeatures |= 284 adapter->shared->devRead.misc.uptFeatures |=
284 UPT1_F_RXVLAN; 285 UPT1_F_RXVLAN;
285 else 286 else
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index d690166efeaf..e68f79b38556 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -302,7 +302,8 @@ static void qeth_l2_process_vlans(struct qeth_card *card)
302 spin_unlock_bh(&card->vlanlock); 302 spin_unlock_bh(&card->vlanlock);
303} 303}
304 304
305static int qeth_l2_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) 305static int qeth_l2_vlan_rx_add_vid(struct net_device *dev,
306 __be16 proto, u16 vid)
306{ 307{
307 struct qeth_card *card = dev->ml_priv; 308 struct qeth_card *card = dev->ml_priv;
308 struct qeth_vlan_vid *id; 309 struct qeth_vlan_vid *id;
@@ -331,7 +332,8 @@ static int qeth_l2_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
331 return 0; 332 return 0;
332} 333}
333 334
334static int qeth_l2_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) 335static int qeth_l2_vlan_rx_kill_vid(struct net_device *dev,
336 __be16 proto, u16 vid)
335{ 337{
336 struct qeth_vlan_vid *id, *tmpid = NULL; 338 struct qeth_vlan_vid *id, *tmpid = NULL;
337 struct qeth_card *card = dev->ml_priv; 339 struct qeth_card *card = dev->ml_priv;
@@ -959,7 +961,7 @@ static int qeth_l2_setup_netdev(struct qeth_card *card)
959 SET_ETHTOOL_OPS(card->dev, &qeth_l2_ethtool_ops); 961 SET_ETHTOOL_OPS(card->dev, &qeth_l2_ethtool_ops);
960 else 962 else
961 SET_ETHTOOL_OPS(card->dev, &qeth_l2_osn_ops); 963 SET_ETHTOOL_OPS(card->dev, &qeth_l2_osn_ops);
962 card->dev->features |= NETIF_F_HW_VLAN_FILTER; 964 card->dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
963 card->info.broadcast_capable = 1; 965 card->info.broadcast_capable = 1;
964 qeth_l2_request_initial_mac(card); 966 qeth_l2_request_initial_mac(card);
965 SET_NETDEV_DEV(card->dev, &card->gdev->dev); 967 SET_NETDEV_DEV(card->dev, &card->gdev->dev);
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index 8710337dab3e..642686846a14 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -1824,7 +1824,8 @@ static void qeth_l3_free_vlan_addresses(struct qeth_card *card,
1824 rcu_read_unlock(); 1824 rcu_read_unlock();
1825} 1825}
1826 1826
1827static int qeth_l3_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) 1827static int qeth_l3_vlan_rx_add_vid(struct net_device *dev,
1828 __be16 proto, u16 vid)
1828{ 1829{
1829 struct qeth_card *card = dev->ml_priv; 1830 struct qeth_card *card = dev->ml_priv;
1830 1831
@@ -1832,7 +1833,8 @@ static int qeth_l3_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
1832 return 0; 1833 return 0;
1833} 1834}
1834 1835
1835static int qeth_l3_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) 1836static int qeth_l3_vlan_rx_kill_vid(struct net_device *dev,
1837 __be16 proto, u16 vid)
1836{ 1838{
1837 struct qeth_card *card = dev->ml_priv; 1839 struct qeth_card *card = dev->ml_priv;
1838 unsigned long flags; 1840 unsigned long flags;
@@ -3294,9 +3296,9 @@ static int qeth_l3_setup_netdev(struct qeth_card *card)
3294 card->dev->watchdog_timeo = QETH_TX_TIMEOUT; 3296 card->dev->watchdog_timeo = QETH_TX_TIMEOUT;
3295 card->dev->mtu = card->info.initial_mtu; 3297 card->dev->mtu = card->info.initial_mtu;
3296 SET_ETHTOOL_OPS(card->dev, &qeth_l3_ethtool_ops); 3298 SET_ETHTOOL_OPS(card->dev, &qeth_l3_ethtool_ops);
3297 card->dev->features |= NETIF_F_HW_VLAN_TX | 3299 card->dev->features |= NETIF_F_HW_VLAN_CTAG_TX |
3298 NETIF_F_HW_VLAN_RX | 3300 NETIF_F_HW_VLAN_CTAG_RX |
3299 NETIF_F_HW_VLAN_FILTER; 3301 NETIF_F_HW_VLAN_CTAG_FILTER;
3300 card->dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; 3302 card->dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
3301 card->dev->gso_max_size = 15 * PAGE_SIZE; 3303 card->dev->gso_max_size = 15 * PAGE_SIZE;
3302 3304
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 9bfdc9a3f897..292b24f9bf93 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -1655,7 +1655,7 @@ static int fcoe_xmit(struct fc_lport *lport, struct fc_frame *fp)
1655 skb->priority = fcoe->priority; 1655 skb->priority = fcoe->priority;
1656 1656
1657 if (fcoe->netdev->priv_flags & IFF_802_1Q_VLAN && 1657 if (fcoe->netdev->priv_flags & IFF_802_1Q_VLAN &&
1658 fcoe->realdev->features & NETIF_F_HW_VLAN_TX) { 1658 fcoe->realdev->features & NETIF_F_HW_VLAN_CTAG_TX) {
1659 skb->vlan_tci = VLAN_TAG_PRESENT | 1659 skb->vlan_tci = VLAN_TAG_PRESENT |
1660 vlan_dev_vlan_id(fcoe->netdev); 1660 vlan_dev_vlan_id(fcoe->netdev);
1661 skb->dev = fcoe->realdev; 1661 skb->dev = fcoe->realdev;
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 70962f3fdb79..a78f9390da87 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -86,15 +86,15 @@ static inline int is_vlan_dev(struct net_device *dev)
86#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 86#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
87 87
88extern struct net_device *__vlan_find_dev_deep(struct net_device *real_dev, 88extern struct net_device *__vlan_find_dev_deep(struct net_device *real_dev,
89 u16 vlan_id); 89 __be16 vlan_proto, u16 vlan_id);
90extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); 90extern struct net_device *vlan_dev_real_dev(const struct net_device *dev);
91extern u16 vlan_dev_vlan_id(const struct net_device *dev); 91extern u16 vlan_dev_vlan_id(const struct net_device *dev);
92 92
93extern bool vlan_do_receive(struct sk_buff **skb); 93extern bool vlan_do_receive(struct sk_buff **skb);
94extern struct sk_buff *vlan_untag(struct sk_buff *skb); 94extern struct sk_buff *vlan_untag(struct sk_buff *skb);
95 95
96extern int vlan_vid_add(struct net_device *dev, unsigned short vid); 96extern int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid);
97extern void vlan_vid_del(struct net_device *dev, unsigned short vid); 97extern void vlan_vid_del(struct net_device *dev, __be16 proto, u16 vid);
98 98
99extern int vlan_vids_add_by_dev(struct net_device *dev, 99extern int vlan_vids_add_by_dev(struct net_device *dev,
100 const struct net_device *by_dev); 100 const struct net_device *by_dev);
@@ -157,9 +157,20 @@ static inline bool vlan_uses_dev(const struct net_device *dev)
157} 157}
158#endif 158#endif
159 159
160static inline bool vlan_hw_offload_capable(netdev_features_t features,
161 __be16 proto)
162{
163 if (proto == htons(ETH_P_8021Q) && features & NETIF_F_HW_VLAN_CTAG_TX)
164 return true;
165 if (proto == htons(ETH_P_8021AD) && features & NETIF_F_HW_VLAN_STAG_TX)
166 return true;
167 return false;
168}
169
160/** 170/**
161 * vlan_insert_tag - regular VLAN tag inserting 171 * vlan_insert_tag - regular VLAN tag inserting
162 * @skb: skbuff to tag 172 * @skb: skbuff to tag
173 * @vlan_proto: VLAN encapsulation protocol
163 * @vlan_tci: VLAN TCI to insert 174 * @vlan_tci: VLAN TCI to insert
164 * 175 *
165 * Inserts the VLAN tag into @skb as part of the payload 176 * Inserts the VLAN tag into @skb as part of the payload
@@ -170,7 +181,8 @@ static inline bool vlan_uses_dev(const struct net_device *dev)
170 * 181 *
171 * Does not change skb->protocol so this function can be used during receive. 182 * Does not change skb->protocol so this function can be used during receive.
172 */ 183 */
173static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci) 184static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb,
185 __be16 vlan_proto, u16 vlan_tci)
174{ 186{
175 struct vlan_ethhdr *veth; 187 struct vlan_ethhdr *veth;
176 188
@@ -185,7 +197,7 @@ static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci)
185 skb->mac_header -= VLAN_HLEN; 197 skb->mac_header -= VLAN_HLEN;
186 198
187 /* first, the ethernet type */ 199 /* first, the ethernet type */
188 veth->h_vlan_proto = htons(ETH_P_8021Q); 200 veth->h_vlan_proto = vlan_proto;
189 201
190 /* now, the TCI */ 202 /* now, the TCI */
191 veth->h_vlan_TCI = htons(vlan_tci); 203 veth->h_vlan_TCI = htons(vlan_tci);
@@ -204,24 +216,28 @@ static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci)
204 * Following the skb_unshare() example, in case of error, the calling function 216 * Following the skb_unshare() example, in case of error, the calling function
205 * doesn't have to worry about freeing the original skb. 217 * doesn't have to worry about freeing the original skb.
206 */ 218 */
207static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci) 219static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb,
220 __be16 vlan_proto, u16 vlan_tci)
208{ 221{
209 skb = vlan_insert_tag(skb, vlan_tci); 222 skb = vlan_insert_tag(skb, vlan_proto, vlan_tci);
210 if (skb) 223 if (skb)
211 skb->protocol = htons(ETH_P_8021Q); 224 skb->protocol = vlan_proto;
212 return skb; 225 return skb;
213} 226}
214 227
215/** 228/**
216 * __vlan_hwaccel_put_tag - hardware accelerated VLAN inserting 229 * __vlan_hwaccel_put_tag - hardware accelerated VLAN inserting
217 * @skb: skbuff to tag 230 * @skb: skbuff to tag
231 * @vlan_proto: VLAN encapsulation protocol
218 * @vlan_tci: VLAN TCI to insert 232 * @vlan_tci: VLAN TCI to insert
219 * 233 *
220 * Puts the VLAN TCI in @skb->vlan_tci and lets the device do the rest 234 * Puts the VLAN TCI in @skb->vlan_tci and lets the device do the rest
221 */ 235 */
222static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, 236static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb,
237 __be16 vlan_proto,
223 u16 vlan_tci) 238 u16 vlan_tci)
224{ 239{
240 skb->vlan_proto = vlan_proto;
225 skb->vlan_tci = VLAN_TAG_PRESENT | vlan_tci; 241 skb->vlan_tci = VLAN_TAG_PRESENT | vlan_tci;
226 return skb; 242 return skb;
227} 243}
@@ -236,12 +252,13 @@ static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb,
236 * Assumes skb->dev is the target that will xmit this frame. 252 * Assumes skb->dev is the target that will xmit this frame.
237 * Returns a VLAN tagged skb. 253 * Returns a VLAN tagged skb.
238 */ 254 */
239static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb, u16 vlan_tci) 255static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb,
256 __be16 vlan_proto, u16 vlan_tci)
240{ 257{
241 if (skb->dev->features & NETIF_F_HW_VLAN_TX) { 258 if (vlan_hw_offload_capable(skb->dev->features, vlan_proto)) {
242 return __vlan_hwaccel_put_tag(skb, vlan_tci); 259 return __vlan_hwaccel_put_tag(skb, vlan_proto, vlan_tci);
243 } else { 260 } else {
244 return __vlan_put_tag(skb, vlan_tci); 261 return __vlan_put_tag(skb, vlan_proto, vlan_tci);
245 } 262 }
246} 263}
247 264
@@ -256,9 +273,9 @@ static inline int __vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci)
256{ 273{
257 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data; 274 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data;
258 275
259 if (veth->h_vlan_proto != htons(ETH_P_8021Q)) { 276 if (veth->h_vlan_proto != htons(ETH_P_8021Q) &&
277 veth->h_vlan_proto != htons(ETH_P_8021AD))
260 return -EINVAL; 278 return -EINVAL;
261 }
262 279
263 *vlan_tci = ntohs(veth->h_vlan_TCI); 280 *vlan_tci = ntohs(veth->h_vlan_TCI);
264 return 0; 281 return 0;
@@ -294,7 +311,7 @@ static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb,
294 */ 311 */
295static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci) 312static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci)
296{ 313{
297 if (skb->dev->features & NETIF_F_HW_VLAN_TX) { 314 if (skb->dev->features & NETIF_F_HW_VLAN_CTAG_TX) {
298 return __vlan_hwaccel_get_tag(skb, vlan_tci); 315 return __vlan_hwaccel_get_tag(skb, vlan_tci);
299 } else { 316 } else {
300 return __vlan_get_tag(skb, vlan_tci); 317 return __vlan_get_tag(skb, vlan_tci);
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index d6ee2d008ee4..cbaa027ef5a7 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -22,9 +22,12 @@ enum {
22 NETIF_F_IPV6_CSUM_BIT, /* Can checksum TCP/UDP over IPV6 */ 22 NETIF_F_IPV6_CSUM_BIT, /* Can checksum TCP/UDP over IPV6 */
23 NETIF_F_HIGHDMA_BIT, /* Can DMA to high memory. */ 23 NETIF_F_HIGHDMA_BIT, /* Can DMA to high memory. */
24 NETIF_F_FRAGLIST_BIT, /* Scatter/gather IO. */ 24 NETIF_F_FRAGLIST_BIT, /* Scatter/gather IO. */
25 NETIF_F_HW_VLAN_TX_BIT, /* Transmit VLAN hw acceleration */ 25 NETIF_F_HW_VLAN_CTAG_TX_BIT, /* Transmit VLAN CTAG HW acceleration */
26 NETIF_F_HW_VLAN_RX_BIT, /* Receive VLAN hw acceleration */ 26 NETIF_F_HW_VLAN_CTAG_RX_BIT, /* Receive VLAN CTAG HW acceleration */
27 NETIF_F_HW_VLAN_FILTER_BIT, /* Receive filtering on VLAN */ 27 NETIF_F_HW_VLAN_CTAG_FILTER_BIT,/* Receive filtering on VLAN CTAGs */
28 NETIF_F_HW_VLAN_STAG_TX_BIT, /* Transmit VLAN STAG HW acceleration */
29 NETIF_F_HW_VLAN_STAG_RX_BIT, /* Receive VLAN STAG HW acceleration */
30 NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */
28 NETIF_F_VLAN_CHALLENGED_BIT, /* Device cannot handle VLAN packets */ 31 NETIF_F_VLAN_CHALLENGED_BIT, /* Device cannot handle VLAN packets */
29 NETIF_F_GSO_BIT, /* Enable software GSO. */ 32 NETIF_F_GSO_BIT, /* Enable software GSO. */
30 NETIF_F_LLTX_BIT, /* LockLess TX - deprecated. Please */ 33 NETIF_F_LLTX_BIT, /* LockLess TX - deprecated. Please */
@@ -80,9 +83,12 @@ enum {
80#define NETIF_F_GSO_ROBUST __NETIF_F(GSO_ROBUST) 83#define NETIF_F_GSO_ROBUST __NETIF_F(GSO_ROBUST)
81#define NETIF_F_HIGHDMA __NETIF_F(HIGHDMA) 84#define NETIF_F_HIGHDMA __NETIF_F(HIGHDMA)
82#define NETIF_F_HW_CSUM __NETIF_F(HW_CSUM) 85#define NETIF_F_HW_CSUM __NETIF_F(HW_CSUM)
83#define NETIF_F_HW_VLAN_FILTER __NETIF_F(HW_VLAN_FILTER) 86#define NETIF_F_HW_VLAN_CTAG_FILTER __NETIF_F(HW_VLAN_CTAG_FILTER)
84#define NETIF_F_HW_VLAN_RX __NETIF_F(HW_VLAN_RX) 87#define NETIF_F_HW_VLAN_CTAG_RX __NETIF_F(HW_VLAN_CTAG_RX)
85#define NETIF_F_HW_VLAN_TX __NETIF_F(HW_VLAN_TX) 88#define NETIF_F_HW_VLAN_CTAG_TX __NETIF_F(HW_VLAN_CTAG_TX)
89#define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER)
90#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX)
91#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX)
86#define NETIF_F_IP_CSUM __NETIF_F(IP_CSUM) 92#define NETIF_F_IP_CSUM __NETIF_F(IP_CSUM)
87#define NETIF_F_IPV6_CSUM __NETIF_F(IPV6_CSUM) 93#define NETIF_F_IPV6_CSUM __NETIF_F(IPV6_CSUM)
88#define NETIF_F_LLTX __NETIF_F(LLTX) 94#define NETIF_F_LLTX __NETIF_F(LLTX)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 623b57b52195..f8898a435dc5 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -784,13 +784,13 @@ struct netdev_fcoe_hbainfo {
784 * 3. Update dev->stats asynchronously and atomically, and define 784 * 3. Update dev->stats asynchronously and atomically, and define
785 * neither operation. 785 * neither operation.
786 * 786 *
787 * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid); 787 * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, __be16 proto, u16t vid);
788 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) 788 * If device support VLAN filtering this function is called when a
789 * this function is called when a VLAN id is registered. 789 * VLAN id is registered.
790 * 790 *
791 * int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid); 791 * int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid);
792 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) 792 * If device support VLAN filtering this function is called when a
793 * this function is called when a VLAN id is unregistered. 793 * VLAN id is unregistered.
794 * 794 *
795 * void (*ndo_poll_controller)(struct net_device *dev); 795 * void (*ndo_poll_controller)(struct net_device *dev);
796 * 796 *
@@ -934,9 +934,9 @@ struct net_device_ops {
934 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); 934 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
935 935
936 int (*ndo_vlan_rx_add_vid)(struct net_device *dev, 936 int (*ndo_vlan_rx_add_vid)(struct net_device *dev,
937 unsigned short vid); 937 __be16 proto, u16 vid);
938 int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, 938 int (*ndo_vlan_rx_kill_vid)(struct net_device *dev,
939 unsigned short vid); 939 __be16 proto, u16 vid);
940#ifdef CONFIG_NET_POLL_CONTROLLER 940#ifdef CONFIG_NET_POLL_CONTROLLER
941 void (*ndo_poll_controller)(struct net_device *dev); 941 void (*ndo_poll_controller)(struct net_device *dev);
942 int (*ndo_netpoll_setup)(struct net_device *dev, 942 int (*ndo_netpoll_setup)(struct net_device *dev,
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index e27d1c782f32..f5bed7b31954 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -387,6 +387,7 @@ typedef unsigned char *sk_buff_data_t;
387 * @secmark: security marking 387 * @secmark: security marking
388 * @mark: Generic packet mark 388 * @mark: Generic packet mark
389 * @dropcount: total number of sk_receive_queue overflows 389 * @dropcount: total number of sk_receive_queue overflows
390 * @vlan_proto: vlan encapsulation protocol
390 * @vlan_tci: vlan tag control information 391 * @vlan_tci: vlan tag control information
391 * @inner_transport_header: Inner transport layer header (encapsulation) 392 * @inner_transport_header: Inner transport layer header (encapsulation)
392 * @inner_network_header: Network layer header (encapsulation) 393 * @inner_network_header: Network layer header (encapsulation)
@@ -465,6 +466,7 @@ struct sk_buff {
465 466
466 __u32 rxhash; 467 __u32 rxhash;
467 468
469 __be16 vlan_proto;
468 __u16 vlan_tci; 470 __u16 vlan_tci;
469 471
470#ifdef CONFIG_NET_SCHED 472#ifdef CONFIG_NET_SCHED
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 9922704f08af..e3163544f339 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -250,6 +250,7 @@ enum {
250 IFLA_VLAN_FLAGS, 250 IFLA_VLAN_FLAGS,
251 IFLA_VLAN_EGRESS_QOS, 251 IFLA_VLAN_EGRESS_QOS,
252 IFLA_VLAN_INGRESS_QOS, 252 IFLA_VLAN_INGRESS_QOS,
253 IFLA_VLAN_PROTOCOL,
253 __IFLA_VLAN_MAX, 254 __IFLA_VLAN_MAX,
254}; 255};
255 256
diff --git a/net/8021q/Kconfig b/net/8021q/Kconfig
index 8f7517df41a5..b85a91fa61f1 100644
--- a/net/8021q/Kconfig
+++ b/net/8021q/Kconfig
@@ -3,7 +3,7 @@
3# 3#
4 4
5config VLAN_8021Q 5config VLAN_8021Q
6 tristate "802.1Q VLAN Support" 6 tristate "802.1Q/802.1ad VLAN Support"
7 ---help--- 7 ---help---
8 Select this and you will be able to create 802.1Q VLAN interfaces 8 Select this and you will be able to create 802.1Q VLAN interfaces
9 on your ethernet interfaces. 802.1Q VLAN supports almost 9 on your ethernet interfaces. 802.1Q VLAN supports almost
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 85addcd9372b..9424f3718ea7 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -51,14 +51,18 @@ const char vlan_version[] = DRV_VERSION;
51 51
52/* End of global variables definitions. */ 52/* End of global variables definitions. */
53 53
54static int vlan_group_prealloc_vid(struct vlan_group *vg, u16 vlan_id) 54static int vlan_group_prealloc_vid(struct vlan_group *vg,
55 __be16 vlan_proto, u16 vlan_id)
55{ 56{
56 struct net_device **array; 57 struct net_device **array;
58 unsigned int pidx, vidx;
57 unsigned int size; 59 unsigned int size;
58 60
59 ASSERT_RTNL(); 61 ASSERT_RTNL();
60 62
61 array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN]; 63 pidx = vlan_proto_idx(vlan_proto);
64 vidx = vlan_id / VLAN_GROUP_ARRAY_PART_LEN;
65 array = vg->vlan_devices_arrays[pidx][vidx];
62 if (array != NULL) 66 if (array != NULL)
63 return 0; 67 return 0;
64 68
@@ -67,7 +71,7 @@ static int vlan_group_prealloc_vid(struct vlan_group *vg, u16 vlan_id)
67 if (array == NULL) 71 if (array == NULL)
68 return -ENOBUFS; 72 return -ENOBUFS;
69 73
70 vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN] = array; 74 vg->vlan_devices_arrays[pidx][vidx] = array;
71 return 0; 75 return 0;
72} 76}
73 77
@@ -93,7 +97,7 @@ void unregister_vlan_dev(struct net_device *dev, struct list_head *head)
93 if (vlan->flags & VLAN_FLAG_GVRP) 97 if (vlan->flags & VLAN_FLAG_GVRP)
94 vlan_gvrp_request_leave(dev); 98 vlan_gvrp_request_leave(dev);
95 99
96 vlan_group_set_device(grp, vlan_id, NULL); 100 vlan_group_set_device(grp, vlan->vlan_proto, vlan_id, NULL);
97 /* Because unregister_netdevice_queue() makes sure at least one rcu 101 /* Because unregister_netdevice_queue() makes sure at least one rcu
98 * grace period is respected before device freeing, 102 * grace period is respected before device freeing,
99 * we dont need to call synchronize_net() here. 103 * we dont need to call synchronize_net() here.
@@ -112,13 +116,14 @@ void unregister_vlan_dev(struct net_device *dev, struct list_head *head)
112 * VLAN is not 0 (leave it there for 802.1p). 116 * VLAN is not 0 (leave it there for 802.1p).
113 */ 117 */
114 if (vlan_id) 118 if (vlan_id)
115 vlan_vid_del(real_dev, vlan_id); 119 vlan_vid_del(real_dev, vlan->vlan_proto, vlan_id);
116 120
117 /* Get rid of the vlan's reference to real_dev */ 121 /* Get rid of the vlan's reference to real_dev */
118 dev_put(real_dev); 122 dev_put(real_dev);
119} 123}
120 124
121int vlan_check_real_dev(struct net_device *real_dev, u16 vlan_id) 125int vlan_check_real_dev(struct net_device *real_dev,
126 __be16 protocol, u16 vlan_id)
122{ 127{
123 const char *name = real_dev->name; 128 const char *name = real_dev->name;
124 129
@@ -127,7 +132,7 @@ int vlan_check_real_dev(struct net_device *real_dev, u16 vlan_id)
127 return -EOPNOTSUPP; 132 return -EOPNOTSUPP;
128 } 133 }
129 134
130 if (vlan_find_dev(real_dev, vlan_id) != NULL) 135 if (vlan_find_dev(real_dev, protocol, vlan_id) != NULL)
131 return -EEXIST; 136 return -EEXIST;
132 137
133 return 0; 138 return 0;
@@ -142,7 +147,7 @@ int register_vlan_dev(struct net_device *dev)
142 struct vlan_group *grp; 147 struct vlan_group *grp;
143 int err; 148 int err;
144 149
145 err = vlan_vid_add(real_dev, vlan_id); 150 err = vlan_vid_add(real_dev, vlan->vlan_proto, vlan_id);
146 if (err) 151 if (err)
147 return err; 152 return err;
148 153
@@ -160,7 +165,7 @@ int register_vlan_dev(struct net_device *dev)
160 goto out_uninit_gvrp; 165 goto out_uninit_gvrp;
161 } 166 }
162 167
163 err = vlan_group_prealloc_vid(grp, vlan_id); 168 err = vlan_group_prealloc_vid(grp, vlan->vlan_proto, vlan_id);
164 if (err < 0) 169 if (err < 0)
165 goto out_uninit_mvrp; 170 goto out_uninit_mvrp;
166 171
@@ -181,7 +186,7 @@ int register_vlan_dev(struct net_device *dev)
181 /* So, got the sucker initialized, now lets place 186 /* So, got the sucker initialized, now lets place
182 * it into our local structure. 187 * it into our local structure.
183 */ 188 */
184 vlan_group_set_device(grp, vlan_id, dev); 189 vlan_group_set_device(grp, vlan->vlan_proto, vlan_id, dev);
185 grp->nr_vlan_devs++; 190 grp->nr_vlan_devs++;
186 191
187 return 0; 192 return 0;
@@ -195,7 +200,7 @@ out_uninit_gvrp:
195 if (grp->nr_vlan_devs == 0) 200 if (grp->nr_vlan_devs == 0)
196 vlan_gvrp_uninit_applicant(real_dev); 201 vlan_gvrp_uninit_applicant(real_dev);
197out_vid_del: 202out_vid_del:
198 vlan_vid_del(real_dev, vlan_id); 203 vlan_vid_del(real_dev, vlan->vlan_proto, vlan_id);
199 return err; 204 return err;
200} 205}
201 206
@@ -213,7 +218,7 @@ static int register_vlan_device(struct net_device *real_dev, u16 vlan_id)
213 if (vlan_id >= VLAN_VID_MASK) 218 if (vlan_id >= VLAN_VID_MASK)
214 return -ERANGE; 219 return -ERANGE;
215 220
216 err = vlan_check_real_dev(real_dev, vlan_id); 221 err = vlan_check_real_dev(real_dev, htons(ETH_P_8021Q), vlan_id);
217 if (err < 0) 222 if (err < 0)
218 return err; 223 return err;
219 224
@@ -255,6 +260,7 @@ static int register_vlan_device(struct net_device *real_dev, u16 vlan_id)
255 new_dev->mtu = real_dev->mtu; 260 new_dev->mtu = real_dev->mtu;
256 new_dev->priv_flags |= (real_dev->priv_flags & IFF_UNICAST_FLT); 261 new_dev->priv_flags |= (real_dev->priv_flags & IFF_UNICAST_FLT);
257 262
263 vlan_dev_priv(new_dev)->vlan_proto = htons(ETH_P_8021Q);
258 vlan_dev_priv(new_dev)->vlan_id = vlan_id; 264 vlan_dev_priv(new_dev)->vlan_id = vlan_id;
259 vlan_dev_priv(new_dev)->real_dev = real_dev; 265 vlan_dev_priv(new_dev)->real_dev = real_dev;
260 vlan_dev_priv(new_dev)->dent = NULL; 266 vlan_dev_priv(new_dev)->dent = NULL;
@@ -301,7 +307,7 @@ static void vlan_transfer_features(struct net_device *dev,
301{ 307{
302 vlandev->gso_max_size = dev->gso_max_size; 308 vlandev->gso_max_size = dev->gso_max_size;
303 309
304 if (dev->features & NETIF_F_HW_VLAN_TX) 310 if (dev->features & NETIF_F_HW_VLAN_CTAG_TX)
305 vlandev->hard_header_len = dev->hard_header_len; 311 vlandev->hard_header_len = dev->hard_header_len;
306 else 312 else
307 vlandev->hard_header_len = dev->hard_header_len + VLAN_HLEN; 313 vlandev->hard_header_len = dev->hard_header_len + VLAN_HLEN;
@@ -341,16 +347,17 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
341 int i, flgs; 347 int i, flgs;
342 struct net_device *vlandev; 348 struct net_device *vlandev;
343 struct vlan_dev_priv *vlan; 349 struct vlan_dev_priv *vlan;
350 bool last = false;
344 LIST_HEAD(list); 351 LIST_HEAD(list);
345 352
346 if (is_vlan_dev(dev)) 353 if (is_vlan_dev(dev))
347 __vlan_device_event(dev, event); 354 __vlan_device_event(dev, event);
348 355
349 if ((event == NETDEV_UP) && 356 if ((event == NETDEV_UP) &&
350 (dev->features & NETIF_F_HW_VLAN_FILTER)) { 357 (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) {
351 pr_info("adding VLAN 0 to HW filter on device %s\n", 358 pr_info("adding VLAN 0 to HW filter on device %s\n",
352 dev->name); 359 dev->name);
353 vlan_vid_add(dev, 0); 360 vlan_vid_add(dev, htons(ETH_P_8021Q), 0);
354 } 361 }
355 362
356 vlan_info = rtnl_dereference(dev->vlan_info); 363 vlan_info = rtnl_dereference(dev->vlan_info);
@@ -365,22 +372,13 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
365 switch (event) { 372 switch (event) {
366 case NETDEV_CHANGE: 373 case NETDEV_CHANGE:
367 /* Propagate real device state to vlan devices */ 374 /* Propagate real device state to vlan devices */
368 for (i = 0; i < VLAN_N_VID; i++) { 375 vlan_group_for_each_dev(grp, i, vlandev)
369 vlandev = vlan_group_get_device(grp, i);
370 if (!vlandev)
371 continue;
372
373 netif_stacked_transfer_operstate(dev, vlandev); 376 netif_stacked_transfer_operstate(dev, vlandev);
374 }
375 break; 377 break;
376 378
377 case NETDEV_CHANGEADDR: 379 case NETDEV_CHANGEADDR:
378 /* Adjust unicast filters on underlying device */ 380 /* Adjust unicast filters on underlying device */
379 for (i = 0; i < VLAN_N_VID; i++) { 381 vlan_group_for_each_dev(grp, i, vlandev) {
380 vlandev = vlan_group_get_device(grp, i);
381 if (!vlandev)
382 continue;
383
384 flgs = vlandev->flags; 382 flgs = vlandev->flags;
385 if (!(flgs & IFF_UP)) 383 if (!(flgs & IFF_UP))
386 continue; 384 continue;
@@ -390,11 +388,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
390 break; 388 break;
391 389
392 case NETDEV_CHANGEMTU: 390 case NETDEV_CHANGEMTU:
393 for (i = 0; i < VLAN_N_VID; i++) { 391 vlan_group_for_each_dev(grp, i, vlandev) {
394 vlandev = vlan_group_get_device(grp, i);
395 if (!vlandev)
396 continue;
397
398 if (vlandev->mtu <= dev->mtu) 392 if (vlandev->mtu <= dev->mtu)
399 continue; 393 continue;
400 394
@@ -404,26 +398,16 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
404 398
405 case NETDEV_FEAT_CHANGE: 399 case NETDEV_FEAT_CHANGE:
406 /* Propagate device features to underlying device */ 400 /* Propagate device features to underlying device */
407 for (i = 0; i < VLAN_N_VID; i++) { 401 vlan_group_for_each_dev(grp, i, vlandev)
408 vlandev = vlan_group_get_device(grp, i);
409 if (!vlandev)
410 continue;
411
412 vlan_transfer_features(dev, vlandev); 402 vlan_transfer_features(dev, vlandev);
413 }
414
415 break; 403 break;
416 404
417 case NETDEV_DOWN: 405 case NETDEV_DOWN:
418 if (dev->features & NETIF_F_HW_VLAN_FILTER) 406 if (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)
419 vlan_vid_del(dev, 0); 407 vlan_vid_del(dev, htons(ETH_P_8021Q), 0);
420 408
421 /* Put all VLANs for this dev in the down state too. */ 409 /* Put all VLANs for this dev in the down state too. */
422 for (i = 0; i < VLAN_N_VID; i++) { 410 vlan_group_for_each_dev(grp, i, vlandev) {
423 vlandev = vlan_group_get_device(grp, i);
424 if (!vlandev)
425 continue;
426
427 flgs = vlandev->flags; 411 flgs = vlandev->flags;
428 if (!(flgs & IFF_UP)) 412 if (!(flgs & IFF_UP))
429 continue; 413 continue;
@@ -437,11 +421,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
437 421
438 case NETDEV_UP: 422 case NETDEV_UP:
439 /* Put all VLANs for this dev in the up state too. */ 423 /* Put all VLANs for this dev in the up state too. */
440 for (i = 0; i < VLAN_N_VID; i++) { 424 vlan_group_for_each_dev(grp, i, vlandev) {
441 vlandev = vlan_group_get_device(grp, i);
442 if (!vlandev)
443 continue;
444
445 flgs = vlandev->flags; 425 flgs = vlandev->flags;
446 if (flgs & IFF_UP) 426 if (flgs & IFF_UP)
447 continue; 427 continue;
@@ -458,17 +438,15 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
458 if (dev->reg_state != NETREG_UNREGISTERING) 438 if (dev->reg_state != NETREG_UNREGISTERING)
459 break; 439 break;
460 440
461 for (i = 0; i < VLAN_N_VID; i++) { 441 vlan_group_for_each_dev(grp, i, vlandev) {
462 vlandev = vlan_group_get_device(grp, i);
463 if (!vlandev)
464 continue;
465
466 /* removal of last vid destroys vlan_info, abort 442 /* removal of last vid destroys vlan_info, abort
467 * afterwards */ 443 * afterwards */
468 if (vlan_info->nr_vids == 1) 444 if (vlan_info->nr_vids == 1)
469 i = VLAN_N_VID; 445 last = true;
470 446
471 unregister_vlan_dev(vlandev, &list); 447 unregister_vlan_dev(vlandev, &list);
448 if (last)
449 break;
472 } 450 }
473 unregister_netdevice_many(&list); 451 unregister_netdevice_many(&list);
474 break; 452 break;
@@ -482,13 +460,8 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
482 case NETDEV_NOTIFY_PEERS: 460 case NETDEV_NOTIFY_PEERS:
483 case NETDEV_BONDING_FAILOVER: 461 case NETDEV_BONDING_FAILOVER:
484 /* Propagate to vlan devices */ 462 /* Propagate to vlan devices */
485 for (i = 0; i < VLAN_N_VID; i++) { 463 vlan_group_for_each_dev(grp, i, vlandev)
486 vlandev = vlan_group_get_device(grp, i);
487 if (!vlandev)
488 continue;
489
490 call_netdevice_notifiers(event, vlandev); 464 call_netdevice_notifiers(event, vlandev);
491 }
492 break; 465 break;
493 } 466 }
494 467
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h
index 670f1e8cfc0f..abc9cb631c47 100644
--- a/net/8021q/vlan.h
+++ b/net/8021q/vlan.h
@@ -49,6 +49,7 @@ struct netpoll;
49 * @ingress_priority_map: ingress priority mappings 49 * @ingress_priority_map: ingress priority mappings
50 * @nr_egress_mappings: number of egress priority mappings 50 * @nr_egress_mappings: number of egress priority mappings
51 * @egress_priority_map: hash of egress priority mappings 51 * @egress_priority_map: hash of egress priority mappings
52 * @vlan_proto: VLAN encapsulation protocol
52 * @vlan_id: VLAN identifier 53 * @vlan_id: VLAN identifier
53 * @flags: device flags 54 * @flags: device flags
54 * @real_dev: underlying netdevice 55 * @real_dev: underlying netdevice
@@ -62,6 +63,7 @@ struct vlan_dev_priv {
62 unsigned int nr_egress_mappings; 63 unsigned int nr_egress_mappings;
63 struct vlan_priority_tci_mapping *egress_priority_map[16]; 64 struct vlan_priority_tci_mapping *egress_priority_map[16];
64 65
66 __be16 vlan_proto;
65 u16 vlan_id; 67 u16 vlan_id;
66 u16 flags; 68 u16 flags;
67 69
@@ -87,10 +89,17 @@ static inline struct vlan_dev_priv *vlan_dev_priv(const struct net_device *dev)
87#define VLAN_GROUP_ARRAY_SPLIT_PARTS 8 89#define VLAN_GROUP_ARRAY_SPLIT_PARTS 8
88#define VLAN_GROUP_ARRAY_PART_LEN (VLAN_N_VID/VLAN_GROUP_ARRAY_SPLIT_PARTS) 90#define VLAN_GROUP_ARRAY_PART_LEN (VLAN_N_VID/VLAN_GROUP_ARRAY_SPLIT_PARTS)
89 91
92enum vlan_protos {
93 VLAN_PROTO_8021Q = 0,
94 VLAN_PROTO_8021AD,
95 VLAN_PROTO_NUM,
96};
97
90struct vlan_group { 98struct vlan_group {
91 unsigned int nr_vlan_devs; 99 unsigned int nr_vlan_devs;
92 struct hlist_node hlist; /* linked list */ 100 struct hlist_node hlist; /* linked list */
93 struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS]; 101 struct net_device **vlan_devices_arrays[VLAN_PROTO_NUM]
102 [VLAN_GROUP_ARRAY_SPLIT_PARTS];
94}; 103};
95 104
96struct vlan_info { 105struct vlan_info {
@@ -103,37 +112,66 @@ struct vlan_info {
103 struct rcu_head rcu; 112 struct rcu_head rcu;
104}; 113};
105 114
106static inline struct net_device *vlan_group_get_device(struct vlan_group *vg, 115static inline unsigned int vlan_proto_idx(__be16 proto)
107 u16 vlan_id) 116{
117 switch (proto) {
118 case __constant_htons(ETH_P_8021Q):
119 return VLAN_PROTO_8021Q;
120 case __constant_htons(ETH_P_8021AD):
121 return VLAN_PROTO_8021AD;
122 default:
123 BUG();
124 }
125}
126
127static inline struct net_device *__vlan_group_get_device(struct vlan_group *vg,
128 unsigned int pidx,
129 u16 vlan_id)
108{ 130{
109 struct net_device **array; 131 struct net_device **array;
110 array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN]; 132
133 array = vg->vlan_devices_arrays[pidx]
134 [vlan_id / VLAN_GROUP_ARRAY_PART_LEN];
111 return array ? array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] : NULL; 135 return array ? array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] : NULL;
112} 136}
113 137
138static inline struct net_device *vlan_group_get_device(struct vlan_group *vg,
139 __be16 vlan_proto,
140 u16 vlan_id)
141{
142 return __vlan_group_get_device(vg, vlan_proto_idx(vlan_proto), vlan_id);
143}
144
114static inline void vlan_group_set_device(struct vlan_group *vg, 145static inline void vlan_group_set_device(struct vlan_group *vg,
115 u16 vlan_id, 146 __be16 vlan_proto, u16 vlan_id,
116 struct net_device *dev) 147 struct net_device *dev)
117{ 148{
118 struct net_device **array; 149 struct net_device **array;
119 if (!vg) 150 if (!vg)
120 return; 151 return;
121 array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN]; 152 array = vg->vlan_devices_arrays[vlan_proto_idx(vlan_proto)]
153 [vlan_id / VLAN_GROUP_ARRAY_PART_LEN];
122 array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] = dev; 154 array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] = dev;
123} 155}
124 156
125/* Must be invoked with rcu_read_lock or with RTNL. */ 157/* Must be invoked with rcu_read_lock or with RTNL. */
126static inline struct net_device *vlan_find_dev(struct net_device *real_dev, 158static inline struct net_device *vlan_find_dev(struct net_device *real_dev,
127 u16 vlan_id) 159 __be16 vlan_proto, u16 vlan_id)
128{ 160{
129 struct vlan_info *vlan_info = rcu_dereference_rtnl(real_dev->vlan_info); 161 struct vlan_info *vlan_info = rcu_dereference_rtnl(real_dev->vlan_info);
130 162
131 if (vlan_info) 163 if (vlan_info)
132 return vlan_group_get_device(&vlan_info->grp, vlan_id); 164 return vlan_group_get_device(&vlan_info->grp,
165 vlan_proto, vlan_id);
133 166
134 return NULL; 167 return NULL;
135} 168}
136 169
170#define vlan_group_for_each_dev(grp, i, dev) \
171 for ((i) = 0; i < VLAN_PROTO_NUM * VLAN_N_VID; i++) \
172 if (((dev) = __vlan_group_get_device((grp), (i) / VLAN_N_VID, \
173 (i) % VLAN_N_VID)))
174
137/* found in vlan_dev.c */ 175/* found in vlan_dev.c */
138void vlan_dev_set_ingress_priority(const struct net_device *dev, 176void vlan_dev_set_ingress_priority(const struct net_device *dev,
139 u32 skb_prio, u16 vlan_prio); 177 u32 skb_prio, u16 vlan_prio);
@@ -142,7 +180,8 @@ int vlan_dev_set_egress_priority(const struct net_device *dev,
142int vlan_dev_change_flags(const struct net_device *dev, u32 flag, u32 mask); 180int vlan_dev_change_flags(const struct net_device *dev, u32 flag, u32 mask);
143void vlan_dev_get_realdev_name(const struct net_device *dev, char *result); 181void vlan_dev_get_realdev_name(const struct net_device *dev, char *result);
144 182
145int vlan_check_real_dev(struct net_device *real_dev, u16 vlan_id); 183int vlan_check_real_dev(struct net_device *real_dev,
184 __be16 protocol, u16 vlan_id);
146void vlan_setup(struct net_device *dev); 185void vlan_setup(struct net_device *dev);
147int register_vlan_dev(struct net_device *dev); 186int register_vlan_dev(struct net_device *dev);
148void unregister_vlan_dev(struct net_device *dev, struct list_head *head); 187void unregister_vlan_dev(struct net_device *dev, struct list_head *head);
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
index f3b6f515eba6..ebfa2fceb88b 100644
--- a/net/8021q/vlan_core.c
+++ b/net/8021q/vlan_core.c
@@ -8,11 +8,12 @@
8bool vlan_do_receive(struct sk_buff **skbp) 8bool vlan_do_receive(struct sk_buff **skbp)
9{ 9{
10 struct sk_buff *skb = *skbp; 10 struct sk_buff *skb = *skbp;
11 __be16 vlan_proto = skb->vlan_proto;
11 u16 vlan_id = skb->vlan_tci & VLAN_VID_MASK; 12 u16 vlan_id = skb->vlan_tci & VLAN_VID_MASK;
12 struct net_device *vlan_dev; 13 struct net_device *vlan_dev;
13 struct vlan_pcpu_stats *rx_stats; 14 struct vlan_pcpu_stats *rx_stats;
14 15
15 vlan_dev = vlan_find_dev(skb->dev, vlan_id); 16 vlan_dev = vlan_find_dev(skb->dev, vlan_proto, vlan_id);
16 if (!vlan_dev) 17 if (!vlan_dev)
17 return false; 18 return false;
18 19
@@ -38,7 +39,8 @@ bool vlan_do_receive(struct sk_buff **skbp)
38 * original position later 39 * original position later
39 */ 40 */
40 skb_push(skb, offset); 41 skb_push(skb, offset);
41 skb = *skbp = vlan_insert_tag(skb, skb->vlan_tci); 42 skb = *skbp = vlan_insert_tag(skb, skb->vlan_proto,
43 skb->vlan_tci);
42 if (!skb) 44 if (!skb)
43 return false; 45 return false;
44 skb_pull(skb, offset + VLAN_HLEN); 46 skb_pull(skb, offset + VLAN_HLEN);
@@ -62,12 +64,13 @@ bool vlan_do_receive(struct sk_buff **skbp)
62 64
63/* Must be invoked with rcu_read_lock. */ 65/* Must be invoked with rcu_read_lock. */
64struct net_device *__vlan_find_dev_deep(struct net_device *dev, 66struct net_device *__vlan_find_dev_deep(struct net_device *dev,
65 u16 vlan_id) 67 __be16 vlan_proto, u16 vlan_id)
66{ 68{
67 struct vlan_info *vlan_info = rcu_dereference(dev->vlan_info); 69 struct vlan_info *vlan_info = rcu_dereference(dev->vlan_info);
68 70
69 if (vlan_info) { 71 if (vlan_info) {
70 return vlan_group_get_device(&vlan_info->grp, vlan_id); 72 return vlan_group_get_device(&vlan_info->grp,
73 vlan_proto, vlan_id);
71 } else { 74 } else {
72 /* 75 /*
73 * Lower devices of master uppers (bonding, team) do not have 76 * Lower devices of master uppers (bonding, team) do not have
@@ -78,7 +81,8 @@ struct net_device *__vlan_find_dev_deep(struct net_device *dev,
78 81
79 upper_dev = netdev_master_upper_dev_get_rcu(dev); 82 upper_dev = netdev_master_upper_dev_get_rcu(dev);
80 if (upper_dev) 83 if (upper_dev)
81 return __vlan_find_dev_deep(upper_dev, vlan_id); 84 return __vlan_find_dev_deep(upper_dev,
85 vlan_proto, vlan_id);
82 } 86 }
83 87
84 return NULL; 88 return NULL;
@@ -125,7 +129,7 @@ struct sk_buff *vlan_untag(struct sk_buff *skb)
125 129
126 vhdr = (struct vlan_hdr *) skb->data; 130 vhdr = (struct vlan_hdr *) skb->data;
127 vlan_tci = ntohs(vhdr->h_vlan_TCI); 131 vlan_tci = ntohs(vhdr->h_vlan_TCI);
128 __vlan_hwaccel_put_tag(skb, vlan_tci); 132 __vlan_hwaccel_put_tag(skb, skb->protocol, vlan_tci);
129 133
130 skb_pull_rcsum(skb, VLAN_HLEN); 134 skb_pull_rcsum(skb, VLAN_HLEN);
131 vlan_set_encap_proto(skb, vhdr); 135 vlan_set_encap_proto(skb, vhdr);
@@ -185,35 +189,49 @@ static struct vlan_info *vlan_info_alloc(struct net_device *dev)
185 189
186struct vlan_vid_info { 190struct vlan_vid_info {
187 struct list_head list; 191 struct list_head list;
188 unsigned short vid; 192 __be16 proto;
193 u16 vid;
189 int refcount; 194 int refcount;
190}; 195};
191 196
197static bool vlan_hw_filter_capable(const struct net_device *dev,
198 const struct vlan_vid_info *vid_info)
199{
200 if (vid_info->proto == htons(ETH_P_8021Q) &&
201 dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)
202 return true;
203 if (vid_info->proto == htons(ETH_P_8021AD) &&
204 dev->features & NETIF_F_HW_VLAN_STAG_FILTER)
205 return true;
206 return false;
207}
208
192static struct vlan_vid_info *vlan_vid_info_get(struct vlan_info *vlan_info, 209static struct vlan_vid_info *vlan_vid_info_get(struct vlan_info *vlan_info,
193 unsigned short vid) 210 __be16 proto, u16 vid)
194{ 211{
195 struct vlan_vid_info *vid_info; 212 struct vlan_vid_info *vid_info;
196 213
197 list_for_each_entry(vid_info, &vlan_info->vid_list, list) { 214 list_for_each_entry(vid_info, &vlan_info->vid_list, list) {
198 if (vid_info->vid == vid) 215 if (vid_info->proto == proto && vid_info->vid == vid)
199 return vid_info; 216 return vid_info;
200 } 217 }
201 return NULL; 218 return NULL;
202} 219}
203 220
204static struct vlan_vid_info *vlan_vid_info_alloc(unsigned short vid) 221static struct vlan_vid_info *vlan_vid_info_alloc(__be16 proto, u16 vid)
205{ 222{
206 struct vlan_vid_info *vid_info; 223 struct vlan_vid_info *vid_info;
207 224
208 vid_info = kzalloc(sizeof(struct vlan_vid_info), GFP_KERNEL); 225 vid_info = kzalloc(sizeof(struct vlan_vid_info), GFP_KERNEL);
209 if (!vid_info) 226 if (!vid_info)
210 return NULL; 227 return NULL;
228 vid_info->proto = proto;
211 vid_info->vid = vid; 229 vid_info->vid = vid;
212 230
213 return vid_info; 231 return vid_info;
214} 232}
215 233
216static int __vlan_vid_add(struct vlan_info *vlan_info, unsigned short vid, 234static int __vlan_vid_add(struct vlan_info *vlan_info, __be16 proto, u16 vid,
217 struct vlan_vid_info **pvid_info) 235 struct vlan_vid_info **pvid_info)
218{ 236{
219 struct net_device *dev = vlan_info->real_dev; 237 struct net_device *dev = vlan_info->real_dev;
@@ -221,12 +239,12 @@ static int __vlan_vid_add(struct vlan_info *vlan_info, unsigned short vid,
221 struct vlan_vid_info *vid_info; 239 struct vlan_vid_info *vid_info;
222 int err; 240 int err;
223 241
224 vid_info = vlan_vid_info_alloc(vid); 242 vid_info = vlan_vid_info_alloc(proto, vid);
225 if (!vid_info) 243 if (!vid_info)
226 return -ENOMEM; 244 return -ENOMEM;
227 245
228 if (dev->features & NETIF_F_HW_VLAN_FILTER) { 246 if (vlan_hw_filter_capable(dev, vid_info)) {
229 err = ops->ndo_vlan_rx_add_vid(dev, vid); 247 err = ops->ndo_vlan_rx_add_vid(dev, proto, vid);
230 if (err) { 248 if (err) {
231 kfree(vid_info); 249 kfree(vid_info);
232 return err; 250 return err;
@@ -238,7 +256,7 @@ static int __vlan_vid_add(struct vlan_info *vlan_info, unsigned short vid,
238 return 0; 256 return 0;
239} 257}
240 258
241int vlan_vid_add(struct net_device *dev, unsigned short vid) 259int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid)
242{ 260{
243 struct vlan_info *vlan_info; 261 struct vlan_info *vlan_info;
244 struct vlan_vid_info *vid_info; 262 struct vlan_vid_info *vid_info;
@@ -254,9 +272,9 @@ int vlan_vid_add(struct net_device *dev, unsigned short vid)
254 return -ENOMEM; 272 return -ENOMEM;
255 vlan_info_created = true; 273 vlan_info_created = true;
256 } 274 }
257 vid_info = vlan_vid_info_get(vlan_info, vid); 275 vid_info = vlan_vid_info_get(vlan_info, proto, vid);
258 if (!vid_info) { 276 if (!vid_info) {
259 err = __vlan_vid_add(vlan_info, vid, &vid_info); 277 err = __vlan_vid_add(vlan_info, proto, vid, &vid_info);
260 if (err) 278 if (err)
261 goto out_free_vlan_info; 279 goto out_free_vlan_info;
262 } 280 }
@@ -279,14 +297,15 @@ static void __vlan_vid_del(struct vlan_info *vlan_info,
279{ 297{
280 struct net_device *dev = vlan_info->real_dev; 298 struct net_device *dev = vlan_info->real_dev;
281 const struct net_device_ops *ops = dev->netdev_ops; 299 const struct net_device_ops *ops = dev->netdev_ops;
282 unsigned short vid = vid_info->vid; 300 __be16 proto = vid_info->proto;
301 u16 vid = vid_info->vid;
283 int err; 302 int err;
284 303
285 if (dev->features & NETIF_F_HW_VLAN_FILTER) { 304 if (vlan_hw_filter_capable(dev, vid_info)) {
286 err = ops->ndo_vlan_rx_kill_vid(dev, vid); 305 err = ops->ndo_vlan_rx_kill_vid(dev, proto, vid);
287 if (err) { 306 if (err) {
288 pr_warn("failed to kill vid %d for device %s\n", 307 pr_warn("failed to kill vid %04x/%d for device %s\n",
289 vid, dev->name); 308 proto, vid, dev->name);
290 } 309 }
291 } 310 }
292 list_del(&vid_info->list); 311 list_del(&vid_info->list);
@@ -294,7 +313,7 @@ static void __vlan_vid_del(struct vlan_info *vlan_info,
294 vlan_info->nr_vids--; 313 vlan_info->nr_vids--;
295} 314}
296 315
297void vlan_vid_del(struct net_device *dev, unsigned short vid) 316void vlan_vid_del(struct net_device *dev, __be16 proto, u16 vid)
298{ 317{
299 struct vlan_info *vlan_info; 318 struct vlan_info *vlan_info;
300 struct vlan_vid_info *vid_info; 319 struct vlan_vid_info *vid_info;
@@ -305,7 +324,7 @@ void vlan_vid_del(struct net_device *dev, unsigned short vid)
305 if (!vlan_info) 324 if (!vlan_info)
306 return; 325 return;
307 326
308 vid_info = vlan_vid_info_get(vlan_info, vid); 327 vid_info = vlan_vid_info_get(vlan_info, proto, vid);
309 if (!vid_info) 328 if (!vid_info)
310 return; 329 return;
311 vid_info->refcount--; 330 vid_info->refcount--;
@@ -333,7 +352,7 @@ int vlan_vids_add_by_dev(struct net_device *dev,
333 return 0; 352 return 0;
334 353
335 list_for_each_entry(vid_info, &vlan_info->vid_list, list) { 354 list_for_each_entry(vid_info, &vlan_info->vid_list, list) {
336 err = vlan_vid_add(dev, vid_info->vid); 355 err = vlan_vid_add(dev, vid_info->proto, vid_info->vid);
337 if (err) 356 if (err)
338 goto unwind; 357 goto unwind;
339 } 358 }
@@ -343,7 +362,7 @@ unwind:
343 list_for_each_entry_continue_reverse(vid_info, 362 list_for_each_entry_continue_reverse(vid_info,
344 &vlan_info->vid_list, 363 &vlan_info->vid_list,
345 list) { 364 list) {
346 vlan_vid_del(dev, vid_info->vid); 365 vlan_vid_del(dev, vid_info->proto, vid_info->vid);
347 } 366 }
348 367
349 return err; 368 return err;
@@ -363,7 +382,7 @@ void vlan_vids_del_by_dev(struct net_device *dev,
363 return; 382 return;
364 383
365 list_for_each_entry(vid_info, &vlan_info->vid_list, list) 384 list_for_each_entry(vid_info, &vlan_info->vid_list, list)
366 vlan_vid_del(dev, vid_info->vid); 385 vlan_vid_del(dev, vid_info->proto, vid_info->vid);
367} 386}
368EXPORT_SYMBOL(vlan_vids_del_by_dev); 387EXPORT_SYMBOL(vlan_vids_del_by_dev);
369 388
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 19cf81bf9f69..8af508536d36 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -99,6 +99,7 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
99 const void *daddr, const void *saddr, 99 const void *daddr, const void *saddr,
100 unsigned int len) 100 unsigned int len)
101{ 101{
102 struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
102 struct vlan_hdr *vhdr; 103 struct vlan_hdr *vhdr;
103 unsigned int vhdrlen = 0; 104 unsigned int vhdrlen = 0;
104 u16 vlan_tci = 0; 105 u16 vlan_tci = 0;
@@ -120,8 +121,8 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
120 else 121 else
121 vhdr->h_vlan_encapsulated_proto = htons(len); 122 vhdr->h_vlan_encapsulated_proto = htons(len);
122 123
123 skb->protocol = htons(ETH_P_8021Q); 124 skb->protocol = vlan->vlan_proto;
124 type = ETH_P_8021Q; 125 type = ntohs(vlan->vlan_proto);
125 vhdrlen = VLAN_HLEN; 126 vhdrlen = VLAN_HLEN;
126 } 127 }
127 128
@@ -161,12 +162,12 @@ static netdev_tx_t vlan_dev_hard_start_xmit(struct sk_buff *skb,
161 * NOTE: THIS ASSUMES DIX ETHERNET, SPECIFICALLY NOT SUPPORTING 162 * NOTE: THIS ASSUMES DIX ETHERNET, SPECIFICALLY NOT SUPPORTING
162 * OTHER THINGS LIKE FDDI/TokenRing/802.3 SNAPs... 163 * OTHER THINGS LIKE FDDI/TokenRing/802.3 SNAPs...
163 */ 164 */
164 if (veth->h_vlan_proto != htons(ETH_P_8021Q) || 165 if (veth->h_vlan_proto != vlan->vlan_proto ||
165 vlan->flags & VLAN_FLAG_REORDER_HDR) { 166 vlan->flags & VLAN_FLAG_REORDER_HDR) {
166 u16 vlan_tci; 167 u16 vlan_tci;
167 vlan_tci = vlan->vlan_id; 168 vlan_tci = vlan->vlan_id;
168 vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb); 169 vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb);
169 skb = __vlan_hwaccel_put_tag(skb, vlan_tci); 170 skb = __vlan_hwaccel_put_tag(skb, vlan->vlan_proto, vlan_tci);
170 } 171 }
171 172
172 skb->dev = vlan->real_dev; 173 skb->dev = vlan->real_dev;
@@ -583,7 +584,7 @@ static int vlan_dev_init(struct net_device *dev)
583#endif 584#endif
584 585
585 dev->needed_headroom = real_dev->needed_headroom; 586 dev->needed_headroom = real_dev->needed_headroom;
586 if (real_dev->features & NETIF_F_HW_VLAN_TX) { 587 if (real_dev->features & NETIF_F_HW_VLAN_CTAG_TX) {
587 dev->header_ops = real_dev->header_ops; 588 dev->header_ops = real_dev->header_ops;
588 dev->hard_header_len = real_dev->hard_header_len; 589 dev->hard_header_len = real_dev->hard_header_len;
589 } else { 590 } else {
diff --git a/net/8021q/vlan_gvrp.c b/net/8021q/vlan_gvrp.c
index 6f9755352760..66a80320b032 100644
--- a/net/8021q/vlan_gvrp.c
+++ b/net/8021q/vlan_gvrp.c
@@ -32,6 +32,8 @@ int vlan_gvrp_request_join(const struct net_device *dev)
32 const struct vlan_dev_priv *vlan = vlan_dev_priv(dev); 32 const struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
33 __be16 vlan_id = htons(vlan->vlan_id); 33 __be16 vlan_id = htons(vlan->vlan_id);
34 34
35 if (vlan->vlan_proto != htons(ETH_P_8021Q))
36 return 0;
35 return garp_request_join(vlan->real_dev, &vlan_gvrp_app, 37 return garp_request_join(vlan->real_dev, &vlan_gvrp_app,
36 &vlan_id, sizeof(vlan_id), GVRP_ATTR_VID); 38 &vlan_id, sizeof(vlan_id), GVRP_ATTR_VID);
37} 39}
@@ -41,6 +43,8 @@ void vlan_gvrp_request_leave(const struct net_device *dev)
41 const struct vlan_dev_priv *vlan = vlan_dev_priv(dev); 43 const struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
42 __be16 vlan_id = htons(vlan->vlan_id); 44 __be16 vlan_id = htons(vlan->vlan_id);
43 45
46 if (vlan->vlan_proto != htons(ETH_P_8021Q))
47 return;
44 garp_request_leave(vlan->real_dev, &vlan_gvrp_app, 48 garp_request_leave(vlan->real_dev, &vlan_gvrp_app,
45 &vlan_id, sizeof(vlan_id), GVRP_ATTR_VID); 49 &vlan_id, sizeof(vlan_id), GVRP_ATTR_VID);
46} 50}
diff --git a/net/8021q/vlan_mvrp.c b/net/8021q/vlan_mvrp.c
index d9ec1d5964aa..e0fe091801b0 100644
--- a/net/8021q/vlan_mvrp.c
+++ b/net/8021q/vlan_mvrp.c
@@ -38,6 +38,8 @@ int vlan_mvrp_request_join(const struct net_device *dev)
38 const struct vlan_dev_priv *vlan = vlan_dev_priv(dev); 38 const struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
39 __be16 vlan_id = htons(vlan->vlan_id); 39 __be16 vlan_id = htons(vlan->vlan_id);
40 40
41 if (vlan->vlan_proto != htons(ETH_P_8021Q))
42 return 0;
41 return mrp_request_join(vlan->real_dev, &vlan_mrp_app, 43 return mrp_request_join(vlan->real_dev, &vlan_mrp_app,
42 &vlan_id, sizeof(vlan_id), MVRP_ATTR_VID); 44 &vlan_id, sizeof(vlan_id), MVRP_ATTR_VID);
43} 45}
@@ -47,6 +49,8 @@ void vlan_mvrp_request_leave(const struct net_device *dev)
47 const struct vlan_dev_priv *vlan = vlan_dev_priv(dev); 49 const struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
48 __be16 vlan_id = htons(vlan->vlan_id); 50 __be16 vlan_id = htons(vlan->vlan_id);
49 51
52 if (vlan->vlan_proto != htons(ETH_P_8021Q))
53 return;
50 mrp_request_leave(vlan->real_dev, &vlan_mrp_app, 54 mrp_request_leave(vlan->real_dev, &vlan_mrp_app,
51 &vlan_id, sizeof(vlan_id), MVRP_ATTR_VID); 55 &vlan_id, sizeof(vlan_id), MVRP_ATTR_VID);
52} 56}
diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c
index 1789658b7cd7..309129732285 100644
--- a/net/8021q/vlan_netlink.c
+++ b/net/8021q/vlan_netlink.c
@@ -23,6 +23,7 @@ static const struct nla_policy vlan_policy[IFLA_VLAN_MAX + 1] = {
23 [IFLA_VLAN_FLAGS] = { .len = sizeof(struct ifla_vlan_flags) }, 23 [IFLA_VLAN_FLAGS] = { .len = sizeof(struct ifla_vlan_flags) },
24 [IFLA_VLAN_EGRESS_QOS] = { .type = NLA_NESTED }, 24 [IFLA_VLAN_EGRESS_QOS] = { .type = NLA_NESTED },
25 [IFLA_VLAN_INGRESS_QOS] = { .type = NLA_NESTED }, 25 [IFLA_VLAN_INGRESS_QOS] = { .type = NLA_NESTED },
26 [IFLA_VLAN_PROTOCOL] = { .type = NLA_U16 },
26}; 27};
27 28
28static const struct nla_policy vlan_map_policy[IFLA_VLAN_QOS_MAX + 1] = { 29static const struct nla_policy vlan_map_policy[IFLA_VLAN_QOS_MAX + 1] = {
@@ -53,6 +54,16 @@ static int vlan_validate(struct nlattr *tb[], struct nlattr *data[])
53 if (!data) 54 if (!data)
54 return -EINVAL; 55 return -EINVAL;
55 56
57 if (data[IFLA_VLAN_PROTOCOL]) {
58 switch (nla_get_be16(data[IFLA_VLAN_PROTOCOL])) {
59 case __constant_htons(ETH_P_8021Q):
60 case __constant_htons(ETH_P_8021AD):
61 break;
62 default:
63 return -EPROTONOSUPPORT;
64 }
65 }
66
56 if (data[IFLA_VLAN_ID]) { 67 if (data[IFLA_VLAN_ID]) {
57 id = nla_get_u16(data[IFLA_VLAN_ID]); 68 id = nla_get_u16(data[IFLA_VLAN_ID]);
58 if (id >= VLAN_VID_MASK) 69 if (id >= VLAN_VID_MASK)
@@ -107,6 +118,7 @@ static int vlan_newlink(struct net *src_net, struct net_device *dev,
107{ 118{
108 struct vlan_dev_priv *vlan = vlan_dev_priv(dev); 119 struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
109 struct net_device *real_dev; 120 struct net_device *real_dev;
121 __be16 proto;
110 int err; 122 int err;
111 123
112 if (!data[IFLA_VLAN_ID]) 124 if (!data[IFLA_VLAN_ID])
@@ -118,11 +130,17 @@ static int vlan_newlink(struct net *src_net, struct net_device *dev,
118 if (!real_dev) 130 if (!real_dev)
119 return -ENODEV; 131 return -ENODEV;
120 132
121 vlan->vlan_id = nla_get_u16(data[IFLA_VLAN_ID]); 133 if (data[IFLA_VLAN_PROTOCOL])
122 vlan->real_dev = real_dev; 134 proto = nla_get_be16(data[IFLA_VLAN_PROTOCOL]);
123 vlan->flags = VLAN_FLAG_REORDER_HDR; 135 else
136 proto = htons(ETH_P_8021Q);
137
138 vlan->vlan_proto = proto;
139 vlan->vlan_id = nla_get_u16(data[IFLA_VLAN_ID]);
140 vlan->real_dev = real_dev;
141 vlan->flags = VLAN_FLAG_REORDER_HDR;
124 142
125 err = vlan_check_real_dev(real_dev, vlan->vlan_id); 143 err = vlan_check_real_dev(real_dev, vlan->vlan_proto, vlan->vlan_id);
126 if (err < 0) 144 if (err < 0)
127 return err; 145 return err;
128 146
@@ -151,7 +169,8 @@ static size_t vlan_get_size(const struct net_device *dev)
151{ 169{
152 struct vlan_dev_priv *vlan = vlan_dev_priv(dev); 170 struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
153 171
154 return nla_total_size(2) + /* IFLA_VLAN_ID */ 172 return nla_total_size(2) + /* IFLA_VLAN_PROTOCOL */
173 nla_total_size(2) + /* IFLA_VLAN_ID */
155 sizeof(struct ifla_vlan_flags) + /* IFLA_VLAN_FLAGS */ 174 sizeof(struct ifla_vlan_flags) + /* IFLA_VLAN_FLAGS */
156 vlan_qos_map_size(vlan->nr_ingress_mappings) + 175 vlan_qos_map_size(vlan->nr_ingress_mappings) +
157 vlan_qos_map_size(vlan->nr_egress_mappings); 176 vlan_qos_map_size(vlan->nr_egress_mappings);
@@ -166,7 +185,8 @@ static int vlan_fill_info(struct sk_buff *skb, const struct net_device *dev)
166 struct nlattr *nest; 185 struct nlattr *nest;
167 unsigned int i; 186 unsigned int i;
168 187
169 if (nla_put_u16(skb, IFLA_VLAN_ID, vlan_dev_priv(dev)->vlan_id)) 188 if (nla_put_be16(skb, IFLA_VLAN_PROTOCOL, vlan->vlan_proto) ||
189 nla_put_u16(skb, IFLA_VLAN_ID, vlan->vlan_id))
170 goto nla_put_failure; 190 goto nla_put_failure;
171 if (vlan->flags) { 191 if (vlan->flags) {
172 f.flags = vlan->flags; 192 f.flags = vlan->flags;
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index 6a4f728680ae..379061c72549 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -341,7 +341,7 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, uint8_t *mac,
341 } 341 }
342 342
343 if (vid != -1) 343 if (vid != -1)
344 skb = vlan_insert_tag(skb, vid); 344 skb = vlan_insert_tag(skb, htons(ETH_P_8021Q), vid);
345 345
346 skb_reset_mac_header(skb); 346 skb_reset_mac_header(skb);
347 skb->protocol = eth_type_trans(skb, soft_iface); 347 skb->protocol = eth_type_trans(skb, soft_iface);
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 314c73ed418f..967312803e41 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -348,10 +348,10 @@ void br_dev_setup(struct net_device *dev)
348 348
349 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | 349 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
350 NETIF_F_GSO_MASK | NETIF_F_HW_CSUM | NETIF_F_LLTX | 350 NETIF_F_GSO_MASK | NETIF_F_HW_CSUM | NETIF_F_LLTX |
351 NETIF_F_NETNS_LOCAL | NETIF_F_HW_VLAN_TX; 351 NETIF_F_NETNS_LOCAL | NETIF_F_HW_VLAN_CTAG_TX;
352 dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | 352 dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
353 NETIF_F_GSO_MASK | NETIF_F_HW_CSUM | 353 NETIF_F_GSO_MASK | NETIF_F_HW_CSUM |
354 NETIF_F_HW_VLAN_TX; 354 NETIF_F_HW_VLAN_CTAG_TX;
355 355
356 br->dev = dev; 356 br->dev = dev;
357 spin_lock_init(&br->lock); 357 spin_lock_init(&br->lock);
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index fe43bc7b063f..1ed75bfd8d1d 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -535,7 +535,8 @@ static struct net_device *brnf_get_logical_dev(struct sk_buff *skb, const struct
535 if (brnf_pass_vlan_indev == 0 || !vlan_tx_tag_present(skb)) 535 if (brnf_pass_vlan_indev == 0 || !vlan_tx_tag_present(skb))
536 return br; 536 return br;
537 537
538 vlan = __vlan_find_dev_deep(br, vlan_tx_tag_get(skb) & VLAN_VID_MASK); 538 vlan = __vlan_find_dev_deep(br, skb->vlan_proto,
539 vlan_tx_tag_get(skb) & VLAN_VID_MASK);
539 540
540 return vlan ? vlan : br; 541 return vlan ? vlan : br;
541} 542}
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index 93dde75923f0..bd58b45f5f90 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -34,6 +34,7 @@ static void __vlan_add_flags(struct net_port_vlans *v, u16 vid, u16 flags)
34 34
35static int __vlan_add(struct net_port_vlans *v, u16 vid, u16 flags) 35static int __vlan_add(struct net_port_vlans *v, u16 vid, u16 flags)
36{ 36{
37 const struct net_device_ops *ops;
37 struct net_bridge_port *p = NULL; 38 struct net_bridge_port *p = NULL;
38 struct net_bridge *br; 39 struct net_bridge *br;
39 struct net_device *dev; 40 struct net_device *dev;
@@ -53,15 +54,17 @@ static int __vlan_add(struct net_port_vlans *v, u16 vid, u16 flags)
53 br = v->parent.br; 54 br = v->parent.br;
54 dev = br->dev; 55 dev = br->dev;
55 } 56 }
57 ops = dev->netdev_ops;
56 58
57 if (p && (dev->features & NETIF_F_HW_VLAN_FILTER)) { 59 if (p && (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) {
58 /* Add VLAN to the device filter if it is supported. 60 /* Add VLAN to the device filter if it is supported.
59 * Stricly speaking, this is not necessary now, since 61 * Stricly speaking, this is not necessary now, since
60 * devices are made promiscuous by the bridge, but if 62 * devices are made promiscuous by the bridge, but if
61 * that ever changes this code will allow tagged 63 * that ever changes this code will allow tagged
62 * traffic to enter the bridge. 64 * traffic to enter the bridge.
63 */ 65 */
64 err = dev->netdev_ops->ndo_vlan_rx_add_vid(dev, vid); 66 err = ops->ndo_vlan_rx_add_vid(dev, htons(ETH_P_8021Q),
67 vid);
65 if (err) 68 if (err)
66 return err; 69 return err;
67 } 70 }
@@ -82,8 +85,8 @@ static int __vlan_add(struct net_port_vlans *v, u16 vid, u16 flags)
82 return 0; 85 return 0;
83 86
84out_filt: 87out_filt:
85 if (p && (dev->features & NETIF_F_HW_VLAN_FILTER)) 88 if (p && (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER))
86 dev->netdev_ops->ndo_vlan_rx_kill_vid(dev, vid); 89 ops->ndo_vlan_rx_kill_vid(dev, htons(ETH_P_8021Q), vid);
87 return err; 90 return err;
88} 91}
89 92
@@ -97,9 +100,10 @@ static int __vlan_del(struct net_port_vlans *v, u16 vid)
97 100
98 if (v->port_idx && vid) { 101 if (v->port_idx && vid) {
99 struct net_device *dev = v->parent.port->dev; 102 struct net_device *dev = v->parent.port->dev;
103 const struct net_device_ops *ops = dev->netdev_ops;
100 104
101 if (dev->features & NETIF_F_HW_VLAN_FILTER) 105 if (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)
102 dev->netdev_ops->ndo_vlan_rx_kill_vid(dev, vid); 106 ops->ndo_vlan_rx_kill_vid(dev, htons(ETH_P_8021Q), vid);
103 } 107 }
104 108
105 clear_bit(vid, v->vlan_bitmap); 109 clear_bit(vid, v->vlan_bitmap);
@@ -171,7 +175,7 @@ struct sk_buff *br_handle_vlan(struct net_bridge *br,
171 * mac header. 175 * mac header.
172 */ 176 */
173 skb_push(skb, ETH_HLEN); 177 skb_push(skb, ETH_HLEN);
174 skb = __vlan_put_tag(skb, skb->vlan_tci); 178 skb = __vlan_put_tag(skb, skb->vlan_proto, skb->vlan_tci);
175 if (!skb) 179 if (!skb)
176 goto out; 180 goto out;
177 /* put skb->data back to where it was */ 181 /* put skb->data back to where it was */
@@ -213,7 +217,7 @@ bool br_allowed_ingress(struct net_bridge *br, struct net_port_vlans *v,
213 /* PVID is set on this port. Any untagged ingress 217 /* PVID is set on this port. Any untagged ingress
214 * frame is considered to belong to this vlan. 218 * frame is considered to belong to this vlan.
215 */ 219 */
216 __vlan_hwaccel_put_tag(skb, pvid); 220 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), pvid);
217 return true; 221 return true;
218 } 222 }
219 223
diff --git a/net/core/dev.c b/net/core/dev.c
index 3655ff927315..fad4c385f7a1 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2212,7 +2212,7 @@ __be16 skb_network_protocol(struct sk_buff *skb)
2212 __be16 type = skb->protocol; 2212 __be16 type = skb->protocol;
2213 int vlan_depth = ETH_HLEN; 2213 int vlan_depth = ETH_HLEN;
2214 2214
2215 while (type == htons(ETH_P_8021Q)) { 2215 while (type == htons(ETH_P_8021Q) || type == htons(ETH_P_8021AD)) {
2216 struct vlan_hdr *vh; 2216 struct vlan_hdr *vh;
2217 2217
2218 if (unlikely(!pskb_may_pull(skb, vlan_depth + VLAN_HLEN))) 2218 if (unlikely(!pskb_may_pull(skb, vlan_depth + VLAN_HLEN)))
@@ -2428,20 +2428,22 @@ netdev_features_t netif_skb_features(struct sk_buff *skb)
2428 if (skb_shinfo(skb)->gso_segs > skb->dev->gso_max_segs) 2428 if (skb_shinfo(skb)->gso_segs > skb->dev->gso_max_segs)
2429 features &= ~NETIF_F_GSO_MASK; 2429 features &= ~NETIF_F_GSO_MASK;
2430 2430
2431 if (protocol == htons(ETH_P_8021Q)) { 2431 if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD)) {
2432 struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; 2432 struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
2433 protocol = veh->h_vlan_encapsulated_proto; 2433 protocol = veh->h_vlan_encapsulated_proto;
2434 } else if (!vlan_tx_tag_present(skb)) { 2434 } else if (!vlan_tx_tag_present(skb)) {
2435 return harmonize_features(skb, protocol, features); 2435 return harmonize_features(skb, protocol, features);
2436 } 2436 }
2437 2437
2438 features &= (skb->dev->vlan_features | NETIF_F_HW_VLAN_TX); 2438 features &= (skb->dev->vlan_features | NETIF_F_HW_VLAN_CTAG_TX |
2439 NETIF_F_HW_VLAN_STAG_TX);
2439 2440
2440 if (protocol != htons(ETH_P_8021Q)) { 2441 if (protocol != htons(ETH_P_8021Q) && protocol != htons(ETH_P_8021AD)) {
2441 return harmonize_features(skb, protocol, features); 2442 return harmonize_features(skb, protocol, features);
2442 } else { 2443 } else {
2443 features &= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | 2444 features &= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST |
2444 NETIF_F_GEN_CSUM | NETIF_F_HW_VLAN_TX; 2445 NETIF_F_GEN_CSUM | NETIF_F_HW_VLAN_CTAG_TX |
2446 NETIF_F_HW_VLAN_STAG_TX;
2445 return harmonize_features(skb, protocol, features); 2447 return harmonize_features(skb, protocol, features);
2446 } 2448 }
2447} 2449}
@@ -2482,8 +2484,9 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2482 features = netif_skb_features(skb); 2484 features = netif_skb_features(skb);
2483 2485
2484 if (vlan_tx_tag_present(skb) && 2486 if (vlan_tx_tag_present(skb) &&
2485 !(features & NETIF_F_HW_VLAN_TX)) { 2487 !vlan_hw_offload_capable(features, skb->vlan_proto)) {
2486 skb = __vlan_put_tag(skb, vlan_tx_tag_get(skb)); 2488 skb = __vlan_put_tag(skb, skb->vlan_proto,
2489 vlan_tx_tag_get(skb));
2487 if (unlikely(!skb)) 2490 if (unlikely(!skb))
2488 goto out; 2491 goto out;
2489 2492
@@ -3359,6 +3362,7 @@ static bool skb_pfmemalloc_protocol(struct sk_buff *skb)
3359 case __constant_htons(ETH_P_IP): 3362 case __constant_htons(ETH_P_IP):
3360 case __constant_htons(ETH_P_IPV6): 3363 case __constant_htons(ETH_P_IPV6):
3361 case __constant_htons(ETH_P_8021Q): 3364 case __constant_htons(ETH_P_8021Q):
3365 case __constant_htons(ETH_P_8021AD):
3362 return true; 3366 return true;
3363 default: 3367 default:
3364 return false; 3368 return false;
@@ -3399,7 +3403,8 @@ another_round:
3399 3403
3400 __this_cpu_inc(softnet_data.processed); 3404 __this_cpu_inc(softnet_data.processed);
3401 3405
3402 if (skb->protocol == cpu_to_be16(ETH_P_8021Q)) { 3406 if (skb->protocol == cpu_to_be16(ETH_P_8021Q) ||
3407 skb->protocol == cpu_to_be16(ETH_P_8021AD)) {
3403 skb = vlan_untag(skb); 3408 skb = vlan_untag(skb);
3404 if (unlikely(!skb)) 3409 if (unlikely(!skb))
3405 goto unlock; 3410 goto unlock;
@@ -5180,7 +5185,8 @@ int register_netdevice(struct net_device *dev)
5180 } 5185 }
5181 } 5186 }
5182 5187
5183 if (((dev->hw_features | dev->features) & NETIF_F_HW_VLAN_FILTER) && 5188 if (((dev->hw_features | dev->features) &
5189 NETIF_F_HW_VLAN_CTAG_FILTER) &&
5184 (!dev->netdev_ops->ndo_vlan_rx_add_vid || 5190 (!dev->netdev_ops->ndo_vlan_rx_add_vid ||
5185 !dev->netdev_ops->ndo_vlan_rx_kill_vid)) { 5191 !dev->netdev_ops->ndo_vlan_rx_kill_vid)) {
5186 netdev_WARN(dev, "Buggy VLAN acceleration in driver!\n"); 5192 netdev_WARN(dev, "Buggy VLAN acceleration in driver!\n");
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index adc1351e6873..b87712cfd26c 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -60,10 +60,10 @@ static const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN]
60 [NETIF_F_IPV6_CSUM_BIT] = "tx-checksum-ipv6", 60 [NETIF_F_IPV6_CSUM_BIT] = "tx-checksum-ipv6",
61 [NETIF_F_HIGHDMA_BIT] = "highdma", 61 [NETIF_F_HIGHDMA_BIT] = "highdma",
62 [NETIF_F_FRAGLIST_BIT] = "tx-scatter-gather-fraglist", 62 [NETIF_F_FRAGLIST_BIT] = "tx-scatter-gather-fraglist",
63 [NETIF_F_HW_VLAN_TX_BIT] = "tx-vlan-hw-insert", 63 [NETIF_F_HW_VLAN_CTAG_TX_BIT] = "tx-vlan-ctag-hw-insert",
64 64
65 [NETIF_F_HW_VLAN_RX_BIT] = "rx-vlan-hw-parse", 65 [NETIF_F_HW_VLAN_CTAG_RX_BIT] = "rx-vlan-ctag-hw-parse",
66 [NETIF_F_HW_VLAN_FILTER_BIT] = "rx-vlan-filter", 66 [NETIF_F_HW_VLAN_CTAG_FILTER_BIT] = "rx-vlan-ctag-filter",
67 [NETIF_F_VLAN_CHALLENGED_BIT] = "vlan-challenged", 67 [NETIF_F_VLAN_CHALLENGED_BIT] = "vlan-challenged",
68 [NETIF_F_GSO_BIT] = "tx-generic-segmentation", 68 [NETIF_F_GSO_BIT] = "tx-generic-segmentation",
69 [NETIF_F_LLTX_BIT] = "tx-lockless", 69 [NETIF_F_LLTX_BIT] = "tx-lockless",
@@ -267,18 +267,19 @@ static int ethtool_set_one_feature(struct net_device *dev,
267 267
268#define ETH_ALL_FLAGS (ETH_FLAG_LRO | ETH_FLAG_RXVLAN | ETH_FLAG_TXVLAN | \ 268#define ETH_ALL_FLAGS (ETH_FLAG_LRO | ETH_FLAG_RXVLAN | ETH_FLAG_TXVLAN | \
269 ETH_FLAG_NTUPLE | ETH_FLAG_RXHASH) 269 ETH_FLAG_NTUPLE | ETH_FLAG_RXHASH)
270#define ETH_ALL_FEATURES (NETIF_F_LRO | NETIF_F_HW_VLAN_RX | \ 270#define ETH_ALL_FEATURES (NETIF_F_LRO | NETIF_F_HW_VLAN_CTAG_RX | \
271 NETIF_F_HW_VLAN_TX | NETIF_F_NTUPLE | NETIF_F_RXHASH) 271 NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_NTUPLE | \
272 NETIF_F_RXHASH)
272 273
273static u32 __ethtool_get_flags(struct net_device *dev) 274static u32 __ethtool_get_flags(struct net_device *dev)
274{ 275{
275 u32 flags = 0; 276 u32 flags = 0;
276 277
277 if (dev->features & NETIF_F_LRO) flags |= ETH_FLAG_LRO; 278 if (dev->features & NETIF_F_LRO) flags |= ETH_FLAG_LRO;
278 if (dev->features & NETIF_F_HW_VLAN_RX) flags |= ETH_FLAG_RXVLAN; 279 if (dev->features & NETIF_F_HW_VLAN_CTAG_RX) flags |= ETH_FLAG_RXVLAN;
279 if (dev->features & NETIF_F_HW_VLAN_TX) flags |= ETH_FLAG_TXVLAN; 280 if (dev->features & NETIF_F_HW_VLAN_CTAG_TX) flags |= ETH_FLAG_TXVLAN;
280 if (dev->features & NETIF_F_NTUPLE) flags |= ETH_FLAG_NTUPLE; 281 if (dev->features & NETIF_F_NTUPLE) flags |= ETH_FLAG_NTUPLE;
281 if (dev->features & NETIF_F_RXHASH) flags |= ETH_FLAG_RXHASH; 282 if (dev->features & NETIF_F_RXHASH) flags |= ETH_FLAG_RXHASH;
282 283
283 return flags; 284 return flags;
284} 285}
@@ -291,8 +292,8 @@ static int __ethtool_set_flags(struct net_device *dev, u32 data)
291 return -EINVAL; 292 return -EINVAL;
292 293
293 if (data & ETH_FLAG_LRO) features |= NETIF_F_LRO; 294 if (data & ETH_FLAG_LRO) features |= NETIF_F_LRO;
294 if (data & ETH_FLAG_RXVLAN) features |= NETIF_F_HW_VLAN_RX; 295 if (data & ETH_FLAG_RXVLAN) features |= NETIF_F_HW_VLAN_CTAG_RX;
295 if (data & ETH_FLAG_TXVLAN) features |= NETIF_F_HW_VLAN_TX; 296 if (data & ETH_FLAG_TXVLAN) features |= NETIF_F_HW_VLAN_CTAG_TX;
296 if (data & ETH_FLAG_NTUPLE) features |= NETIF_F_NTUPLE; 297 if (data & ETH_FLAG_NTUPLE) features |= NETIF_F_NTUPLE;
297 if (data & ETH_FLAG_RXHASH) features |= NETIF_F_RXHASH; 298 if (data & ETH_FLAG_RXHASH) features |= NETIF_F_RXHASH;
298 299
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index a3a17aed3639..209d84253dd5 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -383,8 +383,9 @@ void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb,
383 if (__netif_tx_trylock(txq)) { 383 if (__netif_tx_trylock(txq)) {
384 if (!netif_xmit_stopped(txq)) { 384 if (!netif_xmit_stopped(txq)) {
385 if (vlan_tx_tag_present(skb) && 385 if (vlan_tx_tag_present(skb) &&
386 !(netif_skb_features(skb) & NETIF_F_HW_VLAN_TX)) { 386 !vlan_hw_offload_capable(netif_skb_features(skb),
387 skb = __vlan_put_tag(skb, vlan_tx_tag_get(skb)); 387 skb->vlan_proto)) {
388 skb = __vlan_put_tag(skb, skb->vlan_proto, vlan_tx_tag_get(skb));
388 if (unlikely(!skb)) 389 if (unlikely(!skb))
389 break; 390 break;
390 skb->vlan_tci = 0; 391 skb->vlan_tci = 0;
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index ba646145cd5c..a92d9e7d10f7 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -707,6 +707,7 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
707 new->tc_verd = old->tc_verd; 707 new->tc_verd = old->tc_verd;
708#endif 708#endif
709#endif 709#endif
710 new->vlan_proto = old->vlan_proto;
710 new->vlan_tci = old->vlan_tci; 711 new->vlan_tci = old->vlan_tci;
711 712
712 skb_copy_secmark(new, old); 713 skb_copy_secmark(new, old);
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index d4d5363c7ba7..894b6cbdd929 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -98,7 +98,7 @@ static int pop_vlan(struct sk_buff *skb)
98 if (unlikely(err)) 98 if (unlikely(err))
99 return err; 99 return err;
100 100
101 __vlan_hwaccel_put_tag(skb, ntohs(tci)); 101 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(tci));
102 return 0; 102 return 0;
103} 103}
104 104
@@ -110,7 +110,7 @@ static int push_vlan(struct sk_buff *skb, const struct ovs_action_push_vlan *vla
110 /* push down current VLAN tag */ 110 /* push down current VLAN tag */
111 current_tag = vlan_tx_tag_get(skb); 111 current_tag = vlan_tx_tag_get(skb);
112 112
113 if (!__vlan_put_tag(skb, current_tag)) 113 if (!__vlan_put_tag(skb, skb->vlan_proto, current_tag))
114 return -ENOMEM; 114 return -ENOMEM;
115 115
116 if (skb->ip_summed == CHECKSUM_COMPLETE) 116 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
118 + (2 * ETH_ALEN), VLAN_HLEN, 0)); 118 + (2 * ETH_ALEN), VLAN_HLEN, 0));
119 119
120 } 120 }
121 __vlan_hwaccel_put_tag(skb, ntohs(vlan->vlan_tci) & ~VLAN_TAG_PRESENT); 121 __vlan_hwaccel_put_tag(skb, vlan->vlan_tpid, ntohs(vlan->vlan_tci) & ~VLAN_TAG_PRESENT);
122 return 0; 122 return 0;
123} 123}
124 124
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index b7d0b7c3fe2c..7bb5d4f6bb90 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -401,7 +401,7 @@ static int queue_userspace_packet(struct net *net, int dp_ifindex,
401 if (!nskb) 401 if (!nskb)
402 return -ENOMEM; 402 return -ENOMEM;
403 403
404 nskb = __vlan_put_tag(nskb, vlan_tx_tag_get(nskb)); 404 nskb = __vlan_put_tag(nskb, nskb->vlan_proto, vlan_tx_tag_get(nskb));
405 if (!nskb) 405 if (!nskb)
406 return -ENOMEM; 406 return -ENOMEM;
407 407
diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c
index 9604760494b1..73682de8dc69 100644
--- a/net/openvswitch/vport-internal_dev.c
+++ b/net/openvswitch/vport-internal_dev.c
@@ -137,7 +137,7 @@ static void do_setup(struct net_device *netdev)
137 NETIF_F_HIGHDMA | NETIF_F_HW_CSUM | NETIF_F_TSO; 137 NETIF_F_HIGHDMA | NETIF_F_HW_CSUM | NETIF_F_TSO;
138 138
139 netdev->vlan_features = netdev->features; 139 netdev->vlan_features = netdev->features;
140 netdev->features |= NETIF_F_HW_VLAN_TX; 140 netdev->features |= NETIF_F_HW_VLAN_CTAG_TX;
141 netdev->hw_features = netdev->features & ~NETIF_F_LLTX; 141 netdev->hw_features = netdev->features & ~NETIF_F_LLTX;
142 eth_hw_addr_random(netdev); 142 eth_hw_addr_random(netdev);
143} 143}