diff options
author | Jiri Pirko <jpirko@redhat.com> | 2011-07-20 00:54:41 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-21 16:47:57 -0400 |
commit | 7ff0bcf676f7ed224ce21b58c7858c8e527068b2 (patch) | |
tree | 383bee2e1d34221cd1e856560bb44db8bfae08b2 /drivers/s390 | |
parent | 53515734888e018af7bcec6b4464bd9e28f1d655 (diff) |
qeth: do vlan cleanup
- unify vlan and nonvlan rx path
- kill card->vlangrp and qeth_l3_vlan_rx_register
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/net/qeth_core.h | 2 | ||||
-rw-r--r-- | drivers/s390/net/qeth_core_main.c | 1 | ||||
-rw-r--r-- | drivers/s390/net/qeth_l3_main.c | 100 |
3 files changed, 47 insertions, 56 deletions
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h index d3cee33e554c..26a4110eeb2d 100644 --- a/drivers/s390/net/qeth_core.h +++ b/drivers/s390/net/qeth_core.h | |||
@@ -720,7 +720,7 @@ struct qeth_card { | |||
720 | wait_queue_head_t wait_q; | 720 | wait_queue_head_t wait_q; |
721 | spinlock_t vlanlock; | 721 | spinlock_t vlanlock; |
722 | spinlock_t mclock; | 722 | spinlock_t mclock; |
723 | struct vlan_group *vlangrp; | 723 | unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; |
724 | struct list_head vid_list; | 724 | struct list_head vid_list; |
725 | struct list_head mc_list; | 725 | struct list_head mc_list; |
726 | struct work_struct kernel_thread_starter; | 726 | struct work_struct kernel_thread_starter; |
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index dd08f7b42fb8..4550573c25e5 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -1097,7 +1097,6 @@ static int qeth_setup_card(struct qeth_card *card) | |||
1097 | card->dev = NULL; | 1097 | card->dev = NULL; |
1098 | spin_lock_init(&card->vlanlock); | 1098 | spin_lock_init(&card->vlanlock); |
1099 | spin_lock_init(&card->mclock); | 1099 | spin_lock_init(&card->mclock); |
1100 | card->vlangrp = NULL; | ||
1101 | spin_lock_init(&card->lock); | 1100 | spin_lock_init(&card->lock); |
1102 | spin_lock_init(&card->ip_lock); | 1101 | spin_lock_init(&card->ip_lock); |
1103 | spin_lock_init(&card->thread_mask_lock); | 1102 | spin_lock_init(&card->thread_mask_lock); |
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index e2c9ac5fcb36..fafb8c299540 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/moduleparam.h> | 15 | #include <linux/moduleparam.h> |
16 | #include <linux/bitops.h> | ||
16 | #include <linux/string.h> | 17 | #include <linux/string.h> |
17 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
18 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
@@ -23,6 +24,7 @@ | |||
23 | #include <linux/inetdevice.h> | 24 | #include <linux/inetdevice.h> |
24 | #include <linux/igmp.h> | 25 | #include <linux/igmp.h> |
25 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/if_vlan.h> | ||
26 | 28 | ||
27 | #include <net/ip.h> | 29 | #include <net/ip.h> |
28 | #include <net/arp.h> | 30 | #include <net/arp.h> |
@@ -1696,16 +1698,18 @@ static void qeth_l3_add_mc(struct qeth_card *card, struct in_device *in4_dev) | |||
1696 | static void qeth_l3_add_vlan_mc(struct qeth_card *card) | 1698 | static void qeth_l3_add_vlan_mc(struct qeth_card *card) |
1697 | { | 1699 | { |
1698 | struct in_device *in_dev; | 1700 | struct in_device *in_dev; |
1699 | struct vlan_group *vg; | 1701 | u16 vid; |
1700 | int i; | ||
1701 | 1702 | ||
1702 | QETH_CARD_TEXT(card, 4, "addmcvl"); | 1703 | QETH_CARD_TEXT(card, 4, "addmcvl"); |
1703 | if (!qeth_is_supported(card, IPA_FULL_VLAN) || (card->vlangrp == NULL)) | 1704 | if (!qeth_is_supported(card, IPA_FULL_VLAN)) |
1704 | return; | 1705 | return; |
1705 | 1706 | ||
1706 | vg = card->vlangrp; | 1707 | for_each_set_bit(vid, card->active_vlans, VLAN_N_VID) { |
1707 | for (i = 0; i < VLAN_N_VID; i++) { | 1708 | struct net_device *netdev; |
1708 | struct net_device *netdev = vlan_group_get_device(vg, i); | 1709 | |
1710 | rcu_read_lock(); | ||
1711 | netdev = __vlan_find_dev_deep(card->dev, vid); | ||
1712 | rcu_read_unlock(); | ||
1709 | if (netdev == NULL || | 1713 | if (netdev == NULL || |
1710 | !(netdev->flags & IFF_UP)) | 1714 | !(netdev->flags & IFF_UP)) |
1711 | continue; | 1715 | continue; |
@@ -1759,16 +1763,16 @@ static void qeth_l3_add_mc6(struct qeth_card *card, struct inet6_dev *in6_dev) | |||
1759 | static void qeth_l3_add_vlan_mc6(struct qeth_card *card) | 1763 | static void qeth_l3_add_vlan_mc6(struct qeth_card *card) |
1760 | { | 1764 | { |
1761 | struct inet6_dev *in_dev; | 1765 | struct inet6_dev *in_dev; |
1762 | struct vlan_group *vg; | 1766 | u16 vid; |
1763 | int i; | ||
1764 | 1767 | ||
1765 | QETH_CARD_TEXT(card, 4, "admc6vl"); | 1768 | QETH_CARD_TEXT(card, 4, "admc6vl"); |
1766 | if (!qeth_is_supported(card, IPA_FULL_VLAN) || (card->vlangrp == NULL)) | 1769 | if (!qeth_is_supported(card, IPA_FULL_VLAN)) |
1767 | return; | 1770 | return; |
1768 | 1771 | ||
1769 | vg = card->vlangrp; | 1772 | for_each_set_bit(vid, card->active_vlans, VLAN_N_VID) { |
1770 | for (i = 0; i < VLAN_N_VID; i++) { | 1773 | struct net_device *netdev; |
1771 | struct net_device *netdev = vlan_group_get_device(vg, i); | 1774 | |
1775 | netdev = __vlan_find_dev_deep(card->dev, vid); | ||
1772 | if (netdev == NULL || | 1776 | if (netdev == NULL || |
1773 | !(netdev->flags & IFF_UP)) | 1777 | !(netdev->flags & IFF_UP)) |
1774 | continue; | 1778 | continue; |
@@ -1806,10 +1810,12 @@ static void qeth_l3_free_vlan_addresses4(struct qeth_card *card, | |||
1806 | struct in_device *in_dev; | 1810 | struct in_device *in_dev; |
1807 | struct in_ifaddr *ifa; | 1811 | struct in_ifaddr *ifa; |
1808 | struct qeth_ipaddr *addr; | 1812 | struct qeth_ipaddr *addr; |
1813 | struct net_device *netdev; | ||
1809 | 1814 | ||
1810 | QETH_CARD_TEXT(card, 4, "frvaddr4"); | 1815 | QETH_CARD_TEXT(card, 4, "frvaddr4"); |
1811 | 1816 | ||
1812 | in_dev = in_dev_get(vlan_group_get_device(card->vlangrp, vid)); | 1817 | netdev = __vlan_find_dev_deep(card->dev, vid); |
1818 | in_dev = in_dev_get(netdev); | ||
1813 | if (!in_dev) | 1819 | if (!in_dev) |
1814 | return; | 1820 | return; |
1815 | for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) { | 1821 | for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) { |
@@ -1832,10 +1838,12 @@ static void qeth_l3_free_vlan_addresses6(struct qeth_card *card, | |||
1832 | struct inet6_dev *in6_dev; | 1838 | struct inet6_dev *in6_dev; |
1833 | struct inet6_ifaddr *ifa; | 1839 | struct inet6_ifaddr *ifa; |
1834 | struct qeth_ipaddr *addr; | 1840 | struct qeth_ipaddr *addr; |
1841 | struct net_device *netdev; | ||
1835 | 1842 | ||
1836 | QETH_CARD_TEXT(card, 4, "frvaddr6"); | 1843 | QETH_CARD_TEXT(card, 4, "frvaddr6"); |
1837 | 1844 | ||
1838 | in6_dev = in6_dev_get(vlan_group_get_device(card->vlangrp, vid)); | 1845 | netdev = __vlan_find_dev_deep(card->dev, vid); |
1846 | in6_dev = in6_dev_get(netdev); | ||
1839 | if (!in6_dev) | 1847 | if (!in6_dev) |
1840 | return; | 1848 | return; |
1841 | list_for_each_entry(ifa, &in6_dev->addr_list, if_list) { | 1849 | list_for_each_entry(ifa, &in6_dev->addr_list, if_list) { |
@@ -1856,26 +1864,15 @@ static void qeth_l3_free_vlan_addresses6(struct qeth_card *card, | |||
1856 | static void qeth_l3_free_vlan_addresses(struct qeth_card *card, | 1864 | static void qeth_l3_free_vlan_addresses(struct qeth_card *card, |
1857 | unsigned short vid) | 1865 | unsigned short vid) |
1858 | { | 1866 | { |
1859 | if (!card->vlangrp) | ||
1860 | return; | ||
1861 | qeth_l3_free_vlan_addresses4(card, vid); | 1867 | qeth_l3_free_vlan_addresses4(card, vid); |
1862 | qeth_l3_free_vlan_addresses6(card, vid); | 1868 | qeth_l3_free_vlan_addresses6(card, vid); |
1863 | } | 1869 | } |
1864 | 1870 | ||
1865 | static void qeth_l3_vlan_rx_register(struct net_device *dev, | 1871 | static void qeth_l3_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) |
1866 | struct vlan_group *grp) | ||
1867 | { | 1872 | { |
1868 | struct qeth_card *card = dev->ml_priv; | 1873 | struct qeth_card *card = dev->ml_priv; |
1869 | unsigned long flags; | ||
1870 | |||
1871 | QETH_CARD_TEXT(card, 4, "vlanreg"); | ||
1872 | spin_lock_irqsave(&card->vlanlock, flags); | ||
1873 | card->vlangrp = grp; | ||
1874 | spin_unlock_irqrestore(&card->vlanlock, flags); | ||
1875 | } | ||
1876 | 1874 | ||
1877 | static void qeth_l3_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) | 1875 | set_bit(vid, card->active_vlans); |
1878 | { | ||
1879 | return; | 1876 | return; |
1880 | } | 1877 | } |
1881 | 1878 | ||
@@ -1892,7 +1889,7 @@ static void qeth_l3_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) | |||
1892 | spin_lock_irqsave(&card->vlanlock, flags); | 1889 | spin_lock_irqsave(&card->vlanlock, flags); |
1893 | /* unregister IP addresses of vlan device */ | 1890 | /* unregister IP addresses of vlan device */ |
1894 | qeth_l3_free_vlan_addresses(card, vid); | 1891 | qeth_l3_free_vlan_addresses(card, vid); |
1895 | vlan_group_set_device(card->vlangrp, vid, NULL); | 1892 | clear_bit(vid, card->active_vlans); |
1896 | spin_unlock_irqrestore(&card->vlanlock, flags); | 1893 | spin_unlock_irqrestore(&card->vlanlock, flags); |
1897 | qeth_l3_set_multicast_list(card->dev); | 1894 | qeth_l3_set_multicast_list(card->dev); |
1898 | } | 1895 | } |
@@ -2014,10 +2011,8 @@ static int qeth_l3_process_inbound_buffer(struct qeth_card *card, | |||
2014 | &vlan_tag); | 2011 | &vlan_tag); |
2015 | len = skb->len; | 2012 | len = skb->len; |
2016 | if (is_vlan && !card->options.sniffer) | 2013 | if (is_vlan && !card->options.sniffer) |
2017 | vlan_gro_receive(&card->napi, card->vlangrp, | 2014 | __vlan_hwaccel_put_tag(skb, vlan_tag); |
2018 | vlan_tag, skb); | 2015 | napi_gro_receive(&card->napi, skb); |
2019 | else | ||
2020 | napi_gro_receive(&card->napi, skb); | ||
2021 | break; | 2016 | break; |
2022 | case QETH_HEADER_TYPE_LAYER2: /* for HiperSockets sniffer */ | 2017 | case QETH_HEADER_TYPE_LAYER2: /* for HiperSockets sniffer */ |
2023 | skb->pkt_type = PACKET_HOST; | 2018 | skb->pkt_type = PACKET_HOST; |
@@ -2118,15 +2113,15 @@ static int qeth_l3_verify_vlan_dev(struct net_device *dev, | |||
2118 | struct qeth_card *card) | 2113 | struct qeth_card *card) |
2119 | { | 2114 | { |
2120 | int rc = 0; | 2115 | int rc = 0; |
2121 | struct vlan_group *vg; | 2116 | u16 vid; |
2122 | int i; | ||
2123 | 2117 | ||
2124 | vg = card->vlangrp; | 2118 | for_each_set_bit(vid, card->active_vlans, VLAN_N_VID) { |
2125 | if (!vg) | 2119 | struct net_device *netdev; |
2126 | return rc; | ||
2127 | 2120 | ||
2128 | for (i = 0; i < VLAN_N_VID; i++) { | 2121 | rcu_read_lock(); |
2129 | if (vlan_group_get_device(vg, i) == dev) { | 2122 | netdev = __vlan_find_dev_deep(dev, vid); |
2123 | rcu_read_unlock(); | ||
2124 | if (netdev == dev) { | ||
2130 | rc = QETH_VLAN_CARD; | 2125 | rc = QETH_VLAN_CARD; |
2131 | break; | 2126 | break; |
2132 | } | 2127 | } |
@@ -2803,7 +2798,7 @@ static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr, | |||
2803 | * before we're going to overwrite this location with next hop ip. | 2798 | * before we're going to overwrite this location with next hop ip. |
2804 | * v6 uses passthrough, v4 sets the tag in the QDIO header. | 2799 | * v6 uses passthrough, v4 sets the tag in the QDIO header. |
2805 | */ | 2800 | */ |
2806 | if (card->vlangrp && vlan_tx_tag_present(skb)) { | 2801 | if (vlan_tx_tag_present(skb)) { |
2807 | if ((ipv == 4) || (card->info.type == QETH_CARD_TYPE_IQD)) | 2802 | if ((ipv == 4) || (card->info.type == QETH_CARD_TYPE_IQD)) |
2808 | hdr->hdr.l3.ext_flags = QETH_HDR_EXT_VLAN_FRAME; | 2803 | hdr->hdr.l3.ext_flags = QETH_HDR_EXT_VLAN_FRAME; |
2809 | else | 2804 | else |
@@ -2988,8 +2983,7 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2988 | skb_pull(new_skb, ETH_HLEN); | 2983 | skb_pull(new_skb, ETH_HLEN); |
2989 | } | 2984 | } |
2990 | 2985 | ||
2991 | if (ipv != 4 && card->vlangrp && | 2986 | if (ipv != 4 && vlan_tx_tag_present(new_skb)) { |
2992 | vlan_tx_tag_present(new_skb)) { | ||
2993 | skb_push(new_skb, VLAN_HLEN); | 2987 | skb_push(new_skb, VLAN_HLEN); |
2994 | skb_copy_to_linear_data(new_skb, new_skb->data + 4, 4); | 2988 | skb_copy_to_linear_data(new_skb, new_skb->data + 4, 4); |
2995 | skb_copy_to_linear_data_offset(new_skb, 4, | 2989 | skb_copy_to_linear_data_offset(new_skb, 4, |
@@ -3233,14 +3227,13 @@ static const struct net_device_ops qeth_l3_netdev_ops = { | |||
3233 | .ndo_start_xmit = qeth_l3_hard_start_xmit, | 3227 | .ndo_start_xmit = qeth_l3_hard_start_xmit, |
3234 | .ndo_validate_addr = eth_validate_addr, | 3228 | .ndo_validate_addr = eth_validate_addr, |
3235 | .ndo_set_multicast_list = qeth_l3_set_multicast_list, | 3229 | .ndo_set_multicast_list = qeth_l3_set_multicast_list, |
3236 | .ndo_do_ioctl = qeth_l3_do_ioctl, | 3230 | .ndo_do_ioctl = qeth_l3_do_ioctl, |
3237 | .ndo_change_mtu = qeth_change_mtu, | 3231 | .ndo_change_mtu = qeth_change_mtu, |
3238 | .ndo_fix_features = qeth_l3_fix_features, | 3232 | .ndo_fix_features = qeth_l3_fix_features, |
3239 | .ndo_set_features = qeth_l3_set_features, | 3233 | .ndo_set_features = qeth_l3_set_features, |
3240 | .ndo_vlan_rx_register = qeth_l3_vlan_rx_register, | ||
3241 | .ndo_vlan_rx_add_vid = qeth_l3_vlan_rx_add_vid, | 3234 | .ndo_vlan_rx_add_vid = qeth_l3_vlan_rx_add_vid, |
3242 | .ndo_vlan_rx_kill_vid = qeth_l3_vlan_rx_kill_vid, | 3235 | .ndo_vlan_rx_kill_vid = qeth_l3_vlan_rx_kill_vid, |
3243 | .ndo_tx_timeout = qeth_tx_timeout, | 3236 | .ndo_tx_timeout = qeth_tx_timeout, |
3244 | }; | 3237 | }; |
3245 | 3238 | ||
3246 | static const struct net_device_ops qeth_l3_osa_netdev_ops = { | 3239 | static const struct net_device_ops qeth_l3_osa_netdev_ops = { |
@@ -3250,14 +3243,13 @@ static const struct net_device_ops qeth_l3_osa_netdev_ops = { | |||
3250 | .ndo_start_xmit = qeth_l3_hard_start_xmit, | 3243 | .ndo_start_xmit = qeth_l3_hard_start_xmit, |
3251 | .ndo_validate_addr = eth_validate_addr, | 3244 | .ndo_validate_addr = eth_validate_addr, |
3252 | .ndo_set_multicast_list = qeth_l3_set_multicast_list, | 3245 | .ndo_set_multicast_list = qeth_l3_set_multicast_list, |
3253 | .ndo_do_ioctl = qeth_l3_do_ioctl, | 3246 | .ndo_do_ioctl = qeth_l3_do_ioctl, |
3254 | .ndo_change_mtu = qeth_change_mtu, | 3247 | .ndo_change_mtu = qeth_change_mtu, |
3255 | .ndo_fix_features = qeth_l3_fix_features, | 3248 | .ndo_fix_features = qeth_l3_fix_features, |
3256 | .ndo_set_features = qeth_l3_set_features, | 3249 | .ndo_set_features = qeth_l3_set_features, |
3257 | .ndo_vlan_rx_register = qeth_l3_vlan_rx_register, | ||
3258 | .ndo_vlan_rx_add_vid = qeth_l3_vlan_rx_add_vid, | 3250 | .ndo_vlan_rx_add_vid = qeth_l3_vlan_rx_add_vid, |
3259 | .ndo_vlan_rx_kill_vid = qeth_l3_vlan_rx_kill_vid, | 3251 | .ndo_vlan_rx_kill_vid = qeth_l3_vlan_rx_kill_vid, |
3260 | .ndo_tx_timeout = qeth_tx_timeout, | 3252 | .ndo_tx_timeout = qeth_tx_timeout, |
3261 | .ndo_neigh_setup = qeth_l3_neigh_setup, | 3253 | .ndo_neigh_setup = qeth_l3_neigh_setup, |
3262 | }; | 3254 | }; |
3263 | 3255 | ||