diff mbox series

[3/4] RDMA/irdma: Make the source udp port vary

Message ID 20220105080727.2143737-4-yanjun.zhu@linux.dev (mailing list archive)
State Superseded
Headers show
Series Generate UDP src port with flow label or lqpn/rqpn | expand

Commit Message

Zhu Yanjun Jan. 5, 2022, 8:07 a.m. UTC
From: Zhu Yanjun <yanjun.zhu@linux.dev>

Get the source udp port number for a QP based on the grh.flow_label or
lqpn/rqrpn. This provides a better spread of traffic across NIC RX queues.

Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
---
 drivers/infiniband/hw/irdma/verbs.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Shiraz Saleem Jan. 4, 2022, 5:18 p.m. UTC | #1
> Subject: [PATCH 3/4] RDMA/irdma: Make the source udp port vary
> 
> From: Zhu Yanjun <yanjun.zhu@linux.dev>
> 
> Get the source udp port number for a QP based on the grh.flow_label or
> lqpn/rqrpn. This provides a better spread of traffic across NIC RX queues.
> 
> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
> ---
>  drivers/infiniband/hw/irdma/verbs.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
> index 8cd5f9261692..09dba7ed5ab9 100644
> --- a/drivers/infiniband/hw/irdma/verbs.c
> +++ b/drivers/infiniband/hw/irdma/verbs.c
> @@ -1167,6 +1167,11 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct
> ib_qp_attr *attr,
> 
>  		memset(&iwqp->roce_ah, 0, sizeof(iwqp->roce_ah));
>  		if (attr->ah_attr.ah_flags & IB_AH_GRH) {
> +			u32 fl = attr->ah_attr.grh.flow_label;
> +			u32 lqp = ibqp->qp_num;
> +			u32 rqp = roce_info->dest_qp;
> +
> +	
Do you really need these locals?

		udp_info->src_port = rdma_get_udp_sport(fl, lqp, rqp);
>  			udp_info->ttl = attr->ah_attr.grh.hop_limit;
>  			udp_info->flow_label = attr->ah_attr.grh.flow_label;
>  			udp_info->tos = attr->ah_attr.grh.traffic_class;
> --
> 2.27.0
Leon Romanovsky Jan. 4, 2022, 7:26 p.m. UTC | #2
On Tue, Jan 04, 2022 at 05:18:01PM +0000, Saleem, Shiraz wrote:
> > Subject: [PATCH 3/4] RDMA/irdma: Make the source udp port vary
> > 
> > From: Zhu Yanjun <yanjun.zhu@linux.dev>
> > 
> > Get the source udp port number for a QP based on the grh.flow_label or
> > lqpn/rqrpn. This provides a better spread of traffic across NIC RX queues.
> > 
> > Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
> > ---
> >  drivers/infiniband/hw/irdma/verbs.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
> > index 8cd5f9261692..09dba7ed5ab9 100644
> > --- a/drivers/infiniband/hw/irdma/verbs.c
> > +++ b/drivers/infiniband/hw/irdma/verbs.c
> > @@ -1167,6 +1167,11 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct
> > ib_qp_attr *attr,
> > 
> >  		memset(&iwqp->roce_ah, 0, sizeof(iwqp->roce_ah));
> >  		if (attr->ah_attr.ah_flags & IB_AH_GRH) {
> > +			u32 fl = attr->ah_attr.grh.flow_label;
> > +			u32 lqp = ibqp->qp_num;
> > +			u32 rqp = roce_info->dest_qp;
> > +
> > +	
> Do you really need these locals?

I asked same question in previous revision.

Zhu, please remove them.

Thanks
Zhu Yanjun Jan. 5, 2022, 12:41 a.m. UTC | #3
在 2022/1/5 3:26, Leon Romanovsky 写道:
> On Tue, Jan 04, 2022 at 05:18:01PM +0000, Saleem, Shiraz wrote:
>>> Subject: [PATCH 3/4] RDMA/irdma: Make the source udp port vary
>>>
>>> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>>>
>>> Get the source udp port number for a QP based on the grh.flow_label or
>>> lqpn/rqrpn. This provides a better spread of traffic across NIC RX queues.
>>>
>>> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
>>> ---
>>>   drivers/infiniband/hw/irdma/verbs.c | 5 +++++
>>>   1 file changed, 5 insertions(+)
>>>
>>> diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
>>> index 8cd5f9261692..09dba7ed5ab9 100644
>>> --- a/drivers/infiniband/hw/irdma/verbs.c
>>> +++ b/drivers/infiniband/hw/irdma/verbs.c
>>> @@ -1167,6 +1167,11 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct
>>> ib_qp_attr *attr,
>>>
>>>   		memset(&iwqp->roce_ah, 0, sizeof(iwqp->roce_ah));
>>>   		if (attr->ah_attr.ah_flags & IB_AH_GRH) {
>>> +			u32 fl = attr->ah_attr.grh.flow_label;
>>> +			u32 lqp = ibqp->qp_num;
>>> +			u32 rqp = roce_info->dest_qp;
>>> +
>>> +	
>> Do you really need these locals?
> 
> I asked same question in previous revision.
> 
> Zhu, please remove them.

Hi, Leon Romanovsky && Saleem, Shiraz

Without these local variables, the line "udp_info->src_port = 
rdma_get_udp_sport(fl, lqp, rqp);" will exceed 80. This will cause 
warning when this commit is checked by script/checkpatch.pl.

Let me have a try to find a better way to avoid these local variables.

Zhu Yanjun

> 
> Thanks
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
index 8cd5f9261692..09dba7ed5ab9 100644
--- a/drivers/infiniband/hw/irdma/verbs.c
+++ b/drivers/infiniband/hw/irdma/verbs.c
@@ -1167,6 +1167,11 @@  int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 
 		memset(&iwqp->roce_ah, 0, sizeof(iwqp->roce_ah));
 		if (attr->ah_attr.ah_flags & IB_AH_GRH) {
+			u32 fl = attr->ah_attr.grh.flow_label;
+			u32 lqp = ibqp->qp_num;
+			u32 rqp = roce_info->dest_qp;
+
+			udp_info->src_port = rdma_get_udp_sport(fl, lqp, rqp);
 			udp_info->ttl = attr->ah_attr.grh.hop_limit;
 			udp_info->flow_label = attr->ah_attr.grh.flow_label;
 			udp_info->tos = attr->ah_attr.grh.traffic_class;