RDMA/hns: Fix ext_sge num error when post send
authorLuoyouming <luoyouming@huawei.com>
Tue, 8 Nov 2022 13:38:46 +0000 (21:38 +0800)
committerJason Gunthorpe <jgg@nvidia.com>
Sat, 19 Nov 2022 00:19:48 +0000 (20:19 -0400)
commit8eaa6f7d569b4a22bfc1b0a3fdfeeb401feb65a4
tree90a63fcd125eee1c15cdbdfa63734dbce030d074
parent7d984dac8f6bf4ebd3398af82b357e1d181ecaac
RDMA/hns: Fix ext_sge num error when post send

In the HNS ROCE driver, The sge is divided into standard sge and extended
sge.  There are 2 standard sge in RC/XRC, and the UD standard sge is 0.
In the scenario of RC SQ inline, if the data does not exceed 32bytes, the
standard sge will be used. If it exceeds, only the extended sge will be
used to fill the data.

Currently, when filling the extended sge, max_gs is directly used as the
number of the extended sge, which did not subtract the number of standard
sge.  There is a logical error. The new algorithm subtracts the number of
standard sge from max_gs to get the actual number of extended sge.

Fixes: 30b707886aeb ("RDMA/hns: Support inline data in extented sge space for RC")
Link: https://lore.kernel.org/r/20221108133847.2304539-2-xuhaoyue1@hisilicon.com
Signed-off-by: Luoyouming <luoyouming@huawei.com>
Signed-off-by: Haoyue Xu <xuhaoyue1@hisilicon.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/hns/hns_roce_hw_v2.c