Skip to content

Commit 644c3f7

Browse files
committed
net: mana: Change the function signature of mana_get_primary_netdev_rcu
jira LE-4385 Rebuild_History Non-Buildable kernel-5.14.0-570.52.1.el9_6 commit-author Long Li <[email protected]> commit a8445cf Empty-Commit: Cherry-Pick Conflicts during history rebuild. Will be included in final tarball splat. Ref for failed cherry-pick at: ciq/ciq_backports/kernel-5.14.0-570.52.1.el9_6/a8445cfe.failed Change mana_get_primary_netdev_rcu() to mana_get_primary_netdev(), and return the ndev with refcount held. The caller is responsible for dropping the refcount. Also drop the check for IFF_SLAVE as it is not necessary if the upper device is present. Signed-off-by: Long Li <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Leon Romanovsky <[email protected]> (cherry picked from commit a8445cf) Signed-off-by: Jonathan Maple <[email protected]> # Conflicts: # drivers/infiniband/hw/mana/mana_ib.h # drivers/net/ethernet/microsoft/mana/mana_en.c
1 parent fc00b36 commit 644c3f7

File tree

1 file changed

+127
-0
lines changed

1 file changed

+127
-0
lines changed
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
net: mana: Change the function signature of mana_get_primary_netdev_rcu
2+
3+
jira LE-4385
4+
Rebuild_History Non-Buildable kernel-5.14.0-570.52.1.el9_6
5+
commit-author Long Li <[email protected]>
6+
commit a8445cfec101c42e9d64cdb2dac13973b22c205c
7+
Empty-Commit: Cherry-Pick Conflicts during history rebuild.
8+
Will be included in final tarball splat. Ref for failed cherry-pick at:
9+
ciq/ciq_backports/kernel-5.14.0-570.52.1.el9_6/a8445cfe.failed
10+
11+
Change mana_get_primary_netdev_rcu() to mana_get_primary_netdev(), and
12+
return the ndev with refcount held. The caller is responsible for dropping
13+
the refcount.
14+
15+
Also drop the check for IFF_SLAVE as it is not necessary if the upper
16+
device is present.
17+
18+
Signed-off-by: Long Li <[email protected]>
19+
Link: https://patch.msgid.link/[email protected]
20+
Signed-off-by: Leon Romanovsky <[email protected]>
21+
(cherry picked from commit a8445cfec101c42e9d64cdb2dac13973b22c205c)
22+
Signed-off-by: Jonathan Maple <[email protected]>
23+
24+
# Conflicts:
25+
# drivers/infiniband/hw/mana/mana_ib.h
26+
# drivers/net/ethernet/microsoft/mana/mana_en.c
27+
diff --cc drivers/infiniband/hw/mana/mana_ib.h
28+
index c3c9dc1c8d8b,81a7e7474462..000000000000
29+
--- a/drivers/infiniband/hw/mana/mana_ib.h
30+
+++ b/drivers/infiniband/hw/mana/mana_ib.h
31+
@@@ -65,6 -77,8 +65,11 @@@ struct mana_ib_dev
32+
struct gdma_queue **eqs;
33+
struct xarray qp_table_wq;
34+
struct mana_ib_adapter_caps adapter_caps;
35+
++<<<<<<< HEAD
36+
++=======
37+
+ struct dma_pool *av_pool;
38+
+ netdevice_tracker dev_tracker;
39+
++>>>>>>> a8445cfec101 (net: mana: Change the function signature of mana_get_primary_netdev_rcu)
40+
};
41+
42+
struct mana_ib_wq {
43+
diff --cc drivers/net/ethernet/microsoft/mana/mana_en.c
44+
index 2f82b39f3002,4e870b11f946..000000000000
45+
--- a/drivers/net/ethernet/microsoft/mana/mana_en.c
46+
+++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
47+
@@@ -3170,24 -3129,29 +3170,34 @@@ out
48+
gd->driver_data = NULL;
49+
gd->gdma_context = NULL;
50+
kfree(ac);
51+
+ dev_dbg(dev, "%s succeeded\n", __func__);
52+
}
53+
54+
- struct net_device *mana_get_primary_netdev_rcu(struct mana_context *ac, u32 port_index)
55+
+ struct net_device *mana_get_primary_netdev(struct mana_context *ac,
56+
+ u32 port_index,
57+
+ netdevice_tracker *tracker)
58+
{
59+
struct net_device *ndev;
60+
61+
if (port_index >= ac->num_ports)
62+
return NULL;
63+
64+
- /* When mana is used in netvsc, the upper netdevice should be returned. */
65+
- if (ac->ports[port_index]->flags & IFF_SLAVE)
66+
- ndev = netdev_master_upper_dev_get_rcu(ac->ports[port_index]);
67+
- else
68+
+ rcu_read_lock();
69+
+
70+
+ /* If mana is used in netvsc, the upper netdevice should be returned. */
71+
+ ndev = netdev_master_upper_dev_get_rcu(ac->ports[port_index]);
72+
+
73+
+ /* If there is no upper device, use the parent Ethernet device */
74+
+ if (!ndev)
75+
ndev = ac->ports[port_index];
76+
77+
+ netdev_hold(ndev, tracker, GFP_ATOMIC);
78+
+ rcu_read_unlock();
79+
+
80+
return ndev;
81+
}
82+
++<<<<<<< HEAD
83+
+EXPORT_SYMBOL_NS(mana_get_primary_netdev_rcu, NET_MANA);
84+
++=======
85+
+ EXPORT_SYMBOL_NS(mana_get_primary_netdev, "NET_MANA");
86+
++>>>>>>> a8445cfec101 (net: mana: Change the function signature of mana_get_primary_netdev_rcu)
87+
diff --git a/drivers/infiniband/hw/mana/device.c b/drivers/infiniband/hw/mana/device.c
88+
index 50437272b7b9..16442d53ec8e 100644
89+
--- a/drivers/infiniband/hw/mana/device.c
90+
+++ b/drivers/infiniband/hw/mana/device.c
91+
@@ -85,10 +85,8 @@ static int mana_ib_probe(struct auxiliary_device *adev,
92+
dev->ib_dev.num_comp_vectors = mdev->gdma_context->max_num_queues;
93+
dev->ib_dev.dev.parent = mdev->gdma_context->dev;
94+
95+
- rcu_read_lock(); /* required to get primary netdev */
96+
- ndev = mana_get_primary_netdev_rcu(mc, 0);
97+
+ ndev = mana_get_primary_netdev(mc, 0, &dev->dev_tracker);
98+
if (!ndev) {
99+
- rcu_read_unlock();
100+
ret = -ENODEV;
101+
ibdev_err(&dev->ib_dev, "Failed to get netdev for IB port 1");
102+
goto free_ib_device;
103+
@@ -96,7 +94,8 @@ static int mana_ib_probe(struct auxiliary_device *adev,
104+
ether_addr_copy(mac_addr, ndev->dev_addr);
105+
addrconf_addr_eui48((u8 *)&dev->ib_dev.node_guid, ndev->dev_addr);
106+
ret = ib_device_set_netdev(&dev->ib_dev, ndev, 1);
107+
- rcu_read_unlock();
108+
+ /* mana_get_primary_netdev() returns ndev with refcount held */
109+
+ netdev_put(ndev, &dev->dev_tracker);
110+
if (ret) {
111+
ibdev_err(&dev->ib_dev, "Failed to set ib netdev, ret %d", ret);
112+
goto free_ib_device;
113+
* Unmerged path drivers/infiniband/hw/mana/mana_ib.h
114+
* Unmerged path drivers/net/ethernet/microsoft/mana/mana_en.c
115+
diff --git a/include/net/mana/mana.h b/include/net/mana/mana.h
116+
index 301785a934b2..5283276c2def 100644
117+
--- a/include/net/mana/mana.h
118+
+++ b/include/net/mana/mana.h
119+
@@ -825,5 +825,7 @@ int mana_cfg_vport(struct mana_port_context *apc, u32 protection_dom_id,
120+
u32 doorbell_pg_id);
121+
void mana_uncfg_vport(struct mana_port_context *apc);
122+
123+
-struct net_device *mana_get_primary_netdev_rcu(struct mana_context *ac, u32 port_index);
124+
+struct net_device *mana_get_primary_netdev(struct mana_context *ac,
125+
+ u32 port_index,
126+
+ netdevice_tracker *tracker);
127+
#endif /* _MANA_H */

0 commit comments

Comments
 (0)