RDMA/rxe: Fix the failure of ibv_query_device() and ibv_query_device_ex() tests
Subsystems (2)
PATCH v2 1/1 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.
The solution is from siw commit bad5b6e34ffb ("RDMA/siw: Fabricate a GID on tun and loopback devices").
---
V1 -- > V2: Keep dev_addr as raw_gid
--- drivers/infiniband/sw/rxe/rxe.c | 23 ----------------------- drivers/infiniband/sw/rxe/rxe_verbs.c | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 23 deletions(-)
drivers/infiniband/sw/rxe/rxe.c +0 -23
@@ -37,8 +37,6 @@ void rxe_dealloc(struct ib_device *ib_dev)/* initialize rxe device parameters */ static void rxe_init_device_param (struct rxe_dev *rxe) { -struct net_device *ndev; - rxe->max_inline_data =RXE_MAX_INLINE_DATA ; rxe->attr.vendor_id =RXE_VENDOR_ID ;
@@ -70,27 +68,6 @@ static void rxe_init_device_param(struct rxe_dev *rxe) rxe->attr.max_fast_reg_page_list_len =RXE_MAX_FMR_PAGE_LIST_LEN ; rxe->attr.max_pkeys =RXE_MAX_PKEYS ; rxe->attr.local_ca_ack_delay =RXE_LOCAL_CA_ACK_DELAY ; - - ndev =rxe_ib_device_get_netdev (&rxe->ib_dev); -if (!ndev) -return ; - -if (ndev->addr_len) { -memcpy (rxe->raw_gid, ndev->dev_addr, - min_t(unsigned int, ndev->addr_len, ETH_ALEN)); - }else { -/* -* This device does not have a HW address, but -* connection mangagement requires a unique gid. -*/ -eth_random_addr (rxe->raw_gid); - } - -addrconf_addr_eui48 ((unsigned char *)&rxe->attr.sys_image_guid, - rxe->raw_gid); - -dev_put (ndev); - rxe->max_ucontext =RXE_MAX_UCONTEXT ;if (IS_ENABLED (CONFIG_INFINIBAND_ON_DEMAND_PAGING )) {
drivers/infiniband/sw/rxe/rxe_verbs.c +14 -0
@@ -1549,6 +1549,20 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name,if (err)return err; +if (ndev->addr_len) { +memcpy (rxe->raw_gid, ndev->dev_addr, + min_t(unsigned int, ndev->addr_len, ETH_ALEN)); + }else { +/* +* This device does not have a HW address, but +* connection mangagement requires a unique gid. +*/ +eth_random_addr (rxe->raw_gid); + } + +addrconf_addr_eui48 ((unsigned char *)&rxe->attr.sys_image_guid, + rxe->raw_gid); + err =ib_register_device (dev, ibdev_name,NULL );if (err)rxe_dbg_dev (rxe,"failed with error %d\n" , err);
Signature · 1 line
2.34.1