RDMA/core: Unify RoCE check and re-factor code
PATCH 1/1 RDMA/core: Unify RoCE check and re-factor code
In cm_req_handler(), unify the check for RoCE and re-factor to avoid one test.
--- drivers/infiniband/core/cm.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/infiniband/core/cm.c +2 -6
@@ -2138,21 +2138,17 @@ static int cm_req_handler(struct cm_work *work) goto destroy; } -if (cm_id_priv->av.ah_attr.type !=RDMA_AH_ATTR_TYPE_ROCE ) -cm_process_routed_req (req_msg, work->mad_recv_wc->wc); -memset (&work->path[0 ],0 ,sizeof (work->path[0 ]));if (cm_req_has_alt_path (req_msg))memset (&work->path[1 ],0 ,sizeof (work->path[1 ])); grh =rdma_ah_read_grh (&cm_id_priv->av.ah_attr); gid_attr = grh->sgid_attr; -if (gid_attr && -rdma_protocol_roce (work->port->cm_dev->ib_device, - work->port->port_num)) { +if (gid_attr && cm_id_priv->av.ah_attr.type ==RDMA_AH_ATTR_TYPE_ROCE ) { work->path[0 ].rec_type =sa_conv_gid_to_pathrec_type (gid_attr->gid_type); }else { +cm_process_routed_req (req_msg, work->mad_recv_wc->wc); cm_path_set_rec_type( work->port->cm_dev->ib_device, work->port->port_num, &work->path[0],
Signature · 1 line
1.8.3.1
Jason Gunthorpe
maintainerQuoted 22 lines · Håkon Bugge
In
cm_req_handler(), unify the check for RoCE and re-factor to avoid one test.Suggested-by Jason Gunthorpe <[email protected]>Fixes 8f9748602491 ("IB/cm: Reduce dependency on gid attribute ndev check")Fixes 194f64a3cad3 ("RDMA/core: Fix corrupted SL on passive side")Signed-off-by Håkon Bugge <[email protected]>--- drivers/infiniband/core/cm.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/infiniband/core/cm.c +0
-3@@ -2138,21 +2138,17 @@ static int cm_req_handler(struct cm_work *work) goto destroy; } -if (cm_id_priv->av.ah_attr.type !=RDMA_AH_ATTR_TYPE_ROCE ) -cm_process_routed_req (req_msg, work->mad_recv_wc->wc); -
drivers/infiniband/core/cm.c static int cm_req_handler(struct cm_work *work) · line 2147
Quoted 10 lines
drivers/infiniband/core/cm.c +1
-3memset (&work->path[0 ],0 ,sizeof (work->path[0 ]));if (cm_req_has_alt_path (req_msg))memset (&work->path[1 ],0 ,sizeof (work->path[1 ])); grh =rdma_ah_read_grh (&cm_id_priv->av.ah_attr); gid_attr = grh->sgid_attr; -if (gid_attr && -rdma_protocol_roce (work->port->cm_dev->ib_device, - work->port->port_num)) { +if (gid_attr && cm_id_priv->av.ah_attr.type ==RDMA_AH_ATTR_TYPE_ROCE ) {
I think your other note was right, the gid_attr cannot be NULL when in ROCE mode, so we can delete the 'gid_attr &&' term too
Jason
Quoted 33 lines · Jason Gunthorpe
Quoted 28 lines · Håkon Bugge
In
cm_req_handler(), unify the check for RoCE and re-factor to avoid one test.Suggested-by Jason Gunthorpe <[email protected]>Fixes 8f9748602491 ("IB/cm: Reduce dependency on gid attribute ndev check")Fixes 194f64a3cad3 ("RDMA/core: Fix corrupted SL on passive side")Signed-off-by Håkon Bugge <[email protected]>---
drivers/infiniband/core/cm.c| 8 ++------1 file changed, 2 insertions(+), 6 deletions(-)drivers/infiniband/core/cm.c +0
-3@@ -2138,21 +2138,17 @@ static int cm_req_handler(struct cm_work *work) goto destroy; } -if (cm_id_priv->av.ah_attr.type !=RDMA_AH_ATTR_TYPE_ROCE ) -cm_process_routed_req (req_msg, work->mad_recv_wc->wc); -memset (&work->path[0 ],0 ,sizeof (work->path[0 ]));if (cm_req_has_alt_path (req_msg))memset (&work->path[1 ],0 ,sizeof (work->path[1 ])); grh =rdma_ah_read_grh (&cm_id_priv->av.ah_attr); gid_attr = grh->sgid_attr;
Quoted 7 lines
drivers/infiniband/core/cm.c static int cm_req_handler(struct cm_work *work) · line 2147
Quoted 4 lines
drivers/infiniband/core/cm.c +1
-3-if (gid_attr && -rdma_protocol_roce (work->port->cm_dev->ib_device, - work->port->port_num)) { +if (gid_attr && cm_id_priv->av.ah_attr.type ==RDMA_AH_ATTR_TYPE_ROCE ) {I think your other note was right, the
gid_attrcannot be NULL when in ROCE mode, so we can delete the 'gid_attr&&' term too
Shall I send a v2 or do you fix it when you merge?
Håkon
Quoted 45 lines · Haakon Bugge
Quoted 34 lines · Jason Gunthorpe
Quoted 28 lines · Håkon Bugge
In
cm_req_handler(), unify the check for RoCE and re-factor to avoid one test.Suggested-by Jason Gunthorpe <[email protected]>Fixes 8f9748602491 ("IB/cm: Reduce dependency on gid attribute ndev check")Fixes 194f64a3cad3 ("RDMA/core: Fix corrupted SL on passive side")Signed-off-by Håkon Bugge <[email protected]>---
drivers/infiniband/core/cm.c| 8 ++------1 file changed, 2 insertions(+), 6 deletions(-)drivers/infiniband/core/cm.c +0
-3@@ -2138,21 +2138,17 @@ static int cm_req_handler(struct cm_work *work) goto destroy; } -if (cm_id_priv->av.ah_attr.type !=RDMA_AH_ATTR_TYPE_ROCE ) -cm_process_routed_req (req_msg, work->mad_recv_wc->wc); -memset (&work->path[0 ],0 ,sizeof (work->path[0 ]));if (cm_req_has_alt_path (req_msg))memset (&work->path[1 ],0 ,sizeof (work->path[1 ])); grh =rdma_ah_read_grh (&cm_id_priv->av.ah_attr); gid_attr = grh->sgid_attr;Quoted 7 lines
drivers/infiniband/core/cm.c static int cm_req_handler(struct cm_work *work) · line 2147
Quoted 4 lines
drivers/infiniband/core/cm.c +1
-3-if (gid_attr && -rdma_protocol_roce (work->port->cm_dev->ib_device, - work->port->port_num)) { +if (gid_attr && cm_id_priv->av.ah_attr.type ==RDMA_AH_ATTR_TYPE_ROCE ) {I think your other note was right, the
gid_attrcannot be NULL when in ROCE mode, so we can delete the 'gid_attr&&' term too
Quoted 1 line
Shall I send a v2 or do you fix it when you merge?
Have you made up you mind here :-)
Håkon
Quoted 37 lines · Haakon Bugge
Quoted 37 lines
Quoted 36 lines · Jason Gunthorpe
Quoted 20 lines · Håkon Bugge
In
cm_req_handler(), unify the check for RoCE and re-factor to avoid one test.Suggested-by Jason Gunthorpe <[email protected]>Fixes 8f9748602491 ("IB/cm: Reduce dependency on gid attribute ndev check")Fixes 194f64a3cad3 ("RDMA/core: Fix corrupted SL on passive side")Signed-off-by Håkon Bugge <[email protected]>
drivers/infiniband/core/cm.c| 8 ++------1 file changed, 2 insertions(+), 6 deletions(-)drivers/infiniband/core/cm.c +1
-3+++ b/drivers/infiniband/core/cm.c@@ -2138,21 +2138,17 @@ static int cm_req_handler(struct cm_work *work) goto destroy; } -if (cm_id_priv->av.ah_attr.type !=RDMA_AH_ATTR_TYPE_ROCE ) -cm_process_routed_req (req_msg, work->mad_recv_wc->wc); -drivers/infiniband/core/cm.c static int cm_req_handler(struct cm_work *work) · line 2147
Quoted 10 lines
drivers/infiniband/core/cm.c +1
-3memset (&work->path[0 ],0 ,sizeof (work->path[0 ]));if (cm_req_has_alt_path (req_msg))memset (&work->path[1 ],0 ,sizeof (work->path[1 ])); grh =rdma_ah_read_grh (&cm_id_priv->av.ah_attr); gid_attr = grh->sgid_attr; -if (gid_attr && -rdma_protocol_roce (work->port->cm_dev->ib_device, - work->port->port_num)) { +if (gid_attr && cm_id_priv->av.ah_attr.type ==RDMA_AH_ATTR_TYPE_ROCE ) {I think your other note was right, the
gid_attrcannot be NULL when in ROCE mode, so we can delete the 'gid_attr&&' term too
Quoted 3 lines
Quoted 1 line
Shall I send a v2 or do you fix it when you merge?
Have you made up you mind here :-)
Well, I marked it as changes-requested so I guess I did..
But anyway I'll fix it up, it does look obviously correct
Applied to for-next
Jason