Skip to content

Commit 2ef1e9e

Browse files
committed
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>
2 parents 9b462d0 + c5bbcb5 commit 2ef1e9e

4 files changed

Lines changed: 26 additions & 139 deletions

File tree

‎drivers/net/ethernet/chelsio/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ config CHELSIO_T3
6868

6969
config CHELSIO_T4
7070
tristate "Chelsio Communications T4/T5 Ethernet support"
71-
depends on PCI
71+
depends on PCI && (IPV6 || IPV6=n)
7272
select FW_LOADER
7373
select MDIO
7474
---help---

‎drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4369,6 +4369,7 @@ EXPORT_SYMBOL(cxgb4_unregister_uld);
43694369
* success (true) if it belongs otherwise failure (false).
43704370
* Called with rcu_read_lock() held.
43714371
*/
4372+
#if IS_ENABLED(CONFIG_IPV6)
43724373
static bool cxgb4_netdev(const struct net_device *netdev)
43734374
{
43744375
struct adapter *adap;
@@ -4490,6 +4491,13 @@ static int update_root_dev_clip(struct net_device *dev)
44904491
return ret;
44914492

44924493
/* 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+
44934501
for (i = 0; i < VLAN_N_VID; i++) {
44944502
root_dev = __vlan_find_dev_deep_rcu(dev, htons(ETH_P_8021Q), i);
44954503
if (!root_dev)
@@ -4522,6 +4530,7 @@ static void update_clip(const struct adapter *adap)
45224530
}
45234531
rcu_read_unlock();
45244532
}
4533+
#endif /* IS_ENABLED(CONFIG_IPV6) */
45254534

45264535
/**
45274536
* cxgb_up - enable the adapter
@@ -4568,7 +4577,9 @@ static int cxgb_up(struct adapter *adap)
45684577
t4_intr_enable(adap);
45694578
adap->flags |= FULL_INIT_DONE;
45704579
notify_ulds(adap, CXGB4_STATE_UP);
4580+
#if IS_ENABLED(CONFIG_IPV6)
45714581
update_clip(adap);
4582+
#endif
45724583
out:
45734584
return err;
45744585
irq_err:
@@ -6862,14 +6873,18 @@ static int __init cxgb4_init_module(void)
68626873
if (ret < 0)
68636874
debugfs_remove(cxgb4_debugfs_root);
68646875

6876+
#if IS_ENABLED(CONFIG_IPV6)
68656877
register_inet6addr_notifier(&cxgb4_inet6addr_notifier);
6878+
#endif
68666879

68676880
return ret;
68686881
}
68696882

68706883
static void __exit cxgb4_cleanup_module(void)
68716884
{
6885+
#if IS_ENABLED(CONFIG_IPV6)
68726886
unregister_inet6addr_notifier(&cxgb4_inet6addr_notifier);
6887+
#endif
68736888
pci_unregister_driver(&cxgb4_driver);
68746889
debugfs_remove(cxgb4_debugfs_root); /* NULL ok */
68756890
}

‎drivers/scsi/cxgbi/cxgb4i/cxgb4i.c‎

Lines changed: 8 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ static void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb,
259259
cxgb4_l2t_send(csk->cdev->ports[csk->port_id], skb, csk->l2t);
260260
}
261261

262+
#if IS_ENABLED(CONFIG_IPV6)
262263
static void send_act_open_req6(struct cxgbi_sock *csk, struct sk_buff *skb,
263264
struct l2t_entry *e)
264265
{
@@ -344,6 +345,7 @@ static void send_act_open_req6(struct cxgbi_sock *csk, struct sk_buff *skb,
344345

345346
cxgb4_l2t_send(csk->cdev->ports[csk->port_id], skb, csk->l2t);
346347
}
348+
#endif
347349

348350
static void send_close_req(struct cxgbi_sock *csk)
349351
{
@@ -781,9 +783,11 @@ static void csk_act_open_retry_timer(unsigned long data)
781783
if (csk->csk_family == AF_INET) {
782784
send_act_open_func = send_act_open_req;
783785
skb = alloc_wr(size, 0, GFP_ATOMIC);
786+
#if IS_ENABLED(CONFIG_IPV6)
784787
} else {
785788
send_act_open_func = send_act_open_req6;
786789
skb = alloc_wr(size6, 0, GFP_ATOMIC);
790+
#endif
787791
}
788792

789793
if (!skb)
@@ -1313,11 +1317,6 @@ static int init_act_open(struct cxgbi_sock *csk)
13131317
cxgbi_sock_set_flag(csk, CTPF_HAS_ATID);
13141318
cxgbi_sock_get(csk);
13151319

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-
}
13211320
csk->l2t = cxgb4_l2t_get(lldi->l2t, n, ndev, 0);
13221321
if (!csk->l2t) {
13231322
pr_err("%s, cannot alloc l2t.\n", ndev->name);
@@ -1335,8 +1334,10 @@ static int init_act_open(struct cxgbi_sock *csk)
13351334

13361335
if (csk->csk_family == AF_INET)
13371336
skb = alloc_wr(size, 0, GFP_NOIO);
1337+
#if IS_ENABLED(CONFIG_IPV6)
13381338
else
13391339
skb = alloc_wr(size6, 0, GFP_NOIO);
1340+
#endif
13401341

13411342
if (!skb)
13421343
goto rel_resource;
@@ -1370,8 +1371,10 @@ static int init_act_open(struct cxgbi_sock *csk)
13701371
cxgbi_sock_set_state(csk, CTP_ACTIVE_OPEN);
13711372
if (csk->csk_family == AF_INET)
13721373
send_act_open_req(csk, skb, csk->l2t);
1374+
#if IS_ENABLED(CONFIG_IPV6)
13731375
else
13741376
send_act_open_req6(csk, skb, csk->l2t);
1377+
#endif
13751378
neigh_release(n);
13761379

13771380
return 0;
@@ -1635,129 +1638,6 @@ static int cxgb4i_ddp_init(struct cxgbi_device *cdev)
16351638
return 0;
16361639
}
16371640

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-
17611641
static void *t4_uld_add(const struct cxgb4_lld_info *lldi)
17621642
{
17631643
struct cxgbi_device *cdev;
@@ -1876,10 +1756,6 @@ static int t4_uld_state_change(void *handle, enum cxgb4_state state)
18761756
switch (state) {
18771757
case CXGB4_STATE_UP:
18781758
pr_info("cdev 0x%p, UP.\n", cdev);
1879-
#if IS_ENABLED(CONFIG_IPV6)
1880-
cxgbi_update_clip(cdev);
1881-
#endif
1882-
/* re-initialize */
18831759
break;
18841760
case CXGB4_STATE_START_RECOVERY:
18851761
pr_info("cdev 0x%p, RECOVERY.\n", cdev);
@@ -1910,17 +1786,11 @@ static int __init cxgb4i_init_module(void)
19101786
return rc;
19111787
cxgb4_register_uld(CXGB4_ULD_ISCSI, &cxgb4i_uld_info);
19121788

1913-
#if IS_ENABLED(CONFIG_IPV6)
1914-
register_inet6addr_notifier(&cxgbi_inet6addr_notifier);
1915-
#endif
19161789
return 0;
19171790
}
19181791

19191792
static void __exit cxgb4i_exit_module(void)
19201793
{
1921-
#if IS_ENABLED(CONFIG_IPV6)
1922-
unregister_inet6addr_notifier(&cxgbi_inet6addr_notifier);
1923-
#endif
19241794
cxgb4_unregister_uld(CXGB4_ULD_ISCSI);
19251795
cxgbi_device_unregister_all(CXGBI_FLAG_DEV_T4);
19261796
cxgbi_iscsi_cleanup(&cxgb4i_iscsi_transport, &cxgb4i_stt);

‎drivers/scsi/cxgbi/libcxgbi.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ struct cxgbi_device *cxgbi_device_find_by_netdev_rcu(struct net_device *ndev,
275275
}
276276
EXPORT_SYMBOL_GPL(cxgbi_device_find_by_netdev_rcu);
277277

278+
#if IS_ENABLED(CONFIG_IPV6)
278279
static struct cxgbi_device *cxgbi_device_find_by_mac(struct net_device *ndev,
279280
int *port)
280281
{
@@ -307,6 +308,7 @@ static struct cxgbi_device *cxgbi_device_find_by_mac(struct net_device *ndev,
307308
ndev, ndev->name);
308309
return NULL;
309310
}
311+
#endif
310312

311313
void cxgbi_hbas_remove(struct cxgbi_device *cdev)
312314
{

0 commit comments

Comments
 (0)