Skip to content

Commit f96450e

Browse files
committed
RDMA/mana_ib: Handle net event for pointing to the current netdev
jira LE-4365 Rebuild_History Non-Buildable kernel-6.12.0-55.38.1.el10_0 commit-author Long Li <longli@microsoft.com> commit bee35b7 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-6.12.0-55.38.1.el10_0/bee35b71.failed When running under Hyper-V, the master device to the RDMA device is always bonded to this RDMA device. This is not user-configurable. The master device can be unbind/bind from the kernel. During those events, the RDMA device should set to the current netdev to reflect the change of master device from those events. Signed-off-by: Long Li <longli@microsoft.com> Link: https://patch.msgid.link/1741821332-9392-2-git-send-email-longli@linuxonhyperv.com Signed-off-by: Leon Romanovsky <leon@kernel.org> (cherry picked from commit bee35b7) Signed-off-by: Jonathan Maple <jmaple@ciq.com> # Conflicts: # drivers/infiniband/hw/mana/device.c # drivers/infiniband/hw/mana/mana_ib.h
1 parent 8f0db56 commit f96450e

File tree

1 file changed

+109
-0
lines changed

1 file changed

+109
-0
lines changed
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
RDMA/mana_ib: Handle net event for pointing to the current netdev
2+
3+
jira LE-4365
4+
Rebuild_History Non-Buildable kernel-6.12.0-55.38.1.el10_0
5+
commit-author Long Li <longli@microsoft.com>
6+
commit bee35b7161aaaed9831e2f14876c374b9c566952
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-6.12.0-55.38.1.el10_0/bee35b71.failed
10+
11+
When running under Hyper-V, the master device to the RDMA device is always
12+
bonded to this RDMA device. This is not user-configurable.
13+
14+
The master device can be unbind/bind from the kernel. During those events,
15+
the RDMA device should set to the current netdev to reflect the change of
16+
master device from those events.
17+
18+
Signed-off-by: Long Li <longli@microsoft.com>
19+
Link: https://patch.msgid.link/1741821332-9392-2-git-send-email-longli@linuxonhyperv.com
20+
Signed-off-by: Leon Romanovsky <leon@kernel.org>
21+
(cherry picked from commit bee35b7161aaaed9831e2f14876c374b9c566952)
22+
Signed-off-by: Jonathan Maple <jmaple@ciq.com>
23+
24+
# Conflicts:
25+
# drivers/infiniband/hw/mana/device.c
26+
# drivers/infiniband/hw/mana/mana_ib.h
27+
diff --cc drivers/infiniband/hw/mana/device.c
28+
index 7ac01918ef7c,b31089320aa5..000000000000
29+
--- a/drivers/infiniband/hw/mana/device.c
30+
+++ b/drivers/infiniband/hw/mana/device.c
31+
@@@ -51,6 -60,43 +51,46 @@@ static const struct ib_device_ops mana_
32+
ib_ind_table),
33+
};
34+
35+
++<<<<<<< HEAD
36+
++=======
37+
+ static const struct ib_device_ops mana_ib_stats_ops = {
38+
+ .alloc_hw_port_stats = mana_ib_alloc_hw_port_stats,
39+
+ .get_hw_stats = mana_ib_get_hw_stats,
40+
+ };
41+
+
42+
+ static int mana_ib_netdev_event(struct notifier_block *this,
43+
+ unsigned long event, void *ptr)
44+
+ {
45+
+ struct mana_ib_dev *dev = container_of(this, struct mana_ib_dev, nb);
46+
+ struct net_device *event_dev = netdev_notifier_info_to_dev(ptr);
47+
+ struct gdma_context *gc = dev->gdma_dev->gdma_context;
48+
+ struct mana_context *mc = gc->mana.driver_data;
49+
+ struct net_device *ndev;
50+
+
51+
+ /* Only process events from our parent device */
52+
+ if (event_dev != mc->ports[0])
53+
+ return NOTIFY_DONE;
54+
+
55+
+ switch (event) {
56+
+ case NETDEV_CHANGEUPPER:
57+
+ ndev = mana_get_primary_netdev(mc, 0, &dev->dev_tracker);
58+
+ /*
59+
+ * RDMA core will setup GID based on updated netdev.
60+
+ * It's not possible to race with the core as rtnl lock is being
61+
+ * held.
62+
+ */
63+
+ ib_device_set_netdev(&dev->ib_dev, ndev, 1);
64+
+
65+
+ /* mana_get_primary_netdev() returns ndev with refcount held */
66+
+ netdev_put(ndev, &dev->dev_tracker);
67+
+
68+
+ return NOTIFY_OK;
69+
+ default:
70+
+ return NOTIFY_DONE;
71+
+ }
72+
+ }
73+
+
74+
++>>>>>>> bee35b7161aa (RDMA/mana_ib: Handle net event for pointing to the current netdev)
75+
static int mana_ib_probe(struct auxiliary_device *adev,
76+
const struct auxiliary_device_id *id)
77+
{
78+
@@@ -113,9 -166,11 +161,9 @@@
79+
if (ret) {
80+
ibdev_err(&dev->ib_dev, "Failed to query device caps, ret %d",
81+
ret);
82+
- goto deregister_device;
83+
+ goto deregister_net_notifier;
84+
}
85+
86+
- ib_set_device_ops(&dev->ib_dev, &mana_ib_stats_ops);
87+
-
88+
ret = mana_ib_create_eqs(dev);
89+
if (ret) {
90+
ibdev_err(&dev->ib_dev, "Failed to create EQs, ret %d", ret);
91+
diff --cc drivers/infiniband/hw/mana/mana_ib.h
92+
index c3c9dc1c8d8b,6903946677e5..000000000000
93+
--- a/drivers/infiniband/hw/mana/mana_ib.h
94+
+++ b/drivers/infiniband/hw/mana/mana_ib.h
95+
@@@ -65,6 -77,9 +65,12 @@@ struct mana_ib_dev
96+
struct gdma_queue **eqs;
97+
struct xarray qp_table_wq;
98+
struct mana_ib_adapter_caps adapter_caps;
99+
++<<<<<<< HEAD
100+
++=======
101+
+ struct dma_pool *av_pool;
102+
+ netdevice_tracker dev_tracker;
103+
+ struct notifier_block nb;
104+
++>>>>>>> bee35b7161aa (RDMA/mana_ib: Handle net event for pointing to the current netdev)
105+
};
106+
107+
struct mana_ib_wq {
108+
* Unmerged path drivers/infiniband/hw/mana/device.c
109+
* Unmerged path drivers/infiniband/hw/mana/mana_ib.h

0 commit comments

Comments
 (0)