linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-next 0/7] RDMA: Remove query_pkey from iwarp providers
@ 2020-07-14  8:10 Kamal Heib
  2020-07-14  8:10 ` [PATCH for-next 1/7] RDMA/core: Expose pkeys sysfs files only if pkey_tbl_len is set Kamal Heib
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: Kamal Heib @ 2020-07-14  8:10 UTC (permalink / raw)
  To: linux-rdma
  Cc: Doug Ledford, Jason Gunthorpe, Michal Kalderon,
	Potnuri Bharat Teja, Shiraz Saleem, Bernard Metzler, Kamal Heib

This patch set does the following:
1- Avoid exposing the pkeys sysfs entries for iwarp providers.
2- Avoid allocating the pkey cache for iwarp providers.
3- Remove the requirement by RDMA core to implement query_pkey
   by all providers.
4- Remove the implementation of query_pkey callback from iwarp providers.

Kamal Heib (7):
  RDMA/core: Expose pkeys sysfs files only if pkey_tbl_len is set
  RDMA/core: Allocate the pkey cache only if the pkey_tbl_len is set
  RDMA/core: Remove query_pkey from the mandatory ops
  RDMA/siw: Remove the query_pkey callback
  RDMA/cxgb4: Remove the query_pkey callback
  RDMA/i40iw: Remove the query_pkey callback
  RDMA/qedr: Remove the query_pkey callback

 drivers/infiniband/core/cache.c           | 45 ++++++++++------
 drivers/infiniband/core/device.c          |  4 +-
 drivers/infiniband/core/sysfs.c           | 64 ++++++++++++++++-------
 drivers/infiniband/hw/cxgb4/provider.c    | 11 ----
 drivers/infiniband/hw/i40iw/i40iw_verbs.c | 19 -------
 drivers/infiniband/hw/qedr/main.c         |  3 +-
 drivers/infiniband/hw/qedr/verbs.c        |  1 -
 drivers/infiniband/sw/siw/siw_main.c      |  1 -
 drivers/infiniband/sw/siw/siw_verbs.c     |  9 ----
 drivers/infiniband/sw/siw/siw_verbs.h     |  1 -
 10 files changed, 77 insertions(+), 81 deletions(-)

-- 
2.25.4


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH for-next 1/7] RDMA/core: Expose pkeys sysfs files only if pkey_tbl_len is set
  2020-07-14  8:10 [PATCH for-next 0/7] RDMA: Remove query_pkey from iwarp providers Kamal Heib
@ 2020-07-14  8:10 ` Kamal Heib
  2020-07-14  8:10 ` [PATCH for-next 2/7] RDMA/core: Allocate the pkey cache only if the " Kamal Heib
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Kamal Heib @ 2020-07-14  8:10 UTC (permalink / raw)
  To: linux-rdma
  Cc: Doug Ledford, Jason Gunthorpe, Michal Kalderon,
	Potnuri Bharat Teja, Shiraz Saleem, Bernard Metzler, Kamal Heib

Expose the pkeys sysfs files only if the pkey_tbl_len is set by the
providers.

Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
 drivers/infiniband/core/sysfs.c | 64 ++++++++++++++++++++++-----------
 1 file changed, 44 insertions(+), 20 deletions(-)

diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index defe9cd4c5ee..a7bca62a622e 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -58,7 +58,7 @@ struct ib_port {
 	struct ib_device      *ibdev;
 	struct gid_attr_group *gid_attr_group;
 	struct attribute_group gid_group;
-	struct attribute_group pkey_group;
+	struct attribute_group *pkey_group;
 	struct attribute_group *pma_table;
 	struct attribute_group *hw_stats_ag;
 	struct rdma_hw_stats   *hw_stats;
@@ -681,11 +681,13 @@ static void ib_port_release(struct kobject *kobj)
 		kfree(p->gid_group.attrs);
 	}
 
-	if (p->pkey_group.attrs) {
-		for (i = 0; (a = p->pkey_group.attrs[i]); ++i)
-			kfree(a);
+	if (p->pkey_group) {
+		if (p->pkey_group->attrs) {
+			for (i = 0; (a = p->pkey_group->attrs[i]); ++i)
+				kfree(a);
 
-		kfree(p->pkey_group.attrs);
+			kfree(p->pkey_group->attrs);
+		}
 	}
 
 	kfree(p);
@@ -1118,17 +1120,26 @@ static int add_port(struct ib_core_device *coredev, int port_num)
 	if (ret)
 		goto err_free_gid_type;
 
-	p->pkey_group.name  = "pkeys";
-	p->pkey_group.attrs = alloc_group_attrs(show_port_pkey,
-						attr.pkey_tbl_len);
-	if (!p->pkey_group.attrs) {
-		ret = -ENOMEM;
-		goto err_remove_gid_type;
+	if (attr.pkey_tbl_len) {
+		p->pkey_group = kzalloc(sizeof(*p->pkey_group), GFP_KERNEL);
+		if (!p->pkey_group) {
+			ret = -ENOMEM;
+			goto err_remove_gid_type;
+		}
+
+		p->pkey_group->name  = "pkeys";
+		p->pkey_group->attrs = alloc_group_attrs(show_port_pkey,
+							 attr.pkey_tbl_len);
+		if (!p->pkey_group->attrs) {
+			ret = -ENOMEM;
+			goto err_free_pkey_group;
+		}
+
+		ret = sysfs_create_group(&p->kobj, p->pkey_group);
+		if (ret)
+			goto err_free_pkey;
 	}
 
-	ret = sysfs_create_group(&p->kobj, &p->pkey_group);
-	if (ret)
-		goto err_free_pkey;
 
 	if (device->ops.init_port && is_full_dev) {
 		ret = device->ops.init_port(device, port_num, &p->kobj);
@@ -1150,14 +1161,23 @@ static int add_port(struct ib_core_device *coredev, int port_num)
 	return 0;
 
 err_remove_pkey:
-	sysfs_remove_group(&p->kobj, &p->pkey_group);
+	if (p->pkey_group)
+		sysfs_remove_group(&p->kobj, p->pkey_group);
 
 err_free_pkey:
-	for (i = 0; i < attr.pkey_tbl_len; ++i)
-		kfree(p->pkey_group.attrs[i]);
+	if (p->pkey_group) {
+		for (i = 0; i < attr.pkey_tbl_len; ++i)
+			kfree(p->pkey_group->attrs[i]);
+
+		kfree(p->pkey_group->attrs);
+		p->pkey_group->attrs = NULL;
+	}
 
-	kfree(p->pkey_group.attrs);
-	p->pkey_group.attrs = NULL;
+err_free_pkey_group:
+	if (p->pkey_group) {
+		kfree(p->pkey_group);
+		p->pkey_group = NULL;
+	}
 
 err_remove_gid_type:
 	sysfs_remove_group(&p->gid_attr_group->kobj,
@@ -1317,7 +1337,11 @@ void ib_free_port_attrs(struct ib_core_device *coredev)
 
 		if (port->pma_table)
 			sysfs_remove_group(p, port->pma_table);
-		sysfs_remove_group(p, &port->pkey_group);
+		if (port->pkey_group) {
+			sysfs_remove_group(p, port->pkey_group);
+			kfree(port->pkey_group);
+			port->pkey_group = NULL;
+		}
 		sysfs_remove_group(p, &port->gid_group);
 		sysfs_remove_group(&port->gid_attr_group->kobj,
 				   &port->gid_attr_group->ndev);
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH for-next 2/7] RDMA/core: Allocate the pkey cache only if the pkey_tbl_len is set
  2020-07-14  8:10 [PATCH for-next 0/7] RDMA: Remove query_pkey from iwarp providers Kamal Heib
  2020-07-14  8:10 ` [PATCH for-next 1/7] RDMA/core: Expose pkeys sysfs files only if pkey_tbl_len is set Kamal Heib
@ 2020-07-14  8:10 ` Kamal Heib
  2020-07-14  8:10 ` [PATCH for-next 3/7] RDMA/core: Remove query_pkey from the mandatory ops Kamal Heib
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Kamal Heib @ 2020-07-14  8:10 UTC (permalink / raw)
  To: linux-rdma
  Cc: Doug Ledford, Jason Gunthorpe, Michal Kalderon,
	Potnuri Bharat Teja, Shiraz Saleem, Bernard Metzler, Kamal Heib

Allocate the pkey cache only if the pkey_tbl_len is set by the provider,
also add checks to avoid accessing the pkey cache when it not
initialized.

Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
 drivers/infiniband/core/cache.c | 45 +++++++++++++++++++++------------
 1 file changed, 29 insertions(+), 16 deletions(-)

diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c
index a670209bbce6..ffad73bb40ff 100644
--- a/drivers/infiniband/core/cache.c
+++ b/drivers/infiniband/core/cache.c
@@ -1054,7 +1054,7 @@ int ib_get_cached_pkey(struct ib_device *device,
 
 	cache = device->port_data[port_num].cache.pkey;
 
-	if (index < 0 || index >= cache->table_len)
+	if (!cache || index < 0 || index >= cache->table_len)
 		ret = -EINVAL;
 	else
 		*pkey = cache->table[index];
@@ -1099,6 +1099,10 @@ int ib_find_cached_pkey(struct ib_device *device,
 	read_lock_irqsave(&device->cache_lock, flags);
 
 	cache = device->port_data[port_num].cache.pkey;
+	if (!cache) {
+		ret = -EINVAL;
+		goto err;
+	}
 
 	*index = -1;
 
@@ -1117,6 +1121,7 @@ int ib_find_cached_pkey(struct ib_device *device,
 		ret = 0;
 	}
 
+err:
 	read_unlock_irqrestore(&device->cache_lock, flags);
 
 	return ret;
@@ -1139,6 +1144,10 @@ int ib_find_exact_cached_pkey(struct ib_device *device,
 	read_lock_irqsave(&device->cache_lock, flags);
 
 	cache = device->port_data[port_num].cache.pkey;
+	if (!cache) {
+		ret = -EINVAL;
+		goto err;
+	}
 
 	*index = -1;
 
@@ -1149,6 +1158,7 @@ int ib_find_exact_cached_pkey(struct ib_device *device,
 			break;
 		}
 
+err:
 	read_unlock_irqrestore(&device->cache_lock, flags);
 
 	return ret;
@@ -1425,23 +1435,26 @@ ib_cache_update(struct ib_device *device, u8 port, bool enforce_security)
 			goto err;
 	}
 
-	pkey_cache = kmalloc(struct_size(pkey_cache, table,
-					 tprops->pkey_tbl_len),
-			     GFP_KERNEL);
-	if (!pkey_cache) {
-		ret = -ENOMEM;
-		goto err;
-	}
+	if (tprops->pkey_tbl_len) {
+		pkey_cache = kmalloc(struct_size(pkey_cache, table,
+						 tprops->pkey_tbl_len),
+				     GFP_KERNEL);
+		if (!pkey_cache) {
+			ret = -ENOMEM;
+			goto err;
+		}
 
-	pkey_cache->table_len = tprops->pkey_tbl_len;
+		pkey_cache->table_len = tprops->pkey_tbl_len;
 
-	for (i = 0; i < pkey_cache->table_len; ++i) {
-		ret = ib_query_pkey(device, port, i, pkey_cache->table + i);
-		if (ret) {
-			dev_warn(&device->dev,
-				 "ib_query_pkey failed (%d) for index %d\n",
-				 ret, i);
-			goto err;
+		for (i = 0; i < pkey_cache->table_len; ++i) {
+			ret = ib_query_pkey(device, port, i,
+					    pkey_cache->table + i);
+			if (ret) {
+				dev_warn(&device->dev,
+					 "ib_query_pkey failed (%d) for index %d\n",
+					 ret, i);
+				goto err;
+			}
 		}
 	}
 
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH for-next 3/7] RDMA/core: Remove query_pkey from the mandatory ops
  2020-07-14  8:10 [PATCH for-next 0/7] RDMA: Remove query_pkey from iwarp providers Kamal Heib
  2020-07-14  8:10 ` [PATCH for-next 1/7] RDMA/core: Expose pkeys sysfs files only if pkey_tbl_len is set Kamal Heib
  2020-07-14  8:10 ` [PATCH for-next 2/7] RDMA/core: Allocate the pkey cache only if the " Kamal Heib
@ 2020-07-14  8:10 ` Kamal Heib
  2020-07-14  8:10 ` [PATCH for-next 4/7] RDMA/siw: Remove the query_pkey callback Kamal Heib
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Kamal Heib @ 2020-07-14  8:10 UTC (permalink / raw)
  To: linux-rdma
  Cc: Doug Ledford, Jason Gunthorpe, Michal Kalderon,
	Potnuri Bharat Teja, Shiraz Saleem, Bernard Metzler, Kamal Heib

The query_pkey() isn't mandatory for the iwarp providers, so remove
this requirement from the RDMA core.

Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
 drivers/infiniband/core/device.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index b2d617e599a1..d293b826acbc 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -272,7 +272,6 @@ static void ib_device_check_mandatory(struct ib_device *device)
 	} mandatory_table[] = {
 		IB_MANDATORY_FUNC(query_device),
 		IB_MANDATORY_FUNC(query_port),
-		IB_MANDATORY_FUNC(query_pkey),
 		IB_MANDATORY_FUNC(alloc_pd),
 		IB_MANDATORY_FUNC(dealloc_pd),
 		IB_MANDATORY_FUNC(create_qp),
@@ -2362,6 +2361,9 @@ int ib_query_pkey(struct ib_device *device,
 	if (!rdma_is_port_valid(device, port_num))
 		return -EINVAL;
 
+	if (!device->ops.query_pkey)
+		return -EOPNOTSUPP;
+
 	return device->ops.query_pkey(device, port_num, index, pkey);
 }
 EXPORT_SYMBOL(ib_query_pkey);
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH for-next 4/7] RDMA/siw: Remove the query_pkey callback
  2020-07-14  8:10 [PATCH for-next 0/7] RDMA: Remove query_pkey from iwarp providers Kamal Heib
                   ` (2 preceding siblings ...)
  2020-07-14  8:10 ` [PATCH for-next 3/7] RDMA/core: Remove query_pkey from the mandatory ops Kamal Heib
@ 2020-07-14  8:10 ` Kamal Heib
  2020-07-14  8:10 ` [PATCH for-next 5/7] RDMA/cxgb4: " Kamal Heib
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Kamal Heib @ 2020-07-14  8:10 UTC (permalink / raw)
  To: linux-rdma
  Cc: Doug Ledford, Jason Gunthorpe, Michal Kalderon,
	Potnuri Bharat Teja, Shiraz Saleem, Bernard Metzler, Kamal Heib

Now that the query_pkey() isn't mandatory by the RDMA core for iwarp
providers, this callback can be removed.

Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
 drivers/infiniband/sw/siw/siw_main.c  | 1 -
 drivers/infiniband/sw/siw/siw_verbs.c | 9 ---------
 drivers/infiniband/sw/siw/siw_verbs.h | 1 -
 3 files changed, 11 deletions(-)

diff --git a/drivers/infiniband/sw/siw/siw_main.c b/drivers/infiniband/sw/siw/siw_main.c
index a0b8cc643c5c..18c08259157f 100644
--- a/drivers/infiniband/sw/siw/siw_main.c
+++ b/drivers/infiniband/sw/siw/siw_main.c
@@ -288,7 +288,6 @@ static const struct ib_device_ops siw_device_ops = {
 	.post_srq_recv = siw_post_srq_recv,
 	.query_device = siw_query_device,
 	.query_gid = siw_query_gid,
-	.query_pkey = siw_query_pkey,
 	.query_port = siw_query_port,
 	.query_qp = siw_query_qp,
 	.query_srq = siw_query_srq,
diff --git a/drivers/infiniband/sw/siw/siw_verbs.c b/drivers/infiniband/sw/siw/siw_verbs.c
index 0d509f7a10a6..adafa1b8bebe 100644
--- a/drivers/infiniband/sw/siw/siw_verbs.c
+++ b/drivers/infiniband/sw/siw/siw_verbs.c
@@ -176,7 +176,6 @@ int siw_query_port(struct ib_device *base_dev, u8 port,
 	attr->active_mtu = ib_mtu_int_to_enum(sdev->netdev->mtu);
 	attr->phys_state = sdev->state == IB_PORT_ACTIVE ?
 		IB_PORT_PHYS_STATE_LINK_UP : IB_PORT_PHYS_STATE_DISABLED;
-	attr->pkey_tbl_len = 1;
 	attr->port_cap_flags = IB_PORT_CM_SUP | IB_PORT_DEVICE_MGMT_SUP;
 	attr->state = sdev->state;
 	/*
@@ -204,20 +203,12 @@ int siw_get_port_immutable(struct ib_device *base_dev, u8 port,
 	if (rv)
 		return rv;
 
-	port_immutable->pkey_tbl_len = attr.pkey_tbl_len;
 	port_immutable->gid_tbl_len = attr.gid_tbl_len;
 	port_immutable->core_cap_flags = RDMA_CORE_PORT_IWARP;
 
 	return 0;
 }
 
-int siw_query_pkey(struct ib_device *base_dev, u8 port, u16 idx, u16 *pkey)
-{
-	/* Report the default pkey */
-	*pkey = 0xffff;
-	return 0;
-}
-
 int siw_query_gid(struct ib_device *base_dev, u8 port, int idx,
 		  union ib_gid *gid)
 {
diff --git a/drivers/infiniband/sw/siw/siw_verbs.h b/drivers/infiniband/sw/siw/siw_verbs.h
index 9335c48c01de..d9572275a6b6 100644
--- a/drivers/infiniband/sw/siw/siw_verbs.h
+++ b/drivers/infiniband/sw/siw/siw_verbs.h
@@ -46,7 +46,6 @@ int siw_create_cq(struct ib_cq *base_cq, const struct ib_cq_init_attr *attr,
 		  struct ib_udata *udata);
 int siw_query_port(struct ib_device *base_dev, u8 port,
 		   struct ib_port_attr *attr);
-int siw_query_pkey(struct ib_device *base_dev, u8 port, u16 idx, u16 *pkey);
 int siw_query_gid(struct ib_device *base_dev, u8 port, int idx,
 		  union ib_gid *gid);
 int siw_alloc_pd(struct ib_pd *base_pd, struct ib_udata *udata);
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH for-next 5/7] RDMA/cxgb4: Remove the query_pkey callback
  2020-07-14  8:10 [PATCH for-next 0/7] RDMA: Remove query_pkey from iwarp providers Kamal Heib
                   ` (3 preceding siblings ...)
  2020-07-14  8:10 ` [PATCH for-next 4/7] RDMA/siw: Remove the query_pkey callback Kamal Heib
@ 2020-07-14  8:10 ` Kamal Heib
  2020-07-14  8:10 ` [PATCH for-next 6/7] RDMA/i40iw: " Kamal Heib
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Kamal Heib @ 2020-07-14  8:10 UTC (permalink / raw)
  To: linux-rdma
  Cc: Doug Ledford, Jason Gunthorpe, Michal Kalderon,
	Potnuri Bharat Teja, Shiraz Saleem, Bernard Metzler, Kamal Heib

Now that the query_pkey() isn't mandatory by the RDMA core for iwarp
providers, this callback can be removed.

Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
 drivers/infiniband/hw/cxgb4/provider.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/provider.c b/drivers/infiniband/hw/cxgb4/provider.c
index 1d3ff59e4060..6c579d2d3997 100644
--- a/drivers/infiniband/hw/cxgb4/provider.c
+++ b/drivers/infiniband/hw/cxgb4/provider.c
@@ -236,14 +236,6 @@ static int c4iw_allocate_pd(struct ib_pd *pd, struct ib_udata *udata)
 	return 0;
 }
 
-static int c4iw_query_pkey(struct ib_device *ibdev, u8 port, u16 index,
-			   u16 *pkey)
-{
-	pr_debug("ibdev %p\n", ibdev);
-	*pkey = 0;
-	return 0;
-}
-
 static int c4iw_query_gid(struct ib_device *ibdev, u8 port, int index,
 			  union ib_gid *gid)
 {
@@ -317,7 +309,6 @@ static int c4iw_query_port(struct ib_device *ibdev, u8 port,
 	    IB_PORT_DEVICE_MGMT_SUP |
 	    IB_PORT_VENDOR_CLASS_SUP | IB_PORT_BOOT_MGMT_SUP;
 	props->gid_tbl_len = 1;
-	props->pkey_tbl_len = 1;
 	props->max_msg_sz = -1;
 
 	return ret;
@@ -439,7 +430,6 @@ static int c4iw_port_immutable(struct ib_device *ibdev, u8 port_num,
 	if (err)
 		return err;
 
-	immutable->pkey_tbl_len = attr.pkey_tbl_len;
 	immutable->gid_tbl_len = attr.gid_tbl_len;
 
 	return 0;
@@ -503,7 +493,6 @@ static const struct ib_device_ops c4iw_dev_ops = {
 	.post_srq_recv = c4iw_post_srq_recv,
 	.query_device = c4iw_query_device,
 	.query_gid = c4iw_query_gid,
-	.query_pkey = c4iw_query_pkey,
 	.query_port = c4iw_query_port,
 	.query_qp = c4iw_ib_query_qp,
 	.reg_user_mr = c4iw_reg_user_mr,
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH for-next 6/7] RDMA/i40iw: Remove the query_pkey callback
  2020-07-14  8:10 [PATCH for-next 0/7] RDMA: Remove query_pkey from iwarp providers Kamal Heib
                   ` (4 preceding siblings ...)
  2020-07-14  8:10 ` [PATCH for-next 5/7] RDMA/cxgb4: " Kamal Heib
@ 2020-07-14  8:10 ` Kamal Heib
  2020-07-14  8:10 ` [PATCH for-next 7/7] RDMA/qedr: " Kamal Heib
  2020-07-14 18:26 ` [PATCH for-next 0/7] RDMA: Remove query_pkey from iwarp providers Kamal Heib
  7 siblings, 0 replies; 10+ messages in thread
From: Kamal Heib @ 2020-07-14  8:10 UTC (permalink / raw)
  To: linux-rdma
  Cc: Doug Ledford, Jason Gunthorpe, Michal Kalderon,
	Potnuri Bharat Teja, Shiraz Saleem, Bernard Metzler, Kamal Heib

Now that the query_pkey() isn't mandatory by the RDMA core for iwarp
providers, this callback can be removed.

Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
 drivers/infiniband/hw/i40iw/i40iw_verbs.c | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
index f9ef3ac2f4cd..6957e4f3404b 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
@@ -101,7 +101,6 @@ static int i40iw_query_port(struct ib_device *ibdev,
 	props->port_cap_flags = IB_PORT_CM_SUP | IB_PORT_REINIT_SUP |
 		IB_PORT_VENDOR_CLASS_SUP | IB_PORT_BOOT_MGMT_SUP;
 	props->gid_tbl_len = 1;
-	props->pkey_tbl_len = 1;
 	props->active_width = IB_WIDTH_4X;
 	props->active_speed = 1;
 	props->max_msg_sz = I40IW_MAX_OUTBOUND_MESSAGE_SIZE;
@@ -2459,7 +2458,6 @@ static int i40iw_port_immutable(struct ib_device *ibdev, u8 port_num,
 	if (err)
 		return err;
 
-	immutable->pkey_tbl_len = attr.pkey_tbl_len;
 	immutable->gid_tbl_len = attr.gid_tbl_len;
 
 	return 0;
@@ -2615,22 +2613,6 @@ static int i40iw_query_gid(struct ib_device *ibdev,
 	return 0;
 }
 
-/**
- * i40iw_query_pkey - Query partition key
- * @ibdev: device pointer from stack
- * @port: port number
- * @index: index of pkey
- * @pkey: pointer to store the pkey
- */
-static int i40iw_query_pkey(struct ib_device *ibdev,
-			    u8 port,
-			    u16 index,
-			    u16 *pkey)
-{
-	*pkey = 0;
-	return 0;
-}
-
 static const struct ib_device_ops i40iw_dev_ops = {
 	.owner = THIS_MODULE,
 	.driver_id = RDMA_DRIVER_I40IW,
@@ -2670,7 +2652,6 @@ static const struct ib_device_ops i40iw_dev_ops = {
 	.post_send = i40iw_post_send,
 	.query_device = i40iw_query_device,
 	.query_gid = i40iw_query_gid,
-	.query_pkey = i40iw_query_pkey,
 	.query_port = i40iw_query_port,
 	.query_qp = i40iw_query_qp,
 	.reg_user_mr = i40iw_reg_user_mr,
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH for-next 7/7] RDMA/qedr: Remove the query_pkey callback
  2020-07-14  8:10 [PATCH for-next 0/7] RDMA: Remove query_pkey from iwarp providers Kamal Heib
                   ` (5 preceding siblings ...)
  2020-07-14  8:10 ` [PATCH for-next 6/7] RDMA/i40iw: " Kamal Heib
@ 2020-07-14  8:10 ` Kamal Heib
  2020-07-14  9:14   ` Michal Kalderon
  2020-07-14 18:26 ` [PATCH for-next 0/7] RDMA: Remove query_pkey from iwarp providers Kamal Heib
  7 siblings, 1 reply; 10+ messages in thread
From: Kamal Heib @ 2020-07-14  8:10 UTC (permalink / raw)
  To: linux-rdma
  Cc: Doug Ledford, Jason Gunthorpe, Michal Kalderon,
	Potnuri Bharat Teja, Shiraz Saleem, Bernard Metzler, Kamal Heib

Now that the query_pkey() isn't mandatory by the RDMA core for iwarp
providers, this callback can be removed from the common ops and moved to
the RoCE only ops within the qedr driver.

Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
 drivers/infiniband/hw/qedr/main.c  | 3 +--
 drivers/infiniband/hw/qedr/verbs.c | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/qedr/main.c b/drivers/infiniband/hw/qedr/main.c
index ccaedfd53e49..c9eeed25c662 100644
--- a/drivers/infiniband/hw/qedr/main.c
+++ b/drivers/infiniband/hw/qedr/main.c
@@ -110,7 +110,6 @@ static int qedr_iw_port_immutable(struct ib_device *ibdev, u8 port_num,
 	if (err)
 		return err;
 
-	immutable->pkey_tbl_len = 1;
 	immutable->gid_tbl_len = 1;
 	immutable->core_cap_flags = RDMA_CORE_PORT_IWARP;
 	immutable->max_mad_size = 0;
@@ -179,6 +178,7 @@ static int qedr_iw_register_device(struct qedr_dev *dev)
 
 static const struct ib_device_ops qedr_roce_dev_ops = {
 	.get_port_immutable = qedr_roce_port_immutable,
+	.query_pkey = qedr_query_pkey,
 };
 
 static void qedr_roce_register_device(struct qedr_dev *dev)
@@ -221,7 +221,6 @@ static const struct ib_device_ops qedr_dev_ops = {
 	.post_srq_recv = qedr_post_srq_recv,
 	.process_mad = qedr_process_mad,
 	.query_device = qedr_query_device,
-	.query_pkey = qedr_query_pkey,
 	.query_port = qedr_query_port,
 	.query_qp = qedr_query_qp,
 	.query_srq = qedr_query_srq,
diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
index 3d7d5617818f..63eb935a1596 100644
--- a/drivers/infiniband/hw/qedr/verbs.c
+++ b/drivers/infiniband/hw/qedr/verbs.c
@@ -239,7 +239,6 @@ int qedr_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attr *attr)
 	attr->ip_gids = true;
 	if (rdma_protocol_iwarp(&dev->ibdev, 1)) {
 		attr->gid_tbl_len = 1;
-		attr->pkey_tbl_len = 1;
 	} else {
 		attr->gid_tbl_len = QEDR_MAX_SGID;
 		attr->pkey_tbl_len = QEDR_ROCE_PKEY_TABLE_LEN;
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* RE: [PATCH for-next 7/7] RDMA/qedr: Remove the query_pkey callback
  2020-07-14  8:10 ` [PATCH for-next 7/7] RDMA/qedr: " Kamal Heib
@ 2020-07-14  9:14   ` Michal Kalderon
  0 siblings, 0 replies; 10+ messages in thread
From: Michal Kalderon @ 2020-07-14  9:14 UTC (permalink / raw)
  To: Kamal Heib, linux-rdma
  Cc: Doug Ledford, Jason Gunthorpe, Potnuri Bharat Teja,
	Shiraz Saleem, Bernard Metzler

> From: linux-rdma-owner@vger.kernel.org <linux-rdma-
> owner@vger.kernel.org> On Behalf Of Kamal Heib
> 
> Now that the query_pkey() isn't mandatory by the RDMA core for iwarp
> providers, this callback can be removed from the common ops and moved to
> the RoCE only ops within the qedr driver.
> 
> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> ---
>  drivers/infiniband/hw/qedr/main.c  | 3 +--
> drivers/infiniband/hw/qedr/verbs.c | 1 -
>  2 files changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/qedr/main.c
> b/drivers/infiniband/hw/qedr/main.c
> index ccaedfd53e49..c9eeed25c662 100644
> --- a/drivers/infiniband/hw/qedr/main.c
> +++ b/drivers/infiniband/hw/qedr/main.c
> @@ -110,7 +110,6 @@ static int qedr_iw_port_immutable(struct ib_device
> *ibdev, u8 port_num,
>  	if (err)
>  		return err;
> 
> -	immutable->pkey_tbl_len = 1;
>  	immutable->gid_tbl_len = 1;
>  	immutable->core_cap_flags = RDMA_CORE_PORT_IWARP;
>  	immutable->max_mad_size = 0;
> @@ -179,6 +178,7 @@ static int qedr_iw_register_device(struct qedr_dev
> *dev)
> 
>  static const struct ib_device_ops qedr_roce_dev_ops = {
>  	.get_port_immutable = qedr_roce_port_immutable,
> +	.query_pkey = qedr_query_pkey,
>  };
> 
>  static void qedr_roce_register_device(struct qedr_dev *dev) @@ -221,7
> +221,6 @@ static const struct ib_device_ops qedr_dev_ops = {
>  	.post_srq_recv = qedr_post_srq_recv,
>  	.process_mad = qedr_process_mad,
>  	.query_device = qedr_query_device,
> -	.query_pkey = qedr_query_pkey,
>  	.query_port = qedr_query_port,
>  	.query_qp = qedr_query_qp,
>  	.query_srq = qedr_query_srq,
> diff --git a/drivers/infiniband/hw/qedr/verbs.c
> b/drivers/infiniband/hw/qedr/verbs.c
> index 3d7d5617818f..63eb935a1596 100644
> --- a/drivers/infiniband/hw/qedr/verbs.c
> +++ b/drivers/infiniband/hw/qedr/verbs.c
> @@ -239,7 +239,6 @@ int qedr_query_port(struct ib_device *ibdev, u8 port,
> struct ib_port_attr *attr)
>  	attr->ip_gids = true;
>  	if (rdma_protocol_iwarp(&dev->ibdev, 1)) {
>  		attr->gid_tbl_len = 1;
> -		attr->pkey_tbl_len = 1;
>  	} else {
>  		attr->gid_tbl_len = QEDR_MAX_SGID;
>  		attr->pkey_tbl_len = QEDR_ROCE_PKEY_TABLE_LEN;
> --
> 2.25.4

Thanks, 

Acked-by: Michal Kalderon <michal.kalderon@marvell.com>



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH for-next 0/7] RDMA: Remove query_pkey from iwarp providers
  2020-07-14  8:10 [PATCH for-next 0/7] RDMA: Remove query_pkey from iwarp providers Kamal Heib
                   ` (6 preceding siblings ...)
  2020-07-14  8:10 ` [PATCH for-next 7/7] RDMA/qedr: " Kamal Heib
@ 2020-07-14 18:26 ` Kamal Heib
  7 siblings, 0 replies; 10+ messages in thread
From: Kamal Heib @ 2020-07-14 18:26 UTC (permalink / raw)
  To: linux-rdma
  Cc: Doug Ledford, Jason Gunthorpe, Michal Kalderon,
	Potnuri Bharat Teja, Shiraz Saleem, Bernard Metzler

On Tue, Jul 14, 2020 at 11:10:31AM +0300, Kamal Heib wrote:
> This patch set does the following:
> 1- Avoid exposing the pkeys sysfs entries for iwarp providers.
> 2- Avoid allocating the pkey cache for iwarp providers.
> 3- Remove the requirement by RDMA core to implement query_pkey
>    by all providers.
> 4- Remove the implementation of query_pkey callback from iwarp providers.
> 
> Kamal Heib (7):
>   RDMA/core: Expose pkeys sysfs files only if pkey_tbl_len is set
>   RDMA/core: Allocate the pkey cache only if the pkey_tbl_len is set
>   RDMA/core: Remove query_pkey from the mandatory ops
>   RDMA/siw: Remove the query_pkey callback
>   RDMA/cxgb4: Remove the query_pkey callback
>   RDMA/i40iw: Remove the query_pkey callback
>   RDMA/qedr: Remove the query_pkey callback
> 
>  drivers/infiniband/core/cache.c           | 45 ++++++++++------
>  drivers/infiniband/core/device.c          |  4 +-
>  drivers/infiniband/core/sysfs.c           | 64 ++++++++++++++++-------
>  drivers/infiniband/hw/cxgb4/provider.c    | 11 ----
>  drivers/infiniband/hw/i40iw/i40iw_verbs.c | 19 -------
>  drivers/infiniband/hw/qedr/main.c         |  3 +-
>  drivers/infiniband/hw/qedr/verbs.c        |  1 -
>  drivers/infiniband/sw/siw/siw_main.c      |  1 -
>  drivers/infiniband/sw/siw/siw_verbs.c     |  9 ----
>  drivers/infiniband/sw/siw/siw_verbs.h     |  1 -
>  10 files changed, 77 insertions(+), 81 deletions(-)
> 
> -- 
> 2.25.4
> 

I found an issue while testing this patch set, I'll post a v1 that
fixes this issue soon.

Nacked-by: Kamal Heib <kamalheib1@gmail.com>

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-07-14 19:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-14  8:10 [PATCH for-next 0/7] RDMA: Remove query_pkey from iwarp providers Kamal Heib
2020-07-14  8:10 ` [PATCH for-next 1/7] RDMA/core: Expose pkeys sysfs files only if pkey_tbl_len is set Kamal Heib
2020-07-14  8:10 ` [PATCH for-next 2/7] RDMA/core: Allocate the pkey cache only if the " Kamal Heib
2020-07-14  8:10 ` [PATCH for-next 3/7] RDMA/core: Remove query_pkey from the mandatory ops Kamal Heib
2020-07-14  8:10 ` [PATCH for-next 4/7] RDMA/siw: Remove the query_pkey callback Kamal Heib
2020-07-14  8:10 ` [PATCH for-next 5/7] RDMA/cxgb4: " Kamal Heib
2020-07-14  8:10 ` [PATCH for-next 6/7] RDMA/i40iw: " Kamal Heib
2020-07-14  8:10 ` [PATCH for-next 7/7] RDMA/qedr: " Kamal Heib
2020-07-14  9:14   ` Michal Kalderon
2020-07-14 18:26 ` [PATCH for-next 0/7] RDMA: Remove query_pkey from iwarp providers Kamal Heib

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).