diff mbox series

[rdma-next] RDMA: Adding a new device managed gids cap

Message ID 20181002075212.20729-1-kamalheib1@gmail.com (mailing list archive)
State Rejected
Headers show
Series [rdma-next] RDMA: Adding a new device managed gids cap | expand

Commit Message

Kamal Heib Oct. 2, 2018, 7:52 a.m. UTC
To avoid checking if add_gid() and del_gid() are implemented adding a new
device cap flag that will indicate whether a specific device does
support managing his RoCE GIDs table or not.

Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
 drivers/infiniband/hw/bnxt_re/ib_verbs.c        | 3 ++-
 drivers/infiniband/hw/hns/hns_roce_main.c       | 3 ++-
 drivers/infiniband/hw/mlx4/main.c               | 3 ++-
 drivers/infiniband/hw/mlx5/main.c               | 3 ++-
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c | 3 ++-
 include/rdma/ib_verbs.h                         | 3 ++-
 6 files changed, 12 insertions(+), 6 deletions(-)

Comments

Leon Romanovsky Oct. 2, 2018, 8:07 a.m. UTC | #1
On Tue, Oct 02, 2018 at 10:52:12AM +0300, Kamal Heib wrote:
> To avoid checking if add_gid() and del_gid() are implemented adding a new
> device cap flag that will indicate whether a specific device does
> support managing his RoCE GIDs table or not.
>

Why? What will it give us?

Thanks
Kamal Heib Oct. 2, 2018, 8:39 a.m. UTC | #2
On Tue, Oct 02, 2018 at 11:07:38AM +0300, Leon Romanovsky wrote:
> On Tue, Oct 02, 2018 at 10:52:12AM +0300, Kamal Heib wrote:
> > To avoid checking if add_gid() and del_gid() are implemented adding a new
> > device cap flag that will indicate whether a specific device does
> > support managing his RoCE GIDs table or not.
> >
> 
> Why? What will it give us?
> 
> Thanks

I plan to work on something similar to "verbs_context_ops" that was introduced in rdma-core,
so, this change will drop the dependency on checking if the providers implemented the call-backs or not.

Thanks,
Kamal
Leon Romanovsky Oct. 2, 2018, 8:54 a.m. UTC | #3
On Tue, Oct 02, 2018 at 11:39:43AM +0300, Kamal Heib wrote:
> On Tue, Oct 02, 2018 at 11:07:38AM +0300, Leon Romanovsky wrote:
> > On Tue, Oct 02, 2018 at 10:52:12AM +0300, Kamal Heib wrote:
> > > To avoid checking if add_gid() and del_gid() are implemented adding a new
> > > device cap flag that will indicate whether a specific device does
> > > support managing his RoCE GIDs table or not.
> > >
> >
> > Why? What will it give us?
> >
> > Thanks
>
> I plan to work on something similar to "verbs_context_ops" that was introduced in rdma-core,
> so, this change will drop the dependency on checking if the providers implemented the call-backs or not.

I would be happy to see this patch as part of whole feature, because
this specific patch gives nothing to us in this current form.

Thanks

>
> Thanks,
> Kamal
>
Dennis Dalessandro Oct. 3, 2018, 3:29 p.m. UTC | #4
On 10/2/2018 4:54 AM, Leon Romanovsky wrote:
> On Tue, Oct 02, 2018 at 11:39:43AM +0300, Kamal Heib wrote:
>> On Tue, Oct 02, 2018 at 11:07:38AM +0300, Leon Romanovsky wrote:
>>> On Tue, Oct 02, 2018 at 10:52:12AM +0300, Kamal Heib wrote:
>>>> To avoid checking if add_gid() and del_gid() are implemented adding a new
>>>> device cap flag that will indicate whether a specific device does
>>>> support managing his RoCE GIDs table or not.
>>>>
>>>
>>> Why? What will it give us?
>>>
>>> Thanks
>>
>> I plan to work on something similar to "verbs_context_ops" that was introduced in rdma-core,
>> so, this change will drop the dependency on checking if the providers implemented the call-backs or not.
> 
> I would be happy to see this patch as part of whole feature, because
> this specific patch gives nothing to us in this current form.
> 
> Thanks
> 
>>
>> Thanks,
>> Kamal
>>

Agree with Leon here. Patch has to stand on it's own, or at least come 
along with something that makes it relevant.

-Denny
Jason Gunthorpe Oct. 3, 2018, 4:01 p.m. UTC | #5
On Wed, Oct 03, 2018 at 11:29:32AM -0400, Dennis Dalessandro wrote:
> On 10/2/2018 4:54 AM, Leon Romanovsky wrote:
> > On Tue, Oct 02, 2018 at 11:39:43AM +0300, Kamal Heib wrote:
> > > On Tue, Oct 02, 2018 at 11:07:38AM +0300, Leon Romanovsky wrote:
> > > > On Tue, Oct 02, 2018 at 10:52:12AM +0300, Kamal Heib wrote:
> > > > > To avoid checking if add_gid() and del_gid() are implemented adding a new
> > > > > device cap flag that will indicate whether a specific device does
> > > > > support managing his RoCE GIDs table or not.
> > > > > 
> > > > 
> > > > Why? What will it give us?
> > > > 
> > > > Thanks
> > > 
> > > I plan to work on something similar to "verbs_context_ops" that
> > > was introduced in rdma-core, so, this change will drop the
> > > dependency on checking if the providers implemented the
> > > call-backs or not.
> > 
> > I would be happy to see this patch as part of whole feature, because
> > this specific patch gives nothing to us in this current form.
> > 
> Agree with Leon here. Patch has to stand on it's own, or at least come along
> with something that makes it relevant.

I also generally dislike the idea to test a bit to check if the
function you are about to invoke is NULL or not.

ops are to be NULL if they are not supported.

Jason
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
index bc2b9e038439..50d77ca23d76 100644
--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
+++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
@@ -165,7 +165,8 @@  int bnxt_re_query_device(struct ib_device *ibdev,
 				    | IB_DEVICE_N_NOTIFY_CQ
 				    | IB_DEVICE_MEM_WINDOW
 				    | IB_DEVICE_MEM_WINDOW_TYPE_2B
-				    | IB_DEVICE_MEM_MGT_EXTENSIONS;
+				    | IB_DEVICE_MEM_MGT_EXTENSIONS
+				    | IB_DEVICE_MANAGED_GIDS;
 	ib_attr->max_send_sge = dev_attr->max_qp_sges;
 	ib_attr->max_recv_sge = dev_attr->max_qp_sges;
 	ib_attr->max_sge_rd = dev_attr->max_qp_sges;
diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
index 8c5160ec3a4d..63d64e1166a5 100644
--- a/drivers/infiniband/hw/hns/hns_roce_main.c
+++ b/drivers/infiniband/hw/hns/hns_roce_main.c
@@ -205,7 +205,8 @@  static int hns_roce_query_device(struct ib_device *ib_dev,
 	props->max_qp = hr_dev->caps.num_qps;
 	props->max_qp_wr = hr_dev->caps.max_wqes;
 	props->device_cap_flags = IB_DEVICE_PORT_ACTIVE_EVENT |
-				  IB_DEVICE_RC_RNR_NAK_GEN;
+				  IB_DEVICE_RC_RNR_NAK_GEN    |
+				  IB_DEVICE_MANAGED_GIDS;
 	props->max_send_sge = hr_dev->caps.max_sq_sg;
 	props->max_recv_sge = hr_dev->caps.max_rq_sg;
 	props->max_sge_rd = 1;
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index fa5d20eccc21..546028129fef 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -471,7 +471,8 @@  static int mlx4_ib_query_device(struct ib_device *ibdev,
 		IB_DEVICE_PORT_ACTIVE_EVENT		|
 		IB_DEVICE_SYS_IMAGE_GUID		|
 		IB_DEVICE_RC_RNR_NAK_GEN		|
-		IB_DEVICE_BLOCK_MULTICAST_LOOPBACK;
+		IB_DEVICE_BLOCK_MULTICAST_LOOPBACK	|
+		IB_DEVICE_MANAGED_GIDS;
 	if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_BAD_PKEY_CNTR)
 		props->device_cap_flags |= IB_DEVICE_BAD_PKEY_CNTR;
 	if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR)
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 597cd3c171c9..814a17e229bf 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -765,7 +765,8 @@  static int mlx5_ib_query_device(struct ib_device *ibdev,
 	props->device_cap_flags    = IB_DEVICE_CHANGE_PHY_PORT |
 		IB_DEVICE_PORT_ACTIVE_EVENT		|
 		IB_DEVICE_SYS_IMAGE_GUID		|
-		IB_DEVICE_RC_RNR_NAK_GEN;
+		IB_DEVICE_RC_RNR_NAK_GEN		|
+		IB_DEVICE_MANAGED_GIDS;
 
 	if (MLX5_CAP_GEN(mdev, pkv))
 		props->device_cap_flags |= IB_DEVICE_BAD_PKEY_CNTR;
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c
index b65d10b0a875..792edfb796ad 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c
@@ -113,7 +113,8 @@  int pvrdma_query_device(struct ib_device *ibdev,
 	}
 
 	props->device_cap_flags |= IB_DEVICE_PORT_ACTIVE_EVENT |
-				   IB_DEVICE_RC_RNR_NAK_GEN;
+				   IB_DEVICE_RC_RNR_NAK_GEN |
+				   IB_DEVICE_MANAGED_GIDS;
 
 	return 0;
 }
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 9897d2329f2c..402320958172 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -241,6 +241,7 @@  enum ib_device_cap_flags {
 	IB_DEVICE_RDMA_NETDEV_OPA_VNIC		= (1ULL << 35),
 	/* The device supports padding incoming writes to cacheline. */
 	IB_DEVICE_PCI_WRITE_END_PADDING		= (1ULL << 36),
+	IB_DEVICE_MANAGED_GIDS			= (1ULL << 37),
 };
 
 enum ib_signature_prot_cap {
@@ -3094,7 +3095,7 @@  static inline bool rdma_cap_roce_gid_table(const struct ib_device *device,
 					   u8 port_num)
 {
 	return rdma_protocol_roce(device, port_num) &&
-		device->add_gid && device->del_gid;
+		(device->attrs.device_cap_flags & IB_DEVICE_MANAGED_GIDS);
 }
 
 /*