Commit 43c7c851 authored by Jason Gunthorpe's avatar Jason Gunthorpe

RDMA/core: Use dev_err/dbg/etc instead of pr_* + ibdev->name

Any messages related to a device should be printed with the dev_*
formatters. This provides greater consistency for the user.

The core does not set pr_fmt so this has no significant change.
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
Reviewed-by: default avatarSteve Wise <swise@opengridcomputing.com>
Reviewed-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Reviewed-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
parent e349f858
...@@ -212,9 +212,8 @@ static void free_gid_entry_locked(struct ib_gid_table_entry *entry) ...@@ -212,9 +212,8 @@ static void free_gid_entry_locked(struct ib_gid_table_entry *entry)
u8 port_num = entry->attr.port_num; u8 port_num = entry->attr.port_num;
struct ib_gid_table *table = rdma_gid_table(device, port_num); struct ib_gid_table *table = rdma_gid_table(device, port_num);
pr_debug("%s device=%s port=%d index=%d gid %pI6\n", __func__, dev_dbg(&device->dev, "%s port=%d index=%d gid %pI6\n", __func__,
device->name, port_num, entry->attr.index, port_num, entry->attr.index, entry->attr.gid.raw);
entry->attr.gid.raw);
if (rdma_cap_roce_gid_table(device, port_num) && if (rdma_cap_roce_gid_table(device, port_num) &&
entry->state != GID_TABLE_ENTRY_INVALID) entry->state != GID_TABLE_ENTRY_INVALID)
...@@ -289,9 +288,9 @@ static void store_gid_entry(struct ib_gid_table *table, ...@@ -289,9 +288,9 @@ static void store_gid_entry(struct ib_gid_table *table,
{ {
entry->state = GID_TABLE_ENTRY_VALID; entry->state = GID_TABLE_ENTRY_VALID;
pr_debug("%s device=%s port=%d index=%d gid %pI6\n", __func__, dev_dbg(&entry->attr.device->dev, "%s port=%d index=%d gid %pI6\n",
entry->attr.device->name, entry->attr.port_num, __func__, entry->attr.port_num, entry->attr.index,
entry->attr.index, entry->attr.gid.raw); entry->attr.gid.raw);
lockdep_assert_held(&table->lock); lockdep_assert_held(&table->lock);
write_lock_irq(&table->rwlock); write_lock_irq(&table->rwlock);
...@@ -320,17 +319,16 @@ static int add_roce_gid(struct ib_gid_table_entry *entry) ...@@ -320,17 +319,16 @@ static int add_roce_gid(struct ib_gid_table_entry *entry)
int ret; int ret;
if (!attr->ndev) { if (!attr->ndev) {
pr_err("%s NULL netdev device=%s port=%d index=%d\n", dev_err(&attr->device->dev, "%s NULL netdev port=%d index=%d\n",
__func__, attr->device->name, attr->port_num, __func__, attr->port_num, attr->index);
attr->index);
return -EINVAL; return -EINVAL;
} }
if (rdma_cap_roce_gid_table(attr->device, attr->port_num)) { if (rdma_cap_roce_gid_table(attr->device, attr->port_num)) {
ret = attr->device->add_gid(attr, &entry->context); ret = attr->device->add_gid(attr, &entry->context);
if (ret) { if (ret) {
pr_err("%s GID add failed device=%s port=%d index=%d\n", dev_err(&attr->device->dev,
__func__, attr->device->name, attr->port_num, "%s GID add failed port=%d index=%d\n",
attr->index); __func__, attr->port_num, attr->index);
return ret; return ret;
} }
} }
...@@ -402,9 +400,8 @@ static void del_gid(struct ib_device *ib_dev, u8 port, ...@@ -402,9 +400,8 @@ static void del_gid(struct ib_device *ib_dev, u8 port,
lockdep_assert_held(&table->lock); lockdep_assert_held(&table->lock);
pr_debug("%s device=%s port=%d index=%d gid %pI6\n", __func__, dev_dbg(&ib_dev->dev, "%s port=%d index=%d gid %pI6\n", __func__, port,
ib_dev->name, port, ix, ix, table->data_vec[ix]->attr.gid.raw);
table->data_vec[ix]->attr.gid.raw);
write_lock_irq(&table->rwlock); write_lock_irq(&table->rwlock);
entry = table->data_vec[ix]; entry = table->data_vec[ix];
...@@ -782,8 +779,8 @@ static void release_gid_table(struct ib_device *device, u8 port, ...@@ -782,8 +779,8 @@ static void release_gid_table(struct ib_device *device, u8 port,
if (is_gid_entry_free(table->data_vec[i])) if (is_gid_entry_free(table->data_vec[i]))
continue; continue;
if (kref_read(&table->data_vec[i]->kref) > 1) { if (kref_read(&table->data_vec[i]->kref) > 1) {
pr_err("GID entry ref leak for %s (index %d) ref=%d\n", dev_err(&device->dev,
device->name, i, "GID entry ref leak for index %d ref=%d\n", i,
kref_read(&table->data_vec[i]->kref)); kref_read(&table->data_vec[i]->kref));
leak = true; leak = true;
} }
...@@ -1303,8 +1300,9 @@ static int config_non_roce_gid_cache(struct ib_device *device, ...@@ -1303,8 +1300,9 @@ static int config_non_roce_gid_cache(struct ib_device *device,
continue; continue;
ret = device->query_gid(device, port, i, &gid_attr.gid); ret = device->query_gid(device, port, i, &gid_attr.gid);
if (ret) { if (ret) {
pr_warn("query_gid failed (%d) for %s (index %d)\n", dev_warn(&device->dev,
ret, device->name, i); "query_gid failed (%d) for index %d\n", ret,
i);
goto err; goto err;
} }
gid_attr.index = i; gid_attr.index = i;
...@@ -1333,8 +1331,7 @@ static void ib_cache_update(struct ib_device *device, ...@@ -1333,8 +1331,7 @@ static void ib_cache_update(struct ib_device *device,
ret = ib_query_port(device, port, tprops); ret = ib_query_port(device, port, tprops);
if (ret) { if (ret) {
pr_warn("ib_query_port failed (%d) for %s\n", dev_warn(&device->dev, "ib_query_port failed (%d)\n", ret);
ret, device->name);
goto err; goto err;
} }
...@@ -1356,8 +1353,9 @@ static void ib_cache_update(struct ib_device *device, ...@@ -1356,8 +1353,9 @@ static void ib_cache_update(struct ib_device *device,
for (i = 0; i < pkey_cache->table_len; ++i) { for (i = 0; i < pkey_cache->table_len; ++i) {
ret = ib_query_pkey(device, port, i, pkey_cache->table + i); ret = ib_query_pkey(device, port, i, pkey_cache->table + i);
if (ret) { if (ret) {
pr_warn("ib_query_pkey failed (%d) for %s (index %d)\n", dev_warn(&device->dev,
ret, device->name, i); "ib_query_pkey failed (%d) for index %d\n",
ret, i);
goto err; goto err;
} }
} }
......
...@@ -2352,8 +2352,8 @@ static void cma_listen_on_dev(struct rdma_id_private *id_priv, ...@@ -2352,8 +2352,8 @@ static void cma_listen_on_dev(struct rdma_id_private *id_priv,
ret = rdma_listen(id, id_priv->backlog); ret = rdma_listen(id, id_priv->backlog);
if (ret) if (ret)
pr_warn("RDMA CMA: cma_listen_on_dev, error %d, listening on device %s\n", dev_warn(&cma_dev->device->dev,
ret, cma_dev->device->name); "RDMA CMA: cma_listen_on_dev, error %d\n", ret);
} }
static void cma_listen_on_all(struct rdma_id_private *id_priv) static void cma_listen_on_all(struct rdma_id_private *id_priv)
...@@ -4082,9 +4082,10 @@ static int cma_join_ib_multicast(struct rdma_id_private *id_priv, ...@@ -4082,9 +4082,10 @@ static int cma_join_ib_multicast(struct rdma_id_private *id_priv,
(!ib_sa_sendonly_fullmem_support(&sa_client, (!ib_sa_sendonly_fullmem_support(&sa_client,
id_priv->id.device, id_priv->id.device,
id_priv->id.port_num))) { id_priv->id.port_num))) {
pr_warn("RDMA CM: %s port %u Unable to multicast join\n" dev_warn(
"RDMA CM: SM doesn't support Send Only Full Member option\n", &id_priv->id.device->dev,
id_priv->id.device->name, id_priv->id.port_num); "RDMA CM: port %u Unable to multicast join: SM doesn't support Send Only Full Member option\n",
id_priv->id.port_num);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
......
...@@ -123,8 +123,9 @@ static int ib_device_check_mandatory(struct ib_device *device) ...@@ -123,8 +123,9 @@ static int ib_device_check_mandatory(struct ib_device *device)
for (i = 0; i < ARRAY_SIZE(mandatory_table); ++i) { for (i = 0; i < ARRAY_SIZE(mandatory_table); ++i) {
if (!*(void **) ((void *) device + mandatory_table[i].offset)) { if (!*(void **) ((void *) device + mandatory_table[i].offset)) {
pr_warn("Device %s is missing mandatory function %s\n", dev_warn(&device->dev,
device->name, mandatory_table[i].name); "Device is missing mandatory function %s\n",
mandatory_table[i].name);
return -EINVAL; return -EINVAL;
} }
} }
...@@ -513,20 +514,21 @@ int ib_register_device(struct ib_device *device, const char *name, ...@@ -513,20 +514,21 @@ int ib_register_device(struct ib_device *device, const char *name,
ret = read_port_immutable(device); ret = read_port_immutable(device);
if (ret) { if (ret) {
pr_warn("Couldn't create per port immutable data %s\n", dev_warn(&device->dev,
device->name); "Couldn't create per port immutable data\n");
goto out; goto out;
} }
ret = setup_port_pkey_list(device); ret = setup_port_pkey_list(device);
if (ret) { if (ret) {
pr_warn("Couldn't create per port_pkey_list\n"); dev_warn(&device->dev, "Couldn't create per port_pkey_list\n");
goto out; goto out;
} }
ret = ib_cache_setup_one(device); ret = ib_cache_setup_one(device);
if (ret) { if (ret) {
pr_warn("Couldn't set up InfiniBand P_Key/GID cache\n"); dev_warn(&device->dev,
"Couldn't set up InfiniBand P_Key/GID cache\n");
goto port_cleanup; goto port_cleanup;
} }
...@@ -534,21 +536,23 @@ int ib_register_device(struct ib_device *device, const char *name, ...@@ -534,21 +536,23 @@ int ib_register_device(struct ib_device *device, const char *name,
ret = ib_device_register_rdmacg(device); ret = ib_device_register_rdmacg(device);
if (ret) { if (ret) {
pr_warn("Couldn't register device with rdma cgroup\n"); dev_warn(&device->dev,
"Couldn't register device with rdma cgroup\n");
goto cache_cleanup; goto cache_cleanup;
} }
memset(&device->attrs, 0, sizeof(device->attrs)); memset(&device->attrs, 0, sizeof(device->attrs));
ret = device->query_device(device, &device->attrs, &uhw); ret = device->query_device(device, &device->attrs, &uhw);
if (ret) { if (ret) {
pr_warn("Couldn't query the device attributes\n"); dev_warn(&device->dev,
"Couldn't query the device attributes\n");
goto cg_cleanup; goto cg_cleanup;
} }
ret = ib_device_register_sysfs(device, port_callback); ret = ib_device_register_sysfs(device, port_callback);
if (ret) { if (ret) {
pr_warn("Couldn't register device %s with driver model\n", dev_warn(&device->dev,
device->name); "Couldn't register device with driver model\n");
goto cg_cleanup; goto cg_cleanup;
} }
...@@ -699,8 +703,9 @@ void ib_unregister_client(struct ib_client *client) ...@@ -699,8 +703,9 @@ void ib_unregister_client(struct ib_client *client)
found_context->data : NULL); found_context->data : NULL);
if (!found_context) { if (!found_context) {
pr_warn("No client context found for %s/%s\n", dev_warn(&device->dev,
device->name, client->name); "No client context found for %s\n",
client->name);
continue; continue;
} }
...@@ -764,8 +769,8 @@ void ib_set_client_data(struct ib_device *device, struct ib_client *client, ...@@ -764,8 +769,8 @@ void ib_set_client_data(struct ib_device *device, struct ib_client *client,
goto out; goto out;
} }
pr_warn("No client context found for %s/%s\n", dev_warn(&device->dev, "No client context found for %s\n",
device->name, client->name); client->name);
out: out:
write_unlock_irqrestore(&device->client_data_lock, flags); write_unlock_irqrestore(&device->client_data_lock, flags);
......
...@@ -213,7 +213,7 @@ struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd, ...@@ -213,7 +213,7 @@ struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd,
device = pd->device; device = pd->device;
if (!device->alloc_fmr || !device->dealloc_fmr || if (!device->alloc_fmr || !device->dealloc_fmr ||
!device->map_phys_fmr || !device->unmap_fmr) { !device->map_phys_fmr || !device->unmap_fmr) {
pr_info(PFX "Device %s does not support FMRs\n", device->name); dev_info(&device->dev, "Device does not support FMRs\n");
return ERR_PTR(-ENOSYS); return ERR_PTR(-ENOSYS);
} }
......
...@@ -50,8 +50,7 @@ void rdma_restrack_clean(struct rdma_restrack_root *res) ...@@ -50,8 +50,7 @@ void rdma_restrack_clean(struct rdma_restrack_root *res)
dev = container_of(res, struct ib_device, res); dev = container_of(res, struct ib_device, res);
pr_err("restrack: %s", CUT_HERE); pr_err("restrack: %s", CUT_HERE);
pr_err("restrack: BUG: RESTRACK detected leak of resources on %s\n", dev_err(&dev->dev, "BUG: RESTRACK detected leak of resources\n");
dev->name);
hash_for_each(res->hash, bkt, e, node) { hash_for_each(res->hash, bkt, e, node) {
if (rdma_is_kernel_res(e)) { if (rdma_is_kernel_res(e)) {
owner = e->kern_name; owner = e->kern_name;
......
...@@ -1629,14 +1629,16 @@ static int _ib_modify_qp(struct ib_qp *qp, struct ib_qp_attr *attr, ...@@ -1629,14 +1629,16 @@ static int _ib_modify_qp(struct ib_qp *qp, struct ib_qp_attr *attr,
if (rdma_ib_or_roce(qp->device, port)) { if (rdma_ib_or_roce(qp->device, port)) {
if (attr_mask & IB_QP_RQ_PSN && attr->rq_psn & ~0xffffff) { if (attr_mask & IB_QP_RQ_PSN && attr->rq_psn & ~0xffffff) {
pr_warn("%s: %s rq_psn overflow, masking to 24 bits\n", dev_warn(&qp->device->dev,
__func__, qp->device->name); "%s rq_psn overflow, masking to 24 bits\n",
__func__);
attr->rq_psn &= 0xffffff; attr->rq_psn &= 0xffffff;
} }
if (attr_mask & IB_QP_SQ_PSN && attr->sq_psn & ~0xffffff) { if (attr_mask & IB_QP_SQ_PSN && attr->sq_psn & ~0xffffff) {
pr_warn("%s: %s sq_psn overflow, masking to 24 bits\n", dev_warn(&qp->device->dev,
__func__, qp->device->name); " %s sq_psn overflow, masking to 24 bits\n",
__func__);
attr->sq_psn &= 0xffffff; attr->sq_psn &= 0xffffff;
} }
} }
......
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