diff options
| author | Anirban Chakraborty <anirban.chakraborty@qlogic.com> | 2011-04-01 10:28:15 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2011-04-06 15:47:12 -0400 |
| commit | b9796a14d9705c4be4a080a4fe39379a51681374 (patch) | |
| tree | c844b2198fc0e76707eac3bf802a9f930ade9078 /drivers/net/qlcnic | |
| parent | 036d61f05189c9c02de22dd19a1c64a4fd74a914 (diff) | |
qlcnic: Changes to VLAN code
Made changes to VLAN code comply with new VLAN infrastructure in kernel
Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlcnic')
| -rw-r--r-- | drivers/net/qlcnic/qlcnic.h | 4 | ||||
| -rw-r--r-- | drivers/net/qlcnic/qlcnic_init.c | 15 | ||||
| -rw-r--r-- | drivers/net/qlcnic/qlcnic_main.c | 42 |
3 files changed, 35 insertions, 26 deletions
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h index a5b28d1475b1..be9c32944de5 100644 --- a/drivers/net/qlcnic/qlcnic.h +++ b/drivers/net/qlcnic/qlcnic.h | |||
| @@ -29,6 +29,8 @@ | |||
| 29 | 29 | ||
| 30 | #include <linux/io.h> | 30 | #include <linux/io.h> |
| 31 | #include <asm/byteorder.h> | 31 | #include <asm/byteorder.h> |
| 32 | #include <linux/bitops.h> | ||
| 33 | #include <linux/if_vlan.h> | ||
| 32 | 34 | ||
| 33 | #include "qlcnic_hdr.h" | 35 | #include "qlcnic_hdr.h" |
| 34 | 36 | ||
| @@ -982,8 +984,8 @@ struct qlcnic_adapter { | |||
| 982 | u8 mac_addr[ETH_ALEN]; | 984 | u8 mac_addr[ETH_ALEN]; |
| 983 | 985 | ||
| 984 | u64 dev_rst_time; | 986 | u64 dev_rst_time; |
| 987 | unsigned long vlans[BITS_TO_LONGS(VLAN_N_VID)]; | ||
| 985 | 988 | ||
| 986 | struct vlan_group *vlgrp; | ||
| 987 | struct qlcnic_npar_info *npars; | 989 | struct qlcnic_npar_info *npars; |
| 988 | struct qlcnic_eswitch *eswitch; | 990 | struct qlcnic_eswitch *eswitch; |
| 989 | struct qlcnic_nic_template *nic_ops; | 991 | struct qlcnic_nic_template *nic_ops; |
diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c index 476ea14c0ff3..74ec96da1762 100644 --- a/drivers/net/qlcnic/qlcnic_init.c +++ b/drivers/net/qlcnic/qlcnic_init.c | |||
| @@ -1467,10 +1467,10 @@ qlcnic_process_rcv(struct qlcnic_adapter *adapter, | |||
| 1467 | 1467 | ||
| 1468 | skb->protocol = eth_type_trans(skb, netdev); | 1468 | skb->protocol = eth_type_trans(skb, netdev); |
| 1469 | 1469 | ||
| 1470 | if ((vid != 0xffff) && adapter->vlgrp) | 1470 | if (vid != 0xffff) |
| 1471 | vlan_gro_receive(&sds_ring->napi, adapter->vlgrp, vid, skb); | 1471 | __vlan_hwaccel_put_tag(skb, vid); |
| 1472 | else | 1472 | |
| 1473 | napi_gro_receive(&sds_ring->napi, skb); | 1473 | napi_gro_receive(&sds_ring->napi, skb); |
| 1474 | 1474 | ||
| 1475 | adapter->stats.rx_pkts++; | 1475 | adapter->stats.rx_pkts++; |
| 1476 | adapter->stats.rxbytes += length; | 1476 | adapter->stats.rxbytes += length; |
| @@ -1552,10 +1552,9 @@ qlcnic_process_lro(struct qlcnic_adapter *adapter, | |||
| 1552 | 1552 | ||
| 1553 | length = skb->len; | 1553 | length = skb->len; |
| 1554 | 1554 | ||
| 1555 | if ((vid != 0xffff) && adapter->vlgrp) | 1555 | if (vid != 0xffff) |
| 1556 | vlan_hwaccel_receive_skb(skb, adapter->vlgrp, vid); | 1556 | __vlan_hwaccel_put_tag(skb, vid); |
| 1557 | else | 1557 | netif_receive_skb(skb); |
| 1558 | netif_receive_skb(skb); | ||
| 1559 | 1558 | ||
| 1560 | adapter->stats.lro_pkts++; | 1559 | adapter->stats.lro_pkts++; |
| 1561 | adapter->stats.lrobytes += length; | 1560 | adapter->stats.lrobytes += length; |
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c index 3b740f55ca42..b75aef059adc 100644 --- a/drivers/net/qlcnic/qlcnic_main.c +++ b/drivers/net/qlcnic/qlcnic_main.c | |||
| @@ -13,7 +13,6 @@ | |||
| 13 | 13 | ||
| 14 | #include <linux/swab.h> | 14 | #include <linux/swab.h> |
| 15 | #include <linux/dma-mapping.h> | 15 | #include <linux/dma-mapping.h> |
| 16 | #include <linux/if_vlan.h> | ||
| 17 | #include <net/ip.h> | 16 | #include <net/ip.h> |
| 18 | #include <linux/ipv6.h> | 17 | #include <linux/ipv6.h> |
| 19 | #include <linux/inetdevice.h> | 18 | #include <linux/inetdevice.h> |
| @@ -98,6 +97,9 @@ static int qlcnicvf_config_bridged_mode(struct qlcnic_adapter *, u32); | |||
| 98 | static int qlcnicvf_start_firmware(struct qlcnic_adapter *); | 97 | static int qlcnicvf_start_firmware(struct qlcnic_adapter *); |
| 99 | static void qlcnic_set_netdev_features(struct qlcnic_adapter *, | 98 | static void qlcnic_set_netdev_features(struct qlcnic_adapter *, |
| 100 | struct qlcnic_esw_func_cfg *); | 99 | struct qlcnic_esw_func_cfg *); |
| 100 | static void qlcnic_vlan_rx_add(struct net_device *, u16); | ||
| 101 | static void qlcnic_vlan_rx_del(struct net_device *, u16); | ||
| 102 | |||
| 101 | /* PCI Device ID Table */ | 103 | /* PCI Device ID Table */ |
| 102 | #define ENTRY(device) \ | 104 | #define ENTRY(device) \ |
| 103 | {PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, (device)), \ | 105 | {PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, (device)), \ |
| @@ -317,13 +319,6 @@ static int qlcnic_set_mac(struct net_device *netdev, void *p) | |||
| 317 | return 0; | 319 | return 0; |
| 318 | } | 320 | } |
| 319 | 321 | ||
| 320 | static void qlcnic_vlan_rx_register(struct net_device *netdev, | ||
| 321 | struct vlan_group *grp) | ||
| 322 | { | ||
| 323 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | ||
| 324 | adapter->vlgrp = grp; | ||
| 325 | } | ||
| 326 | |||
| 327 | static const struct net_device_ops qlcnic_netdev_ops = { | 322 | static const struct net_device_ops qlcnic_netdev_ops = { |
| 328 | .ndo_open = qlcnic_open, | 323 | .ndo_open = qlcnic_open, |
| 329 | .ndo_stop = qlcnic_close, | 324 | .ndo_stop = qlcnic_close, |
| @@ -334,7 +329,8 @@ static const struct net_device_ops qlcnic_netdev_ops = { | |||
| 334 | .ndo_set_mac_address = qlcnic_set_mac, | 329 | .ndo_set_mac_address = qlcnic_set_mac, |
| 335 | .ndo_change_mtu = qlcnic_change_mtu, | 330 | .ndo_change_mtu = qlcnic_change_mtu, |
| 336 | .ndo_tx_timeout = qlcnic_tx_timeout, | 331 | .ndo_tx_timeout = qlcnic_tx_timeout, |
| 337 | .ndo_vlan_rx_register = qlcnic_vlan_rx_register, | 332 | .ndo_vlan_rx_add_vid = qlcnic_vlan_rx_add, |
| 333 | .ndo_vlan_rx_kill_vid = qlcnic_vlan_rx_del, | ||
| 338 | #ifdef CONFIG_NET_POLL_CONTROLLER | 334 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 339 | .ndo_poll_controller = qlcnic_poll_controller, | 335 | .ndo_poll_controller = qlcnic_poll_controller, |
| 340 | #endif | 336 | #endif |
| @@ -710,6 +706,22 @@ qlcnic_set_vlan_config(struct qlcnic_adapter *adapter, | |||
| 710 | } | 706 | } |
| 711 | 707 | ||
| 712 | static void | 708 | static void |
| 709 | qlcnic_vlan_rx_add(struct net_device *netdev, u16 vid) | ||
| 710 | { | ||
| 711 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | ||
| 712 | set_bit(vid, adapter->vlans); | ||
| 713 | } | ||
| 714 | |||
| 715 | static void | ||
| 716 | qlcnic_vlan_rx_del(struct net_device *netdev, u16 vid) | ||
| 717 | { | ||
| 718 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | ||
| 719 | |||
| 720 | qlcnic_restore_indev_addr(netdev, NETDEV_DOWN); | ||
| 721 | clear_bit(vid, adapter->vlans); | ||
| 722 | } | ||
| 723 | |||
| 724 | static void | ||
| 713 | qlcnic_set_eswitch_port_features(struct qlcnic_adapter *adapter, | 725 | qlcnic_set_eswitch_port_features(struct qlcnic_adapter *adapter, |
| 714 | struct qlcnic_esw_func_cfg *esw_cfg) | 726 | struct qlcnic_esw_func_cfg *esw_cfg) |
| 715 | { | 727 | { |
| @@ -755,7 +767,7 @@ qlcnic_set_netdev_features(struct qlcnic_adapter *adapter, | |||
| 755 | features = (NETIF_F_SG | NETIF_F_IP_CSUM | | 767 | features = (NETIF_F_SG | NETIF_F_IP_CSUM | |
| 756 | NETIF_F_IPV6_CSUM | NETIF_F_GRO); | 768 | NETIF_F_IPV6_CSUM | NETIF_F_GRO); |
| 757 | vlan_features = (NETIF_F_SG | NETIF_F_IP_CSUM | | 769 | vlan_features = (NETIF_F_SG | NETIF_F_IP_CSUM | |
| 758 | NETIF_F_IPV6_CSUM); | 770 | NETIF_F_IPV6_CSUM | NETIF_F_HW_VLAN_FILTER); |
| 759 | 771 | ||
| 760 | if (adapter->capabilities & QLCNIC_FW_CAPABILITY_TSO) { | 772 | if (adapter->capabilities & QLCNIC_FW_CAPABILITY_TSO) { |
| 761 | features |= (NETIF_F_TSO | NETIF_F_TSO6); | 773 | features |= (NETIF_F_TSO | NETIF_F_TSO6); |
| @@ -1448,7 +1460,7 @@ qlcnic_setup_netdev(struct qlcnic_adapter *adapter, | |||
| 1448 | netdev->features |= (NETIF_F_SG | NETIF_F_IP_CSUM | | 1460 | netdev->features |= (NETIF_F_SG | NETIF_F_IP_CSUM | |
| 1449 | NETIF_F_IPV6_CSUM | NETIF_F_GRO | NETIF_F_HW_VLAN_RX); | 1461 | NETIF_F_IPV6_CSUM | NETIF_F_GRO | NETIF_F_HW_VLAN_RX); |
| 1450 | netdev->vlan_features |= (NETIF_F_SG | NETIF_F_IP_CSUM | | 1462 | netdev->vlan_features |= (NETIF_F_SG | NETIF_F_IP_CSUM | |
| 1451 | NETIF_F_IPV6_CSUM); | 1463 | NETIF_F_IPV6_CSUM | NETIF_F_HW_VLAN_FILTER); |
| 1452 | 1464 | ||
| 1453 | if (adapter->capabilities & QLCNIC_FW_CAPABILITY_TSO) { | 1465 | if (adapter->capabilities & QLCNIC_FW_CAPABILITY_TSO) { |
| 1454 | netdev->features |= (NETIF_F_TSO | NETIF_F_TSO6); | 1466 | netdev->features |= (NETIF_F_TSO | NETIF_F_TSO6); |
| @@ -4068,14 +4080,10 @@ qlcnic_restore_indev_addr(struct net_device *netdev, unsigned long event) | |||
| 4068 | 4080 | ||
| 4069 | qlcnic_config_indev_addr(adapter, netdev, event); | 4081 | qlcnic_config_indev_addr(adapter, netdev, event); |
| 4070 | 4082 | ||
| 4071 | if (!adapter->vlgrp) | 4083 | for_each_set_bit(vid, adapter->vlans, VLAN_N_VID) { |
| 4072 | return; | 4084 | dev = vlan_find_dev(netdev, vid); |
| 4073 | |||
| 4074 | for (vid = 0; vid < VLAN_N_VID; vid++) { | ||
| 4075 | dev = vlan_group_get_device(adapter->vlgrp, vid); | ||
| 4076 | if (!dev) | 4085 | if (!dev) |
| 4077 | continue; | 4086 | continue; |
| 4078 | |||
| 4079 | qlcnic_config_indev_addr(adapter, dev, event); | 4087 | qlcnic_config_indev_addr(adapter, dev, event); |
| 4080 | } | 4088 | } |
| 4081 | } | 4089 | } |
