Commit 04340645 authored by Kamal Heib's avatar Kamal Heib Committed by Jason Gunthorpe

RDMA/siw: Fix reporting vendor_part_id

Move the initialization of the vendor_part_id to be before calling
ib_register_device(), this is needed because the query_device() callback
is called from the context of ib_register_device() before initializing the
vendor_part_id, so the reported value is wrong.

Fixes: bdcf26bf ("rdma/siw: network and RDMA core interface")
Link: https://lore.kernel.org/r/20200707130931.444724-1-kamalheib1@gmail.comSigned-off-by: default avatarKamal Heib <kamalheib1@gmail.com>
Reviewed-by: default avatarBernard Metzler <bmt@zurich.ibm.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent f427f4d6
...@@ -67,12 +67,13 @@ static int siw_device_register(struct siw_device *sdev, const char *name) ...@@ -67,12 +67,13 @@ static int siw_device_register(struct siw_device *sdev, const char *name)
static int dev_id = 1; static int dev_id = 1;
int rv; int rv;
sdev->vendor_part_id = dev_id++;
rv = ib_register_device(base_dev, name); rv = ib_register_device(base_dev, name);
if (rv) { if (rv) {
pr_warn("siw: device registration error %d\n", rv); pr_warn("siw: device registration error %d\n", rv);
return rv; return rv;
} }
sdev->vendor_part_id = dev_id++;
siw_dbg(base_dev, "HWaddr=%pM\n", sdev->netdev->dev_addr); siw_dbg(base_dev, "HWaddr=%pM\n", sdev->netdev->dev_addr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment