RDMA/rxe: Add ib_device_get_by_name() and use it in rxe

rxe has an open coded version of this that is not as safe as the core
version. This lets us eliminate the internal device list entirely from
rxe.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
Jason Gunthorpe
2019-02-12 21:12:55 -07:00
parent c367074b6c
commit 6cc2c8e535
6 changed files with 32 additions and 33 deletions

View File

@@ -101,7 +101,7 @@ static int rxe_param_set_remove(const char *val, const struct kernel_param *kp)
{
int len;
char intf[32];
struct rxe_dev *rxe;
struct ib_device *ib_dev;
len = sanitize_arg(val, intf, sizeof(intf));
if (!len) {
@@ -115,14 +115,13 @@ static int rxe_param_set_remove(const char *val, const struct kernel_param *kp)
return 0;
}
rxe = get_rxe_by_name(intf);
if (!rxe) {
ib_dev = ib_device_get_by_name(intf, RDMA_DRIVER_RXE);
if (!ib_dev) {
pr_err("not configured on %s\n", intf);
return -EINVAL;
}
ib_unregister_device(&rxe->ib_dev);
ib_unregister_device_and_put(ib_dev);
return 0;
}