RDMA: modify_port improvements
Subsystems (4)
v3 cover RDMA: modify_port improvements
Changelog:
v3: Improve [patch 1/4].
v2: Include fixes lines.
This series includes three patches which fix the return values from modify_port() callbacks when they aren't supported.
Kamal Heib (4):
RDMA/core: Fix return code when modify_port isn't supported RDMA/hns: Remove unsupported modify_port callback RDMA/ocrdma: Remove unsupported modify_port callback RDMA/qedr: Remove unsupported modify_port callback
drivers/infiniband/core/device.c | 2 +- drivers/infiniband/hw/hns/hns_roce_main.c | 7 ------- drivers/infiniband/hw/ocrdma/ocrdma_main.c | 1 - drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 6 ------ drivers/infiniband/hw/ocrdma/ocrdma_verbs.h | 2 -- drivers/infiniband/hw/qedr/main.c | 1 - drivers/infiniband/hw/qedr/verbs.c | 6 ------ drivers/infiniband/hw/qedr/verbs.h | 2 -- 8 files changed, 1 insertion(+), 26 deletions(-)
Signature · 1 line
2.20.1
PATCH v3 1/4 RDMA/core: Fix return code when modify_port isn't supported
Improving return code from ib_modify_port() by doing the following:
1- Use "-EOPNOTSUPP" instead "-ENOSYS" which is the proper return code. 2- Avoid confusion by return "-EOPNOTSUPP" when modify_port() isn't
supplied by the provider and the protocol is IB, otherwise return success to avoid failure of the ib_modify_port() in CM layer.
--- drivers/infiniband/core/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/device.c +1 -1
@@ -2397,7 +2397,7 @@ int ib_modify_port(struct ib_device *device, port_modify_mask, port_modify); else - rc =rdma_protocol_roce (device, port_num) ?0 : -ENOSYS ; + rc =rdma_protocol_ib (device, port_num) ? -EOPNOTSUPP :0 ;return rc; }EXPORT_SYMBOL (ib_modify_port);
Signature · 1 line
2.20.1
RE: [PATCH for-next v3 1/4] RDMA/core: Fix return code when modify_port isn't supported
Quoted 29 lines
From: [email protected] <linux-rdma- [email protected]> On Behalf Of Kamal Heib
Improving return code from
ib_modify_port()by doing the following:
1- Use "-EOPNOTSUPP" instead "-ENOSYS" which is the proper return code. 2- Avoid confusion by return "-EOPNOTSUPP" whenmodify_port()isn't
supplied by the provider and the protocol is IB, otherwise return success to avoid failure of theib_modify_port()in CM layer.Fixes 61e0962d5221 ("IB: Avoid ib_modify_port() failure for RoCE devices")Signed-off-by Kamal Heib <[email protected]>--- drivers/infiniband/core/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/infiniband/core/device.c +1
-1@@ -2397,7 +2397,7 @@ int ib_modify_port(struct ib_device *device, port_modify_mask, port_modify); else - rc =rdma_protocol_roce (device, port_num) ?0 : -ENOSYS ; + rc =rdma_protocol_ib (device, port_num) ? -EOPNOTSUPP :0 ;return rc; }
Quoted 3 lines
EXPORT_SYMBOL(ib_modify_port);
--
2.20.1
Thanks,
Re: [PATCH for-next v3 1/4] RDMA/core: Fix return code when modify_port isn't supported
In reply to Kamal HeibQuoted 15 lines · Kamal Heib
Improving return code from
ib_modify_port()by doing the following:
1- Use "-EOPNOTSUPP" instead "-ENOSYS" which is the proper return code. 2- Avoid confusion by return "-EOPNOTSUPP" whenmodify_port()isn't
supplied by the provider and the protocol is IB, otherwise return success to avoid failure of theib_modify_port()in CM layer.Fixes 61e0962d5221 ("IB: Avoid ib_modify_port() failure for RoCE devices")Signed-off-by Kamal Heib <[email protected]>drivers/infiniband/core/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/infiniband/core/device.c +1
-0+++ b/drivers/infiniband/core/device.c
drivers/infiniband/core/device.c int ib_modify_port(struct ib_device *device, · line 2401
Quoted 6 lines
drivers/infiniband/core/device.c +1
-1@@ -2397,7 +2397,7 @@ int ib_modify_port(struct ib_device *device, port_modify_mask, port_modify); else - rc =rdma_protocol_roce (device, port_num) ?0 : -ENOSYS ; + rc =rdma_protocol_ib (device, port_num) ? -EOPNOTSUPP :0 ;return rc;
Oh gross, this is such an ugly hack
roce mode should allow a fake IB_PORT_CM_SUP to be manipulated and nothing else.
All other cases should return EOPNOTSUPP as something has gone really wrong
Jason
Re: [PATCH for-next v3 1/4] RDMA/core: Fix return code when modify_port isn't supported
Quoted 25 lines · Jason Gunthorpe
Quoted 15 lines · Kamal Heib
Improving return code from
ib_modify_port()by doing the following:
1- Use "-EOPNOTSUPP" instead "-ENOSYS" which is the proper return code. 2- Avoid confusion by return "-EOPNOTSUPP" whenmodify_port()isn't
supplied by the provider and the protocol is IB, otherwise return success to avoid failure of theib_modify_port()in CM layer.Fixes 61e0962d5221 ("IB: Avoid ib_modify_port() failure for RoCE devices")Signed-off-by Kamal Heib <[email protected]>drivers/infiniband/core/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/infiniband/core/device.c +1
-0+++ b/drivers/infiniband/core/device.cdrivers/infiniband/core/device.c int ib_modify_port(struct ib_device *device, · line 2401
Quoted 6 lines
drivers/infiniband/core/device.c +1
-1@@ -2397,7 +2397,7 @@ int ib_modify_port(struct ib_device *device, port_modify_mask, port_modify); else - rc =rdma_protocol_roce (device, port_num) ?0 : -ENOSYS ; + rc =rdma_protocol_ib (device, port_num) ? -EOPNOTSUPP :0 ;return rc;Oh gross, this is such an ugly hack
Quoted 7 lines
roce mode should allow a fake
IB_PORT_CM_SUPto be manipulated and nothing else.All other cases should return EOPNOTSUPP as something has gone really wrong
Jason
Do you mean something like the following:
drivers/infiniband/core/device.c +5 -1
@@ -2396,8 +2396,12 @@ int ib_modify_port(struct ib_device *device, rc = device->ops.modify_port (device, port_num, port_modify_mask, port_modify); + else if (rdma_protocol_roce(device, port_num) && + ((port_modify->set_port_cap_mask & IB_PORT_CM_SUP) || + (port_modify->clr_port_cap_mask & IB_PORT_CM_SUP))) + rc =0 ; else - rc =rdma_protocol_roce (device, port_num) ?0 : -ENOSYS ; + rc = -EOPNOTSUPP ;return rc; }EXPORT_SYMBOL (ib_modify_port);
Re: [PATCH for-next v3 1/4] RDMA/core: Fix return code when modify_port isn't supported
Quoted 40 lines · Kamal Heib
Quoted 25 lines · Jason Gunthorpe
Quoted 15 lines · Kamal Heib
Improving return code from
ib_modify_port()by doing the following:
1- Use "-EOPNOTSUPP" instead "-ENOSYS" which is the proper return code. 2- Avoid confusion by return "-EOPNOTSUPP" whenmodify_port()isn't
supplied by the provider and the protocol is IB, otherwise return success to avoid failure of theib_modify_port()in CM layer.Fixes 61e0962d5221 ("IB: Avoid ib_modify_port() failure for RoCE devices")Signed-off-by Kamal Heib <[email protected]>drivers/infiniband/core/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/infiniband/core/device.c +1
-0+++ b/drivers/infiniband/core/device.cdrivers/infiniband/core/device.c int ib_modify_port(struct ib_device *device, · line 2401
Quoted 6 lines
drivers/infiniband/core/device.c +1
-1@@ -2397,7 +2397,7 @@ int ib_modify_port(struct ib_device *device, port_modify_mask, port_modify); else - rc =rdma_protocol_roce (device, port_num) ?0 : -ENOSYS ; + rc =rdma_protocol_ib (device, port_num) ? -EOPNOTSUPP :0 ;return rc;Oh gross, this is such an ugly hack
Quoted 7 lines
roce mode should allow a fake
IB_PORT_CM_SUPto be manipulated and nothing else.All other cases should return EOPNOTSUPP as something has gone really wrong
Jason
Do you mean something like the following:
drivers/infiniband/core/device.c +1
-0+++ b/drivers/infiniband/core/device.c
drivers/infiniband/core/device.c int ib_modify_port(struct ib_device *device, · line 2401
Quoted 6 lines
drivers/infiniband/core/device.c +3
-0@@ -2396,8 +2396,12 @@ int ib_modify_port(struct ib_device *device, rc = device->ops.modify_port (device, port_num, port_modify_mask, port_modify); + else if (rdma_protocol_roce(device, port_num) && + ((port_modify->set_port_cap_mask & IB_PORT_CM_SUP) || + (port_modify->clr_port_cap_mask & IB_PORT_CM_SUP)))
That isn't the right logic.. it is more like & ~IB_PORT_CM_SUP) == 0
Jason
PATCH v3 2/4 RDMA/hns: Remove unsupported modify_port callback
In reply to Kamal HeibThere is no need to return always zero for function which is not supported.
--- drivers/infiniband/hw/hns/hns_roce_main.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/infiniband/hw/hns/hns_roce_main.c +0 -7
@@ -301,12 +301,6 @@ static int hns_roce_modify_device(struct ib_device *ib_dev, int mask,return 0 ; } -static int hns_roce_modify_port (struct ib_device *ib_dev,u8 port_num,int mask, -struct ib_port_modify *props) -{ -return 0 ; -} -static int hns_roce_alloc_ucontext (struct ib_ucontext *uctx,struct ib_udata *udata) {
@@ -438,7 +432,6 @@ static const struct ib_device_ops hns_roce_dev_ops = { .get_port_immutable = hns_roce_port_immutable, .mmap = hns_roce_mmap, .modify_device = hns_roce_modify_device, - .modify_port = hns_roce_modify_port, .modify_qp = hns_roce_modify_qp, .query_ah = hns_roce_query_ah, .query_device = hns_roce_query_device,
Signature · 1 line
2.20.1
PATCH v3 3/4 RDMA/ocrdma: Remove unsupported modify_port callback
In reply to Kamal HeibThere is no need to return always zero for function which is not supported.
--- drivers/infiniband/hw/ocrdma/ocrdma_main.c | 1 - drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 6 ------ drivers/infiniband/hw/ocrdma/ocrdma_verbs.h | 2 -- 3 files changed, 9 deletions(-)
drivers/infiniband/hw/ocrdma/ocrdma_main.c +0 -1
@@ -166,7 +166,6 @@ static const struct ib_device_ops ocrdma_dev_ops = { .get_port_immutable = ocrdma_port_immutable, .map_mr_sg = ocrdma_map_mr_sg, .mmap = ocrdma_mmap, - .modify_port = ocrdma_modify_port, .modify_qp = ocrdma_modify_qp, .poll_cq = ocrdma_poll_cq, .post_recv = ocrdma_post_recv,
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +0 -6
@@ -190,12 +190,6 @@ int ocrdma_query_port(struct ib_device *ibdev,return 0 ; } -int ocrdma_modify_port (struct ib_device *ibdev,u8 port,int mask, -struct ib_port_modify *props) -{ -return 0 ; -} -static int ocrdma_add_mmap (struct ocrdma_ucontext *uctx,u64 phy_addr,unsigned long len) {
drivers/infiniband/hw/ocrdma/ocrdma_verbs.h +0 -2
@@ -54,8 +54,6 @@ int ocrdma_arm_cq(struct ib_cq *, enum ib_cq_notify_flags flags);int ocrdma_query_device (struct ib_device *,struct ib_device_attr *props,struct ib_udata *uhw);int ocrdma_query_port (struct ib_device *,u8 port,struct ib_port_attr *props); -int ocrdma_modify_port (struct ib_device *,u8 port,int mask, -struct ib_port_modify *props);enum rdma_protocol_type ocrdma_query_protocol (struct ib_device *device,u8 port_num);
Signature · 1 line
2.20.1
PATCH v3 4/4 RDMA/qedr: Remove unsupported modify_port callback
In reply to Kamal HeibThere is no need to return always zero for function which is not supported.
--- drivers/infiniband/hw/qedr/main.c | 1 - drivers/infiniband/hw/qedr/verbs.c | 6 ------ drivers/infiniband/hw/qedr/verbs.h | 2 -- 3 files changed, 9 deletions(-)
drivers/infiniband/hw/qedr/main.c +0 -1
@@ -212,7 +212,6 @@ static const struct ib_device_ops qedr_dev_ops = { .get_link_layer = qedr_link_layer, .map_mr_sg = qedr_map_mr_sg, .mmap = qedr_mmap, - .modify_port = qedr_modify_port, .modify_qp = qedr_modify_qp, .modify_srq = qedr_modify_srq, .poll_cq = qedr_poll_cq,
drivers/infiniband/hw/qedr/verbs.c +0 -6
@@ -250,12 +250,6 @@ int qedr_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attr *attr)return 0 ; } -int qedr_modify_port (struct ib_device *ibdev,u8 port,int mask, -struct ib_port_modify *props) -{ -return 0 ; -} -static int qedr_add_mmap (struct qedr_ucontext *uctx,u64 phy_addr,unsigned long len) {
drivers/infiniband/hw/qedr/verbs.h +0 -2
@@ -35,8 +35,6 @@int qedr_query_device (struct ib_device *ibdev,struct ib_device_attr *attr,struct ib_udata *udata);int qedr_query_port (struct ib_device *,u8 port,struct ib_port_attr *props); -int qedr_modify_port (struct ib_device *,u8 port,int mask, -struct ib_port_modify *props);int qedr_iw_query_gid (struct ib_device *ibdev,u8 port,int index,union ib_gid *gid);
Signature · 1 line
2.20.1
RE: [PATCH for-next v3 4/4] RDMA/qedr: Remove unsupported modify_port callback
Quoted 60 lines
From: [email protected] <linux-rdma- [email protected]> On Behalf Of Kamal Heib
There is no need to return always zero for function which is not supported.
Fixes ac1b36e55a51 ("qedr: Add support for user context verbs")Signed-off-by Kamal Heib <[email protected]>--- drivers/infiniband/hw/qedr/main.c | 1 - drivers/infiniband/hw/qedr/verbs.c | 6 ------ drivers/infiniband/hw/qedr/verbs.h | 2 -- 3 files changed, 9 deletions(-)drivers/infiniband/hw/qedr/main.c +0
-1@@ -212,7 +212,6 @@ static const struct ib_device_ops qedr_dev_ops = { .get_link_layer = qedr_link_layer, .map_mr_sg = qedr_map_mr_sg, .mmap = qedr_mmap, - .modify_port = qedr_modify_port, .modify_qp = qedr_modify_qp, .modify_srq = qedr_modify_srq, .poll_cq = qedr_poll_cq,drivers/infiniband/hw/qedr/verbs.c +0
-6@@ -250,12 +250,6 @@ int qedr_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attr *attr)return 0 ; } -int qedr_modify_port (struct ib_device *ibdev,u8 port,int mask, -struct ib_port_modify *props) -{ -return 0 ; -} -static int qedr_add_mmap (struct qedr_ucontext *uctx,u64 phy_addr,unsigned long len){
drivers/infiniband/hw/qedr/verbs.h +0
-0@@ -35,8 +35,6 @@int qedr_query_device (struct ib_device *ibdev,struct ib_device_attr *attr,struct ib_udata *udata);int
qedr_query_port(struct ib_device *, u8 port, struct ib_port_attr *props); -int qedr_modify_port(structib_device*, u8 port, int mask,drivers/infiniband/hw/qedr/verbs.h +0
-2- struct ib_port_modify *props);int qedr_iw_query_gid (struct ib_device *ibdev,u8 port,int index,union ib_gid *gid); --
Quoted 1 line
2.20.1
Thanks,