All of lore.kernel.org
 help / color / mirror / Atom feed
From: liweihang <liweihang@huawei.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: "dledford@redhat.com" <dledford@redhat.com>,
	"leon@kernel.org" <leon@kernel.org>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	Linuxarm <linuxarm@huawei.com>
Subject: Re: [PATCH for-next 4/8] RDMA/hns: Add check for the validity of sl configuration in UD SQ WQE
Date: Tue, 17 Nov 2020 06:42:17 +0000	[thread overview]
Message-ID: <5dc53d785c034d0684cd02f2a94d30cb@huawei.com> (raw)
In-Reply-To: 20201116160922.GM917484@nvidia.com

On 2020/11/17 0:09, Jason Gunthorpe wrote:
> On Sat, Nov 14, 2020 at 03:46:58AM +0000, liweihang wrote:
>> On 2020/11/13 2:33, Jason Gunthorpe wrote:
>>> On Fri, Oct 30, 2020 at 07:39:31PM +0800, Weihang Li wrote:
>>>> From: Jiaran Zhang <zhangjiaran@huawei.com>
>>>>
>>>> According to the RoCE v1 specification, the sl (service level) 0-7 are
>>>> mapped directly to priorities 0-7 respectively, sl 8-15 are reserved. The
>>>> driver should verify whether the value of sl is larger than 7, if so, an
>>>> exception should be returned.
>>>>
>>>> Fixes: d6a3627e311c ("RDMA/hns: Optimize wqe buffer set flow for post send")
>>>> Signed-off-by: Jiaran Zhang <zhangjiaran@huawei.com>
>>>> Signed-off-by: Weihang Li <liweihang@huawei.com>
>>>>  drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 10 +++++++++-
>>>>  1 file changed, 9 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
>>>> index 7a1d30f..69386a5 100644
>>>> +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
>>>> @@ -427,9 +427,10 @@ static inline int set_ud_wqe(struct hns_roce_qp *qp,
>>>>  			     void *wqe, unsigned int *sge_idx,
>>>>  			     unsigned int owner_bit)
>>>>  {
>>>> -	struct hns_roce_dev *hr_dev = to_hr_dev(qp->ibqp.device);
>>>>  	struct hns_roce_ah *ah = to_hr_ah(ud_wr(wr)->ah);
>>>>  	struct hns_roce_v2_ud_send_wqe *ud_sq_wqe = wqe;
>>>> +	struct ib_device *ib_dev = qp->ibqp.device;
>>>> +	struct hns_roce_dev *hr_dev = to_hr_dev(ib_dev);
>>>>  	unsigned int curr_idx = *sge_idx;
>>>>  	int valid_num_sge;
>>>>  	u32 msg_len = 0;
>>>> @@ -489,6 +490,13 @@ static inline int set_ud_wqe(struct hns_roce_qp *qp,
>>>>  		       V2_UD_SEND_WQE_BYTE_36_TCLASS_S, ah->av.tclass);
>>>>  	roce_set_field(ud_sq_wqe->byte_40, V2_UD_SEND_WQE_BYTE_40_FLOW_LABEL_M,
>>>>  		       V2_UD_SEND_WQE_BYTE_40_FLOW_LABEL_S, ah->av.flowlabel);
>>>> +
>>>> +	if (unlikely(ah->av.sl > MAX_SERVICE_LEVEL)) {
>>>> +		ibdev_err(ib_dev,
>>>> +			  "failed to fill ud av, ud sl (%d) shouldn't be larger than %d.\n",
>>>> +			  ah->av.sl, MAX_SERVICE_LEVEL);
>>>> +		return -EINVAL;
>>>> +	}
>>>
>>> We should not print for things like this, IIRC userspace can cause the
>>> ah's sl to become set out of bounds
> 
>  
>> In "Annex A 16: RoCE", I found the following description:
>>
>> 	SL 0-7 are mapped directly to Priorities 0-7, respectively
>>
>> 	SL 8-15 are reserved.
>>
>> 	CA16-18: An attempt to use an Address Vector for a RoCE port containing
>> 	a reserved SL value shall result in the Invalid Address Vector verb result.
>>
>> So what should we do if the user wants to use the reserved sl? Should I just let it
>> do mask with 0x7 when creating AH?
> 
> Fail and don't print anything
> 
> Jason
> 

OK, thank you.

Weihang


  reply	other threads:[~2020-11-17  6:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-30 11:39 [PATCH for-next 0/8] RDMA/hns: Support UD for HIP09 Weihang Li
2020-10-30 11:39 ` [PATCH for-next 1/8] RDMA/hns: Only record vlan info for HIP08 Weihang Li
2020-10-30 11:39 ` [PATCH for-next 2/8] RDMA/hns: Fix missing fields in address vector Weihang Li
2020-10-30 11:39 ` [PATCH for-next 3/8] RDMA/hns: Avoid setting loopback indicator when smac is same as dmac Weihang Li
2020-10-30 11:39 ` [PATCH for-next 4/8] RDMA/hns: Add check for the validity of sl configuration in UD SQ WQE Weihang Li
2020-11-12 18:32   ` Jason Gunthorpe
2020-11-14  3:46     ` liweihang
2020-11-16 16:09       ` Jason Gunthorpe
2020-11-17  6:42         ` liweihang [this message]
2020-10-30 11:39 ` [PATCH for-next 5/8] RDMA/hns: Remove the portn field " Weihang Li
2020-10-30 11:39 ` [PATCH for-next 6/8] RDMA/hns: Simplify process of filling " Weihang Li
2020-10-30 11:39 ` [PATCH for-next 7/8] RDMA/hns: Add UD support for HIP09 Weihang Li
2020-11-12 18:35   ` Jason Gunthorpe
2020-11-14  2:43     ` liweihang
2020-10-30 11:39 ` [PATCH for-next 8/8] RDMA/hns: Add support for UD inline Weihang Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5dc53d785c034d0684cd02f2a94d30cb@huawei.com \
    --to=liweihang@huawei.com \
    --cc=dledford@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.