diff options
author | David S. Miller <davem@davemloft.net> | 2014-10-15 00:29:08 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-10-15 00:29:08 -0400 |
commit | 2ef1e9efebce49ffc9ae13a6e9d93da83734494e (patch) | |
tree | c89d5539712b1ae3ebe8425d52aab10ff3d9e17d | |
parent | 9b462d02d6dd671a9ebdc45caed6fe98a53c0ebe (diff) | |
parent | c5bbcb5822b25c9f738db98e6d6ad2506cab8136 (diff) |
Merge branch 'cxgb4'
Anish Bhatt says:
====================
ipv6 and related cleanup for cxgb4/cxgb4i
This patch set removes some duplicated/extraneous code from cxgb4i, guards
cxgb4 against compilation failure based on ipv6 tristate, make ipv6 related
code no longer be enabled by default irrespective of ipv6 tristate and fixes
a refcnt issue.
-Anish
v2 : Provide more detailed commit messages, make subject more concise as
recommended by Dave Miller.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/chelsio/Kconfig | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 15 | ||||
-rw-r--r-- | drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 146 | ||||
-rw-r--r-- | drivers/scsi/cxgbi/libcxgbi.c | 2 |
4 files changed, 26 insertions, 139 deletions
diff --git a/drivers/net/ethernet/chelsio/Kconfig b/drivers/net/ethernet/chelsio/Kconfig index c3ce9df0041a..ac6473f75eb9 100644 --- a/drivers/net/ethernet/chelsio/Kconfig +++ b/drivers/net/ethernet/chelsio/Kconfig | |||
@@ -68,7 +68,7 @@ config CHELSIO_T3 | |||
68 | 68 | ||
69 | config CHELSIO_T4 | 69 | config CHELSIO_T4 |
70 | tristate "Chelsio Communications T4/T5 Ethernet support" | 70 | tristate "Chelsio Communications T4/T5 Ethernet support" |
71 | depends on PCI | 71 | depends on PCI && (IPV6 || IPV6=n) |
72 | select FW_LOADER | 72 | select FW_LOADER |
73 | select MDIO | 73 | select MDIO |
74 | ---help--- | 74 | ---help--- |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index fed8f26ee67b..3f60070f2519 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -4369,6 +4369,7 @@ EXPORT_SYMBOL(cxgb4_unregister_uld); | |||
4369 | * success (true) if it belongs otherwise failure (false). | 4369 | * success (true) if it belongs otherwise failure (false). |
4370 | * Called with rcu_read_lock() held. | 4370 | * Called with rcu_read_lock() held. |
4371 | */ | 4371 | */ |
4372 | #if IS_ENABLED(CONFIG_IPV6) | ||
4372 | static bool cxgb4_netdev(const struct net_device *netdev) | 4373 | static bool cxgb4_netdev(const struct net_device *netdev) |
4373 | { | 4374 | { |
4374 | struct adapter *adap; | 4375 | struct adapter *adap; |
@@ -4490,6 +4491,13 @@ static int update_root_dev_clip(struct net_device *dev) | |||
4490 | return ret; | 4491 | return ret; |
4491 | 4492 | ||
4492 | /* Parse all bond and vlan devices layered on top of the physical dev */ | 4493 | /* Parse all bond and vlan devices layered on top of the physical dev */ |
4494 | root_dev = netdev_master_upper_dev_get_rcu(dev); | ||
4495 | if (root_dev) { | ||
4496 | ret = update_dev_clip(root_dev, dev); | ||
4497 | if (ret) | ||
4498 | return ret; | ||
4499 | } | ||
4500 | |||
4493 | for (i = 0; i < VLAN_N_VID; i++) { | 4501 | for (i = 0; i < VLAN_N_VID; i++) { |
4494 | root_dev = __vlan_find_dev_deep_rcu(dev, htons(ETH_P_8021Q), i); | 4502 | root_dev = __vlan_find_dev_deep_rcu(dev, htons(ETH_P_8021Q), i); |
4495 | if (!root_dev) | 4503 | if (!root_dev) |
@@ -4522,6 +4530,7 @@ static void update_clip(const struct adapter *adap) | |||
4522 | } | 4530 | } |
4523 | rcu_read_unlock(); | 4531 | rcu_read_unlock(); |
4524 | } | 4532 | } |
4533 | #endif /* IS_ENABLED(CONFIG_IPV6) */ | ||
4525 | 4534 | ||
4526 | /** | 4535 | /** |
4527 | * cxgb_up - enable the adapter | 4536 | * cxgb_up - enable the adapter |
@@ -4568,7 +4577,9 @@ static int cxgb_up(struct adapter *adap) | |||
4568 | t4_intr_enable(adap); | 4577 | t4_intr_enable(adap); |
4569 | adap->flags |= FULL_INIT_DONE; | 4578 | adap->flags |= FULL_INIT_DONE; |
4570 | notify_ulds(adap, CXGB4_STATE_UP); | 4579 | notify_ulds(adap, CXGB4_STATE_UP); |
4580 | #if IS_ENABLED(CONFIG_IPV6) | ||
4571 | update_clip(adap); | 4581 | update_clip(adap); |
4582 | #endif | ||
4572 | out: | 4583 | out: |
4573 | return err; | 4584 | return err; |
4574 | irq_err: | 4585 | irq_err: |
@@ -6862,14 +6873,18 @@ static int __init cxgb4_init_module(void) | |||
6862 | if (ret < 0) | 6873 | if (ret < 0) |
6863 | debugfs_remove(cxgb4_debugfs_root); | 6874 | debugfs_remove(cxgb4_debugfs_root); |
6864 | 6875 | ||
6876 | #if IS_ENABLED(CONFIG_IPV6) | ||
6865 | register_inet6addr_notifier(&cxgb4_inet6addr_notifier); | 6877 | register_inet6addr_notifier(&cxgb4_inet6addr_notifier); |
6878 | #endif | ||
6866 | 6879 | ||
6867 | return ret; | 6880 | return ret; |
6868 | } | 6881 | } |
6869 | 6882 | ||
6870 | static void __exit cxgb4_cleanup_module(void) | 6883 | static void __exit cxgb4_cleanup_module(void) |
6871 | { | 6884 | { |
6885 | #if IS_ENABLED(CONFIG_IPV6) | ||
6872 | unregister_inet6addr_notifier(&cxgb4_inet6addr_notifier); | 6886 | unregister_inet6addr_notifier(&cxgb4_inet6addr_notifier); |
6887 | #endif | ||
6873 | pci_unregister_driver(&cxgb4_driver); | 6888 | pci_unregister_driver(&cxgb4_driver); |
6874 | debugfs_remove(cxgb4_debugfs_root); /* NULL ok */ | 6889 | debugfs_remove(cxgb4_debugfs_root); /* NULL ok */ |
6875 | } | 6890 | } |
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c index 02e69e7ee4a3..8c3003b6d591 100644 --- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | |||
@@ -259,6 +259,7 @@ static void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb, | |||
259 | cxgb4_l2t_send(csk->cdev->ports[csk->port_id], skb, csk->l2t); | 259 | cxgb4_l2t_send(csk->cdev->ports[csk->port_id], skb, csk->l2t); |
260 | } | 260 | } |
261 | 261 | ||
262 | #if IS_ENABLED(CONFIG_IPV6) | ||
262 | static void send_act_open_req6(struct cxgbi_sock *csk, struct sk_buff *skb, | 263 | static void send_act_open_req6(struct cxgbi_sock *csk, struct sk_buff *skb, |
263 | struct l2t_entry *e) | 264 | struct l2t_entry *e) |
264 | { | 265 | { |
@@ -344,6 +345,7 @@ static void send_act_open_req6(struct cxgbi_sock *csk, struct sk_buff *skb, | |||
344 | 345 | ||
345 | cxgb4_l2t_send(csk->cdev->ports[csk->port_id], skb, csk->l2t); | 346 | cxgb4_l2t_send(csk->cdev->ports[csk->port_id], skb, csk->l2t); |
346 | } | 347 | } |
348 | #endif | ||
347 | 349 | ||
348 | static void send_close_req(struct cxgbi_sock *csk) | 350 | static void send_close_req(struct cxgbi_sock *csk) |
349 | { | 351 | { |
@@ -781,9 +783,11 @@ static void csk_act_open_retry_timer(unsigned long data) | |||
781 | if (csk->csk_family == AF_INET) { | 783 | if (csk->csk_family == AF_INET) { |
782 | send_act_open_func = send_act_open_req; | 784 | send_act_open_func = send_act_open_req; |
783 | skb = alloc_wr(size, 0, GFP_ATOMIC); | 785 | skb = alloc_wr(size, 0, GFP_ATOMIC); |
786 | #if IS_ENABLED(CONFIG_IPV6) | ||
784 | } else { | 787 | } else { |
785 | send_act_open_func = send_act_open_req6; | 788 | send_act_open_func = send_act_open_req6; |
786 | skb = alloc_wr(size6, 0, GFP_ATOMIC); | 789 | skb = alloc_wr(size6, 0, GFP_ATOMIC); |
790 | #endif | ||
787 | } | 791 | } |
788 | 792 | ||
789 | if (!skb) | 793 | if (!skb) |
@@ -1313,11 +1317,6 @@ static int init_act_open(struct cxgbi_sock *csk) | |||
1313 | cxgbi_sock_set_flag(csk, CTPF_HAS_ATID); | 1317 | cxgbi_sock_set_flag(csk, CTPF_HAS_ATID); |
1314 | cxgbi_sock_get(csk); | 1318 | cxgbi_sock_get(csk); |
1315 | 1319 | ||
1316 | n = dst_neigh_lookup(csk->dst, &csk->daddr.sin_addr.s_addr); | ||
1317 | if (!n) { | ||
1318 | pr_err("%s, can't get neighbour of csk->dst.\n", ndev->name); | ||
1319 | goto rel_resource; | ||
1320 | } | ||
1321 | csk->l2t = cxgb4_l2t_get(lldi->l2t, n, ndev, 0); | 1320 | csk->l2t = cxgb4_l2t_get(lldi->l2t, n, ndev, 0); |
1322 | if (!csk->l2t) { | 1321 | if (!csk->l2t) { |
1323 | pr_err("%s, cannot alloc l2t.\n", ndev->name); | 1322 | pr_err("%s, cannot alloc l2t.\n", ndev->name); |
@@ -1335,8 +1334,10 @@ static int init_act_open(struct cxgbi_sock *csk) | |||
1335 | 1334 | ||
1336 | if (csk->csk_family == AF_INET) | 1335 | if (csk->csk_family == AF_INET) |
1337 | skb = alloc_wr(size, 0, GFP_NOIO); | 1336 | skb = alloc_wr(size, 0, GFP_NOIO); |
1337 | #if IS_ENABLED(CONFIG_IPV6) | ||
1338 | else | 1338 | else |
1339 | skb = alloc_wr(size6, 0, GFP_NOIO); | 1339 | skb = alloc_wr(size6, 0, GFP_NOIO); |
1340 | #endif | ||
1340 | 1341 | ||
1341 | if (!skb) | 1342 | if (!skb) |
1342 | goto rel_resource; | 1343 | goto rel_resource; |
@@ -1370,8 +1371,10 @@ static int init_act_open(struct cxgbi_sock *csk) | |||
1370 | cxgbi_sock_set_state(csk, CTP_ACTIVE_OPEN); | 1371 | cxgbi_sock_set_state(csk, CTP_ACTIVE_OPEN); |
1371 | if (csk->csk_family == AF_INET) | 1372 | if (csk->csk_family == AF_INET) |
1372 | send_act_open_req(csk, skb, csk->l2t); | 1373 | send_act_open_req(csk, skb, csk->l2t); |
1374 | #if IS_ENABLED(CONFIG_IPV6) | ||
1373 | else | 1375 | else |
1374 | send_act_open_req6(csk, skb, csk->l2t); | 1376 | send_act_open_req6(csk, skb, csk->l2t); |
1377 | #endif | ||
1375 | neigh_release(n); | 1378 | neigh_release(n); |
1376 | 1379 | ||
1377 | return 0; | 1380 | return 0; |
@@ -1635,129 +1638,6 @@ static int cxgb4i_ddp_init(struct cxgbi_device *cdev) | |||
1635 | return 0; | 1638 | return 0; |
1636 | } | 1639 | } |
1637 | 1640 | ||
1638 | #if IS_ENABLED(CONFIG_IPV6) | ||
1639 | static int cxgbi_inet6addr_handler(struct notifier_block *this, | ||
1640 | unsigned long event, void *data) | ||
1641 | { | ||
1642 | struct inet6_ifaddr *ifa = data; | ||
1643 | struct net_device *event_dev = ifa->idev->dev; | ||
1644 | struct cxgbi_device *cdev; | ||
1645 | int ret = NOTIFY_DONE; | ||
1646 | |||
1647 | if (event_dev->priv_flags & IFF_802_1Q_VLAN) | ||
1648 | event_dev = vlan_dev_real_dev(event_dev); | ||
1649 | |||
1650 | cdev = cxgbi_device_find_by_netdev_rcu(event_dev, NULL); | ||
1651 | |||
1652 | if (!cdev) | ||
1653 | return ret; | ||
1654 | |||
1655 | switch (event) { | ||
1656 | case NETDEV_UP: | ||
1657 | ret = cxgb4_clip_get(event_dev, | ||
1658 | (const struct in6_addr *) | ||
1659 | ((ifa)->addr.s6_addr)); | ||
1660 | if (ret < 0) | ||
1661 | return ret; | ||
1662 | |||
1663 | ret = NOTIFY_OK; | ||
1664 | break; | ||
1665 | |||
1666 | case NETDEV_DOWN: | ||
1667 | cxgb4_clip_release(event_dev, | ||
1668 | (const struct in6_addr *) | ||
1669 | ((ifa)->addr.s6_addr)); | ||
1670 | ret = NOTIFY_OK; | ||
1671 | break; | ||
1672 | |||
1673 | default: | ||
1674 | break; | ||
1675 | } | ||
1676 | |||
1677 | return ret; | ||
1678 | } | ||
1679 | |||
1680 | static struct notifier_block cxgbi_inet6addr_notifier = { | ||
1681 | .notifier_call = cxgbi_inet6addr_handler | ||
1682 | }; | ||
1683 | |||
1684 | /* Retrieve IPv6 addresses from a root device (bond, vlan) associated with | ||
1685 | * a physical device. | ||
1686 | * The physical device reference is needed to send the actual CLIP command. | ||
1687 | */ | ||
1688 | static int update_dev_clip(struct net_device *root_dev, struct net_device *dev) | ||
1689 | { | ||
1690 | struct inet6_dev *idev = NULL; | ||
1691 | struct inet6_ifaddr *ifa; | ||
1692 | int ret = 0; | ||
1693 | |||
1694 | idev = __in6_dev_get(root_dev); | ||
1695 | if (!idev) | ||
1696 | return ret; | ||
1697 | |||
1698 | read_lock_bh(&idev->lock); | ||
1699 | list_for_each_entry(ifa, &idev->addr_list, if_list) { | ||
1700 | pr_info("updating the clip for addr %pI6\n", | ||
1701 | ifa->addr.s6_addr); | ||
1702 | ret = cxgb4_clip_get(dev, (const struct in6_addr *) | ||
1703 | ifa->addr.s6_addr); | ||
1704 | if (ret < 0) | ||
1705 | break; | ||
1706 | } | ||
1707 | |||
1708 | read_unlock_bh(&idev->lock); | ||
1709 | return ret; | ||
1710 | } | ||
1711 | |||
1712 | static int update_root_dev_clip(struct net_device *dev) | ||
1713 | { | ||
1714 | struct net_device *root_dev = NULL; | ||
1715 | int i, ret = 0; | ||
1716 | |||
1717 | /* First populate the real net device's IPv6 address */ | ||
1718 | ret = update_dev_clip(dev, dev); | ||
1719 | if (ret) | ||
1720 | return ret; | ||
1721 | |||
1722 | /* Parse all bond and vlan devices layered on top of the physical dev */ | ||
1723 | root_dev = netdev_master_upper_dev_get(dev); | ||
1724 | if (root_dev) { | ||
1725 | ret = update_dev_clip(root_dev, dev); | ||
1726 | if (ret) | ||
1727 | return ret; | ||
1728 | } | ||
1729 | |||
1730 | for (i = 0; i < VLAN_N_VID; i++) { | ||
1731 | root_dev = __vlan_find_dev_deep_rcu(dev, htons(ETH_P_8021Q), i); | ||
1732 | if (!root_dev) | ||
1733 | continue; | ||
1734 | |||
1735 | ret = update_dev_clip(root_dev, dev); | ||
1736 | if (ret) | ||
1737 | break; | ||
1738 | } | ||
1739 | return ret; | ||
1740 | } | ||
1741 | |||
1742 | static void cxgbi_update_clip(struct cxgbi_device *cdev) | ||
1743 | { | ||
1744 | int i; | ||
1745 | |||
1746 | rcu_read_lock(); | ||
1747 | |||
1748 | for (i = 0; i < cdev->nports; i++) { | ||
1749 | struct net_device *dev = cdev->ports[i]; | ||
1750 | int ret = 0; | ||
1751 | |||
1752 | if (dev) | ||
1753 | ret = update_root_dev_clip(dev); | ||
1754 | if (ret < 0) | ||
1755 | break; | ||
1756 | } | ||
1757 | rcu_read_unlock(); | ||
1758 | } | ||
1759 | #endif /* IS_ENABLED(CONFIG_IPV6) */ | ||
1760 | |||
1761 | static void *t4_uld_add(const struct cxgb4_lld_info *lldi) | 1641 | static void *t4_uld_add(const struct cxgb4_lld_info *lldi) |
1762 | { | 1642 | { |
1763 | struct cxgbi_device *cdev; | 1643 | struct cxgbi_device *cdev; |
@@ -1876,10 +1756,6 @@ static int t4_uld_state_change(void *handle, enum cxgb4_state state) | |||
1876 | switch (state) { | 1756 | switch (state) { |
1877 | case CXGB4_STATE_UP: | 1757 | case CXGB4_STATE_UP: |
1878 | pr_info("cdev 0x%p, UP.\n", cdev); | 1758 | pr_info("cdev 0x%p, UP.\n", cdev); |
1879 | #if IS_ENABLED(CONFIG_IPV6) | ||
1880 | cxgbi_update_clip(cdev); | ||
1881 | #endif | ||
1882 | /* re-initialize */ | ||
1883 | break; | 1759 | break; |
1884 | case CXGB4_STATE_START_RECOVERY: | 1760 | case CXGB4_STATE_START_RECOVERY: |
1885 | pr_info("cdev 0x%p, RECOVERY.\n", cdev); | 1761 | pr_info("cdev 0x%p, RECOVERY.\n", cdev); |
@@ -1910,17 +1786,11 @@ static int __init cxgb4i_init_module(void) | |||
1910 | return rc; | 1786 | return rc; |
1911 | cxgb4_register_uld(CXGB4_ULD_ISCSI, &cxgb4i_uld_info); | 1787 | cxgb4_register_uld(CXGB4_ULD_ISCSI, &cxgb4i_uld_info); |
1912 | 1788 | ||
1913 | #if IS_ENABLED(CONFIG_IPV6) | ||
1914 | register_inet6addr_notifier(&cxgbi_inet6addr_notifier); | ||
1915 | #endif | ||
1916 | return 0; | 1789 | return 0; |
1917 | } | 1790 | } |
1918 | 1791 | ||
1919 | static void __exit cxgb4i_exit_module(void) | 1792 | static void __exit cxgb4i_exit_module(void) |
1920 | { | 1793 | { |
1921 | #if IS_ENABLED(CONFIG_IPV6) | ||
1922 | unregister_inet6addr_notifier(&cxgbi_inet6addr_notifier); | ||
1923 | #endif | ||
1924 | cxgb4_unregister_uld(CXGB4_ULD_ISCSI); | 1794 | cxgb4_unregister_uld(CXGB4_ULD_ISCSI); |
1925 | cxgbi_device_unregister_all(CXGBI_FLAG_DEV_T4); | 1795 | cxgbi_device_unregister_all(CXGBI_FLAG_DEV_T4); |
1926 | cxgbi_iscsi_cleanup(&cxgb4i_iscsi_transport, &cxgb4i_stt); | 1796 | cxgbi_iscsi_cleanup(&cxgb4i_iscsi_transport, &cxgb4i_stt); |
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index 6a2001d6b442..54fa6e0bc1bb 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c | |||
@@ -275,6 +275,7 @@ struct cxgbi_device *cxgbi_device_find_by_netdev_rcu(struct net_device *ndev, | |||
275 | } | 275 | } |
276 | EXPORT_SYMBOL_GPL(cxgbi_device_find_by_netdev_rcu); | 276 | EXPORT_SYMBOL_GPL(cxgbi_device_find_by_netdev_rcu); |
277 | 277 | ||
278 | #if IS_ENABLED(CONFIG_IPV6) | ||
278 | static struct cxgbi_device *cxgbi_device_find_by_mac(struct net_device *ndev, | 279 | static struct cxgbi_device *cxgbi_device_find_by_mac(struct net_device *ndev, |
279 | int *port) | 280 | int *port) |
280 | { | 281 | { |
@@ -307,6 +308,7 @@ static struct cxgbi_device *cxgbi_device_find_by_mac(struct net_device *ndev, | |||
307 | ndev, ndev->name); | 308 | ndev, ndev->name); |
308 | return NULL; | 309 | return NULL; |
309 | } | 310 | } |
311 | #endif | ||
310 | 312 | ||
311 | void cxgbi_hbas_remove(struct cxgbi_device *cdev) | 313 | void cxgbi_hbas_remove(struct cxgbi_device *cdev) |
312 | { | 314 | { |