Re: [PATCH v2 for-rc 3/5] RDMA/hns: Remove enable rq inline in kernel and add compatibility handling

Jason Gunthorpe
2022-10-28T16:40:21Z

On Wed, Oct 26, 2022 at 05:50:52PM +0800, Haoyue Xu wrote:
> From: Luoyouming <luoyouming@huawei.com>
>
> The rq inline makes some changes as follows, Firstly, it is only
> used in user space. Secondly, it should notify hardware in QP RTR
> status. Thirdly, Add compatibility processing between different
> user space and kernel space. Change the HNS_ROCE_CAP_FLAG_RQ_INLINE
> to a new bit to prevent old kernel spaces / spaced from enabling
> rq inline.
>
> Signed-off-by: Luoyouming <luoyouming@huawei.com>
> Signed-off-by: Haoyue Xu <xuhaoyue1@hisilicon.com>
> ---
> drivers/infiniband/hw/hns/hns_roce_device.h | 6 +++--
> drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 28 +++++++++++++--------
> drivers/infiniband/hw/hns/hns_roce_main.c | 5 ++++
> drivers/infiniband/hw/hns/hns_roce_qp.c | 2 +-
> include/uapi/rdma/hns-abi.h | 2 ++
> 5 files changed, 30 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h
> index f701cc86896b..9ce053fe737d 100644
> --- a/drivers/infiniband/hw/hns/hns_roce_device.h
> +++ b/drivers/infiniband/hw/hns/hns_roce_device.h
> @@ -132,7 +132,8 @@ enum hns_roce_event {
> enum {
> HNS_ROCE_CAP_FLAG_REREG_MR = BIT(0),
> HNS_ROCE_CAP_FLAG_ROCE_V1_V2 = BIT(1),
> - HNS_ROCE_CAP_FLAG_RQ_INLINE = BIT(2),
> + /* discard this bit, reserved for compatibility */
> + HNS_ROCE_CAP_FLAG_DISCARD = BIT(2),

If it is for compatability with userspace why is this enum not under
include/uapi? Something has gone wrong here, please fix it.

Also, it is better to name this __HNS_ROCE_CAP_FLAG_RQ_INLINE to
indicate it is not used instead of 'discard'

Jason