]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
RDMA/hns: Fix inappropriate err code for unsupported operations
authorJunxian Huang <huangjunxian6@hisilicon.com>
Tue, 14 Nov 2023 12:34:47 +0000 (20:34 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2024 22:52:41 +0000 (14:52 -0800)
[ Upstream commit f45b83ad39f8033e717b1eee57e81811113d5a84 ]

EOPNOTSUPP is more situable than EINVAL for allocating XRCD while XRC
is not supported and unsupported resizing SRQ.

Fixes: 32548870d438 ("RDMA/hns: Add support for XRC on HIP09")
Fixes: 221109e64316 ("RDMA/hns: Add interception for resizing SRQs")
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Link: https://lore.kernel.org/r/20231114123449.1106162-2-huangjunxian6@hisilicon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/hw/hns/hns_roce_hw_v2.c
drivers/infiniband/hw/hns/hns_roce_pd.c

index 6d8f3aa9d6aa9c32a1f8cb22d85739a8d2c0d833..7376f012ece120c85e1c869a5b022ad1ba418d50 100644 (file)
@@ -5442,7 +5442,7 @@ static int hns_roce_v2_modify_srq(struct ib_srq *ibsrq,
 
        /* Resizing SRQs is not supported yet */
        if (srq_attr_mask & IB_SRQ_MAX_WR)
-               return -EINVAL;
+               return -EOPNOTSUPP;
 
        if (srq_attr_mask & IB_SRQ_LIMIT) {
                if (srq_attr->srq_limit > srq->wqe_cnt)
index 81ffad77ae420b9ec3a8c19ed09bb9e8a2f410fa..21bc26bd92d9d95b5f1d6f7122944d4e6b31c043 100644 (file)
@@ -161,7 +161,7 @@ int hns_roce_alloc_xrcd(struct ib_xrcd *ib_xrcd, struct ib_udata *udata)
        int ret;
 
        if (!(hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_XRC))
-               return -EINVAL;
+               return -EOPNOTSUPP;
 
        ret = hns_roce_xrcd_alloc(hr_dev, &xrcd->xrcdn);
        if (ret)