Skip to content

Commit 8ce2eb9

Browse files
zhuyjrleon
authored andcommitted
RDMA/rxe: Fix the failure of ibv_query_device() and ibv_query_device_ex() tests
In rdma-core, the following failures appear. " $ ./build/bin/run_tests.py -k device ssssssss....FF........s ====================================================================== FAIL: test_query_device (tests.test_device.DeviceTest.test_query_device) Test ibv_query_device() ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/ubuntu/rdma-core/tests/test_device.py", line 63, in test_query_device self.verify_device_attr(attr, dev) File "/home/ubuntu/rdma-core/tests/test_device.py", line 200, in verify_device_attr assert attr.sys_image_guid != 0 ^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError ====================================================================== FAIL: test_query_device_ex (tests.test_device.DeviceTest.test_query_device_ex) Test ibv_query_device_ex() ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/ubuntu/rdma-core/tests/test_device.py", line 222, in test_query_device_ex self.verify_device_attr(attr_ex.orig_attr, dev) File "/home/ubuntu/rdma-core/tests/test_device.py", line 200, in verify_device_attr assert attr.sys_image_guid != 0 ^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError " The root cause is: before a net device is set with rxe, this net device is used to generate a sys_image_guid. Fixes: 2ac5415 ("RDMA/rxe: Remove the direct link to net_device") Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev> Link: https://patch.msgid.link/20250302215444.3742072-1-yanjun.zhu@linux.dev Reviewed-by: Daisuke Matsuda <matsuda-daisuke@fujitsu.com> Tested-by: Daisuke Matsuda <matsuda-daisuke@fujitsu.com> Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent b665353 commit 8ce2eb9

File tree

1 file changed

+6
-19
lines changed
  • drivers/infiniband/sw/rxe

1 file changed

+6
-19
lines changed

drivers/infiniband/sw/rxe/rxe.c

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@ void rxe_dealloc(struct ib_device *ib_dev)
3838
}
3939

4040
/* initialize rxe device parameters */
41-
static void rxe_init_device_param(struct rxe_dev *rxe)
41+
static void rxe_init_device_param(struct rxe_dev *rxe, struct net_device *ndev)
4242
{
43-
struct net_device *ndev;
44-
4543
rxe->max_inline_data = RXE_MAX_INLINE_DATA;
4644

4745
rxe->attr.vendor_id = RXE_VENDOR_ID;
@@ -74,15 +72,9 @@ static void rxe_init_device_param(struct rxe_dev *rxe)
7472
rxe->attr.max_pkeys = RXE_MAX_PKEYS;
7573
rxe->attr.local_ca_ack_delay = RXE_LOCAL_CA_ACK_DELAY;
7674

77-
ndev = rxe_ib_device_get_netdev(&rxe->ib_dev);
78-
if (!ndev)
79-
return;
80-
8175
addrconf_addr_eui48((unsigned char *)&rxe->attr.sys_image_guid,
8276
ndev->dev_addr);
8377

84-
dev_put(ndev);
85-
8678
rxe->max_ucontext = RXE_MAX_UCONTEXT;
8779
}
8880

@@ -115,18 +107,13 @@ static void rxe_init_port_param(struct rxe_port *port)
115107
/* initialize port state, note IB convention that HCA ports are always
116108
* numbered from 1
117109
*/
118-
static void rxe_init_ports(struct rxe_dev *rxe)
110+
static void rxe_init_ports(struct rxe_dev *rxe, struct net_device *ndev)
119111
{
120112
struct rxe_port *port = &rxe->port;
121-
struct net_device *ndev;
122113

123114
rxe_init_port_param(port);
124-
ndev = rxe_ib_device_get_netdev(&rxe->ib_dev);
125-
if (!ndev)
126-
return;
127115
addrconf_addr_eui48((unsigned char *)&port->port_guid,
128116
ndev->dev_addr);
129-
dev_put(ndev);
130117
spin_lock_init(&port->port_lock);
131118
}
132119

@@ -144,12 +131,12 @@ static void rxe_init_pools(struct rxe_dev *rxe)
144131
}
145132

146133
/* initialize rxe device state */
147-
static void rxe_init(struct rxe_dev *rxe)
134+
static void rxe_init(struct rxe_dev *rxe, struct net_device *ndev)
148135
{
149136
/* init default device parameters */
150-
rxe_init_device_param(rxe);
137+
rxe_init_device_param(rxe, ndev);
151138

152-
rxe_init_ports(rxe);
139+
rxe_init_ports(rxe, ndev);
153140
rxe_init_pools(rxe);
154141

155142
/* init pending mmap list */
@@ -184,7 +171,7 @@ void rxe_set_mtu(struct rxe_dev *rxe, unsigned int ndev_mtu)
184171
int rxe_add(struct rxe_dev *rxe, unsigned int mtu, const char *ibdev_name,
185172
struct net_device *ndev)
186173
{
187-
rxe_init(rxe);
174+
rxe_init(rxe, ndev);
188175
rxe_set_mtu(rxe, mtu);
189176

190177
return rxe_register_device(rxe, ibdev_name, ndev);

0 commit comments

Comments
 (0)