Yangyang Li
3ec5f54f7a
RDMA/hns: Fix an cmd queue issue when resetting
...
If a IMP reset caused by some hardware errors and hns RoCE driver reset
occurred at the same time, there is a possiblity that the IMP will stop
dealing with command and users can't use the hardware. The logs are as
follows:
hns3 0000:fd:00.1: cleaned 0, need to clean 1
hns3 0000:fd:00.1: firmware version query failed -11
hns3 0000:fd:00.1: Cmd queue init failed
hns3 0000:fd:00.1: Upgrade reset level
hns3 0000:fd:00.1: global reset interrupt
The hns NIC driver divides the reset process into 3 status:
initialization, hardware resetting and softwaring restting. RoCE driver
gets reset status by interfaces provided by NIC driver and commands will
not be sent to the IMP if the driver is in any above status. The main
reason for this issue is that there is a time gap between status 1 and 2,
if the RoCE driver sends commands to the IMP during this gap, the IMP will
stop working because it is not ready.
To eliminate the time gap, the hns NIC driver has added a new interface in
commit a4de02287a
("net: hns3: provide .get_cmdq_stat interface for the
client"), so RoCE driver can ensure that no commands will be sent during
resetting.
Link: https://lore.kernel.org/r/1592314778-52822-1-git-send-email-liweihang@huawei.com
Signed-off-by: Yangyang Li <liyangyang20@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-06-18 10:48:39 -03:00
Yangyang Li
98a6151907
RDMA/hns: Fix a calltrace when registering MR from userspace
...
ibmr.device is assigned after MR is successfully registered, but both
write_mtpt() and frmr_write_mtpt() accesses it during the mr registration
process, which may cause the following error when trying to register MR in
userspace and pbl_hop_num is set to 0.
pc : hns_roce_mtr_find+0xa0/0x200 [hns_roce]
lr : set_mtpt_pbl+0x54/0x118 [hns_roce_hw_v2]
sp : ffff00023e73ba20
x29: ffff00023e73ba20 x28: ffff00023e73bad8
x27: 0000000000000000 x26: 0000000000000000
x25: 0000000000000002 x24: 0000000000000000
x23: ffff00023e73bad0 x22: 0000000000000000
x21: ffff0000094d9000 x20: 0000000000000000
x19: ffff8020a6bdb2c0 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000
x15: 0000000000000000 x14: 0000000000000000
x13: 0140000000000000 x12: 0040000000000041
x11: ffff000240000000 x10: 0000000000001000
x9 : 0000000000000000 x8 : ffff802fb7558480
x7 : ffff802fb7558480 x6 : 000000000003483d
x5 : ffff00023e73bad0 x4 : 0000000000000002
x3 : ffff00023e73bad8 x2 : 0000000000000000
x1 : 0000000000000000 x0 : ffff0000094d9708
Call trace:
hns_roce_mtr_find+0xa0/0x200 [hns_roce]
set_mtpt_pbl+0x54/0x118 [hns_roce_hw_v2]
hns_roce_v2_write_mtpt+0x14c/0x168 [hns_roce_hw_v2]
hns_roce_mr_enable+0x6c/0x148 [hns_roce]
hns_roce_reg_user_mr+0xd8/0x130 [hns_roce]
ib_uverbs_reg_mr+0x14c/0x2e0 [ib_uverbs]
ib_uverbs_write+0x27c/0x3e8 [ib_uverbs]
__vfs_write+0x60/0x190
vfs_write+0xac/0x1c0
ksys_write+0x6c/0xd8
__arm64_sys_write+0x24/0x30
el0_svc_common+0x78/0x130
el0_svc_handler+0x38/0x78
el0_svc+0x8/0xc
Solve above issue by adding a pointer of structure hns_roce_dev as a
parameter of write_mtpt() and frmr_write_mtpt(), so that both of these
functions can access it before finishing MR's registration.
Fixes: 9b2cf76c9f
("RDMA/hns: Optimize PBL buffer allocation process")
Link: https://lore.kernel.org/r/1592314629-51715-1-git-send-email-liweihang@huawei.com
Signed-off-by: Yangyang Li <liyangyang20@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-06-18 10:47:04 -03:00
Masahiro Yamada
a7f7f6248d
treewide: replace '---help---' in Kconfig files with 'help'
...
Since commit 84af7a6194
("checkpatch: kconfig: prefer 'help' over
'---help---'"), the number of '---help---' has been gradually
decreasing, but there are still more than 2400 instances.
This commit finishes the conversion. While I touched the lines,
I also fixed the indentation.
There are a variety of indentation styles found.
a) 4 spaces + '---help---'
b) 7 spaces + '---help---'
c) 8 spaces + '---help---'
d) 1 space + 1 tab + '---help---'
e) 1 tab + '---help---' (correct indentation)
f) 1 tab + 1 space + '---help---'
g) 1 tab + 2 spaces + '---help---'
In order to convert all of them to 1 tab + 'help', I ran the
following commend:
$ find . -name 'Kconfig*' | xargs sed -i 's/^[[:space:]]*---help---/\thelp/'
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org >
2020-06-14 01:57:21 +09:00
Dan Carpenter
87d9e56849
RDMA/hns: Uninitialized variable in modify_qp_init_to_rtr()
...
The "dmac" variable is used before it is initialized.
Fixes: 494c3b3122
("RDMA/hns: Refactor the QP context filling process related to WQE buffer configure")
Link: https://lore.kernel.org/r/20200529083918.GA1298465@mwanda
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com >
Reviewed-by: Leon Romanovsky <leonro@mellanox.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-06-02 20:32:54 -03:00
Colin Ian King
48062b0a8b
RDMA/hns: remove duplicate assignment to pointer raq
...
The pointer raq is being assigned twice. Fix this by removing one of the
redundant assignments.
Fixes: 14ba87304b
("RDMA/hns: Remove redundant type cast for general pointers")
Link: https://lore.kernel.org/r/20200528150427.420624-1-colin.king@canonical.com
Addressses-Coverity: ("Evaluation order violation")
Signed-off-by: Colin Ian King <colin.king@canonical.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-29 15:19:57 -03:00
Yixian Liu
e1b43f07c0
RDMA/hns: Make the end of sge process more clear
...
Instead of i with the sge number of wr will make the comparision more
clear, that is, when the sge number in wr is small than the maximum
supported sge number in the queue, then a stop sge needed to be filled at
the end of sges in wr.
Link: https://lore.kernel.org/r/1590152579-32364-5-git-send-email-liweihang@huawei.com
Signed-off-by: Yixian Liu <liuyixian@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-25 14:20:46 -03:00
Lang Cheng
e4aaf4bad4
RDMA/hns: Simplify process related to poll cq
...
Set hns_roce_v2_cq_set_ci to inline type and remove unnecessary
next_cqe_sw_v2().
Link: https://lore.kernel.org/r/1590152579-32364-4-git-send-email-liweihang@huawei.com
Signed-off-by: Lang Cheng <chenglang@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-25 14:20:45 -03:00
Wenpeng Liang
f226f6765f
RDMA/hns: Remove redundant parameters from free_srq/qp_wrid()
...
The redundant parameters "hr_dev" need to be removed from
free_kernel_wrid() and free_srq_wrid().
Link: https://lore.kernel.org/r/1590152579-32364-3-git-send-email-liweihang@huawei.com
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-25 14:20:45 -03:00
Weihang Li
14ba87304b
RDMA/hns: Remove redundant type cast for general pointers
...
There is no need to do a type cast on genernal pointers, they could be
assigned to any type of variables. In addition, optimize initialization of
some variables and adjust order of them.
Link: https://lore.kernel.org/r/1590152579-32364-2-git-send-email-liweihang@huawei.com
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-25 14:20:45 -03:00
Xi Wang
8e029d386b
RDMA/hns: Optimize the usage of MTR
...
Currently, the MTR region is configed before hns_roce_mtr_map() is
invoked, but in some scenarios, the region is configed at MTR creation,
the caller need to store this config and call hns_roce_mtr_map() later. So
optimize the usage by wrapping the MTR region config into MTR.
Link: https://lore.kernel.org/r/1589982799-28728-10-git-send-email-liweihang@huawei.com
Signed-off-by: Xi Wang <wangxi11@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-25 14:02:13 -03:00
Xi Wang
494c3b3122
RDMA/hns: Refactor the QP context filling process related to WQE buffer configure
...
Split the code related to WQE buffer configure from the QPC filling
process into two functions: config_qp_sq_buf() and config_qp_rq_buf(),
this will make the code more readable.
Link: https://lore.kernel.org/r/1589982799-28728-9-git-send-email-liweihang@huawei.com
Signed-off-by: Xi Wang <wangxi11@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-25 14:02:13 -03:00
Weihang Li
13aa13dddd
RDMA/hns: Change variables representing quantity to unsigned
...
Number of sge/eqe is always non-negative, they should be defined in type
of unsigned.
Link: https://lore.kernel.org/r/1589982799-28728-8-git-send-email-liweihang@huawei.com
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-25 14:02:12 -03:00
Weihang Li
82d07a4e46
RDMA/hns: Change all page_shift to unsigned
...
page_shift is used to calculate the page size, it's always non-negative,
and should be in type of unsigned.
Link: https://lore.kernel.org/r/1589982799-28728-7-git-send-email-liweihang@huawei.com
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-25 14:02:12 -03:00
Xi Wang
e9f2cd2825
RDMA/hns: Rename QP buffer related function
...
Rename the function related to QP buffer to make the code more readable.
Link: https://lore.kernel.org/r/1589982799-28728-6-git-send-email-liweihang@huawei.com
Signed-off-by: Xi Wang <wangxi11@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-25 14:02:12 -03:00
Yangyang Li
b9c93e3aad
RDMA/hns: Remove unused code about assert
...
The codes related to assert are no longer used and need to be deleted.
Link: https://lore.kernel.org/r/1589982799-28728-5-git-send-email-liweihang@huawei.com
Signed-off-by: Yangyang Li <liyangyang20@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-25 14:02:12 -03:00
Lang Cheng
0db6570947
RDMA/hns: Optimize post and poll process
...
Add unlikely() and likely() to optimize main I/O process code.
Link: https://lore.kernel.org/r/1589982799-28728-4-git-send-email-liweihang@huawei.com
Signed-off-by: Lang Cheng <chenglang@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-25 14:02:11 -03:00
Lang Cheng
05e6a5a635
RDMA/hns: Add CQ flag instead of independent enable flag
...
It's easier to understand and maintain enable flags of cq using a single
field in type of u32 than defining a field for every flags in the
structure hns_roce_cq, and we can add new flags for features more
conveniently in the future.
Link: https://lore.kernel.org/r/1589982799-28728-3-git-send-email-liweihang@huawei.com
Signed-off-by: Lang Cheng <chenglang@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-25 14:02:11 -03:00
Lang Cheng
25966e8931
RDMA/hns: Let software PI/CI grow naturally
...
The hardware can truncate PI/CI when posting or polling, the driver does
not need to do truncation. Therefore keep the software's PI/CI consistent
with it in the hardware.
Link: https://lore.kernel.org/r/1589982799-28728-2-git-send-email-liweihang@huawei.com
Signed-off-by: Lang Cheng <chenglang@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-25 14:02:11 -03:00
Lijun Ou
711195e57d
RDMA/hns: Reserve one sge in order to avoid local length error
...
When rq/srq sge length is smaller than sq sge length, it will produce a
local length error and may cause the bus to hang. Therefore, for rq wqe
and srq wqe, one reserved sge pointing to a reserved mr is used to avoid
this error.
Link: https://lore.kernel.org/r/1588931159-56875-10-git-send-email-liweihang@huawei.com
Signed-off-by: Lijun Ou <oulijun@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-19 20:54:59 -03:00
Xi Wang
9581a356cc
RDMA/hns: Rename macro for defining hns hardware page size
...
Rename the PAGE_ADDR_SHIFT as HNS_HW_PAGE_SHIFT to make code more
readable.
Link: https://lore.kernel.org/r/1588931159-56875-9-git-send-email-liweihang@huawei.com
Signed-off-by: Xi Wang <wangxi11@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-19 20:54:59 -03:00
Weihang Li
252067e950
RDMA/hns: Remove redundant memcpy()
...
srq_context is a local variables and is only used to get some fields from
buffer of mailbox. It's meaningless to copy mailbox's buffer's contents
back to it.
Link: https://lore.kernel.org/r/1588931159-56875-8-git-send-email-liweihang@huawei.com
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-19 20:54:58 -03:00
Lang Cheng
7b611d2f6e
RDMA/hns: Store mr len information into mr obj
...
The length information should be stored in the struct ib_mr object,
otherwise the length value of a valid mr object would always be 0.
Link: https://lore.kernel.org/r/1588931159-56875-7-git-send-email-liweihang@huawei.com
Signed-off-by: Lang Cheng <chenglang@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-19 20:54:58 -03:00
Weihang Li
d4d8138741
RDMA/hns: Fix error with to_hr_hem_entries_count()
...
For ilog2(x), if x is 0 and not a constant variable, it will return
-1. And there will be an error as below:
hns3 0000:7d:00.0 hns_0: Local work queue 0x8 catast error, sub_event type is: 2
So modify to_hr_hem_entries_shift() to return 0 if conut is 0.
Fixes: 54d6638765
("RDMA/hns: Optimize WQE buffer size calculating process")
Link: https://lore.kernel.org/r/1588931159-56875-6-git-send-email-liweihang@huawei.com
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-19 20:54:58 -03:00
Weihang Li
6968aeb5aa
RDMA/hns: Fix wrong assignment of SRQ's max_wr
...
srq's attribute max_wr should be 1 less than the total count of wqe.
Fixes: ffb1308b88
("RDMA/hns: Move SRQ code to the reasonable place")
Link: https://lore.kernel.org/r/1588931159-56875-5-git-send-email-liweihang@huawei.com
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-19 20:54:58 -03:00
Wenpeng Liang
053c0acf52
RDMA/hns: Fix assignment to ba_pg_sz of eqe
...
When allocating eq buffer, the size of base address page should be defined
by eqe_ba_pg_sz instead of srqwqe_ba_pg_sz.
Fixes: 477a0a3870
("RDMA/hns: Optimize 0 hop addressing for EQE buffer")
Link: https://lore.kernel.org/r/1588931159-56875-4-git-send-email-liweihang@huawei.com
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-19 20:54:57 -03:00
Lang Cheng
441c88d5b3
RDMA/hns: Fix cmdq parameter of querying pf timer resource
...
The firmware has reduced the number of descriptions of command
HNS_ROCE_OPC_QUERY_PF_TIMER_RES to 1. The driver needs to adapt, otherwise
the hardware will report error 4(CMD_NEXT_ERR).
Fixes: 0e40dc2f70
("RDMA/hns: Add timer allocation support for hip08")
Link: https://lore.kernel.org/r/1588931159-56875-3-git-send-email-liweihang@huawei.com
Signed-off-by: Lang Cheng <chenglang@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-19 20:54:57 -03:00
Lijun Ou
349be27650
RDMA/hns: Bugfix for querying qkey
...
The qkey queried through the query ud qp verb is a fixed value and it
should be read from qp context.
Fixes: 926a01dc00
("RDMA/hns: Add QP operations support for hip08 SoC")
Link: https://lore.kernel.org/r/1588931159-56875-2-git-send-email-liweihang@huawei.com
Signed-off-by: Lijun Ou <oulijun@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-19 20:54:57 -03:00
Lang Cheng
90ae0b57e4
RDMA/hns: Combine enable flags of qp
...
It's easier to understand and maintain enable flags of qp using a single
field in type of unsigned long than defining a field for every flags in
the structure hns_roce_qp, and we can add new flags for features more
conveniently in the future.
Link: https://lore.kernel.org/r/1588674607-25337-4-git-send-email-liweihang@huawei.com
Signed-off-by: Lang Cheng <chenglang@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-12 20:37:06 -03:00
Weihang Li
30661322b8
RDMA/hns: Extend capability flags for HIP08_C
...
12 bits is not enough for HIP08_C, so extend a new field in length of 16
bits for it.
Link: https://lore.kernel.org/r/1588674607-25337-3-git-send-email-liweihang@huawei.com
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-12 20:37:06 -03:00
Wenpeng Liang
e4faa478c6
RDMA/hns: Remove redundant assignment of caps
...
These caps are assigned in query_pf_caps() or set_default_caps(), and
should not be assigned out of these two functions.
Link: https://lore.kernel.org/r/1588242691-12913-4-git-send-email-liweihang@huawei.com
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-06 17:33:20 -03:00
Weihang Li
b713128de7
RDMA/hns: Adjust lp_pktn_ini dynamically
...
lp_pktn_ini means the number of loopback slice packets for long messages,
it should depend on MTU(fixed to 4096B currently) and max size of SQ
inline.
Link: https://lore.kernel.org/r/1588242691-12913-3-git-send-email-liweihang@huawei.com
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-06 17:33:20 -03:00
Weihang Li
23190b8f47
RDMA/hns: Fix comments with non-English symbols
...
There is a comments with some chinese semicolons that cause encoding
issues each time hns_roc_hw_v2.h was modified from a IDE. So fix this by
using correct symbols.
Link: https://lore.kernel.org/r/1588242691-12913-2-git-send-email-liweihang@huawei.com
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-06 17:33:19 -03:00
Xi Wang
67954a6e37
RDMA/hns: Optimize SRQ buffer size calculating process
...
Optimize the SRQ's WQE buffer parameters calculating process to make the
codes more readable by using new functions about multi-hop addressing to
calculating capabilities of SRQ.
Link: https://lore.kernel.org/r/1588071823-40200-6-git-send-email-liweihang@huawei.com
Signed-off-by: Xi Wang <wangxi11@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-06 17:26:44 -03:00
Yixian Liu
ffb1308b88
RDMA/hns: Move SRQ code to the reasonable place
...
Just move the SRQ related code to more reasonable place, and unify format
of some prints.
Link: https://lore.kernel.org/r/1588071823-40200-5-git-send-email-liweihang@huawei.com
Signed-off-by: Yixian Liu <liuyixian@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-06 17:26:43 -03:00
Xi Wang
54d6638765
RDMA/hns: Optimize WQE buffer size calculating process
...
Optimize the QP's WQE buffer parameters calculating process to make the
codes more readable mainly by merging calculation of extended sge space of
kernel and userspace. In addition, add some inline functions to simply
codes about multi-hop addressing.
Link: https://lore.kernel.org/r/1588071823-40200-4-git-send-email-liweihang@huawei.com
Signed-off-by: Xi Wang <wangxi11@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-06 17:26:43 -03:00
Xi Wang
2929c40f08
RDMA/hns: Remove unused MTT functions
...
The MTT (Memory Translate Table) interface is no longer used to configure
the buffer address to BT (Base Address Table) that requires driver
mapping. Because the MTT is not compatible with multi-hop addressing of
the hip08, it is replaced by MTR (Memory Translate Region) interface, and
all the MTT functions should be removed.
Link: https://lore.kernel.org/r/1588071823-40200-3-git-send-email-liweihang@huawei.com
Signed-off-by: Xi Wang <wangxi11@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-06 17:26:43 -03:00
Xi Wang
9b2cf76c9f
RDMA/hns: Optimize PBL buffer allocation process
...
PBL table has its own implementation for multi-hop addressing currently,
but for the hardware, all table's addressing use the same logic, there is
no need to implement repeatedly. So optimize the PBL buffer allocation
process by using the mtr's interfaces.
Link: https://lore.kernel.org/r/1588071823-40200-2-git-send-email-liweihang@huawei.com
Signed-off-by: Xi Wang <wangxi11@huawei.com >
Signed-off-by: Lang Cheng <chenglang@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Reported-by: kbuild test robot <lkp@intel.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-06 17:26:43 -03:00
Maor Gottlieb
fa5d010c56
RDMA: Group create AH arguments in struct
...
Following patch adds additional argument to the create AH function, so it
make sense to group ah_attr and flags arguments in struct.
Link: https://lore.kernel.org/r/20200430192146.12863-13-maorg@mellanox.com
Signed-off-by: Maor Gottlieb <maorg@mellanox.com >
Acked-by: Devesh Sharma <devesh.sharma@broadcom.com >
Acked-by: Gal Pressman <galpress@amazon.com >
Acked-by: Weihang Li <liweihang@huawei.com >
Reviewed-by: Jason Gunthorpe <jgg@mellanox.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-02 20:19:53 -03:00
Lang Cheng
a97bf49f82
RDMA/hns: Simplify the status judgment code of hns_roce_v1_m_qp()
...
Use status table to reduce cyclomatic complexity.
Link: https://lore.kernel.org/r/1586938475-37049-7-git-send-email-liweihang@huawei.com
Signed-off-by: Lang Cheng <chenglang@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-04-24 10:19:11 -03:00
Lang Cheng
357f342946
RDMA/hns: Simplify the state judgment code of qp
...
Use state table to make the qp state migrate code more readable.
Link: https://lore.kernel.org/r/1586938475-37049-6-git-send-email-liweihang@huawei.com
Signed-off-by: Lang Cheng <chenglang@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-04-24 10:19:11 -03:00
Lang Cheng
7c044adca2
RDMA/hns: Simplify the cqe code of poll cq
...
Encapsulate codes to get status of cqe into a function and use map table
instead of switch-case to reduce cyclomatic complexity of
hns_roce_v2_poll_one().
Link: https://lore.kernel.org/r/1586938475-37049-5-git-send-email-liweihang@huawei.com
Signed-off-by: Lang Cheng <chenglang@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-04-24 10:19:10 -03:00
Lang Cheng
a3de9e8381
RDMA/hns: Simplify the qp state convert code
...
Use type map table to reduce the cyclomatic complexity.
Link: https://lore.kernel.org/r/1586938475-37049-4-git-send-email-liweihang@huawei.com
Signed-off-by: Lang Cheng <chenglang@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-04-24 10:19:10 -03:00
Lijun Ou
375898e83d
RDMA/hns: Optimize hns_roce_v2_set_mac()
...
Removes the unnecessary memset opertaion and adjust style of some lines in
hns_roce_v2_set_mac().
Link: https://lore.kernel.org/r/1586938475-37049-3-git-send-email-liweihang@huawei.com
Signed-off-by: Lijun Ou <oulijun@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-04-24 10:19:10 -03:00
Lijun Ou
9976ea27b5
RDMA/hns: Optimize hns_roce_config_link_table()
...
Remove the unnecessary memset operation and adjust style of some lines in
hns_roce_config_link_table().
Link: https://lore.kernel.org/r/1586938475-37049-2-git-send-email-liweihang@huawei.com
Signed-off-by: Lijun Ou <oulijun@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-04-24 10:19:10 -03:00
Xi Wang
744b7bdfa7
RDMA/hns: Support 0 hop addressing for CQE buffer
...
Add the zero hop addressing support by using mtr interface for CQE buffer,
so the hns driver can support addressing hopnum between 0 to 3 for CQE.
Link: https://lore.kernel.org/r/1586779091-51410-7-git-send-email-liweihang@huawei.com
Signed-off-by: Xi Wang <wangxi11@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-04-22 16:22:11 -03:00
Xi Wang
6fd610c573
RDMA/hns: Support 0 hop addressing for SRQ buffer
...
Add the zero hop addressing support by using mtr interface for SRQ buffer,
so the hns driver can support addressing hopnum between 0 to 3 for SRQ.
Link: https://lore.kernel.org/r/1586779091-51410-6-git-send-email-liweihang@huawei.com
Signed-off-by: Xi Wang <wangxi11@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-04-22 16:21:37 -03:00
Xi Wang
d563099e3e
RDMA/hns: Support 0 hop addressing for WQE buffer
...
Add the zero hop addressing support by using new mtr interface for WQE
buffer and simple mtr invoking process, so WQE buffer can support hopnum
between 0 to 3.
Link: https://lore.kernel.org/r/1586779091-51410-5-git-send-email-liweihang@huawei.com
Signed-off-by: Xi Wang <wangxi11@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-04-22 15:59:54 -03:00
Xi Wang
477a0a3870
RDMA/hns: Optimize 0 hop addressing for EQE buffer
...
Use the new mtr interface to simple the hop 0 addressing and multihop
addressing process.
Link: https://lore.kernel.org/r/1586779091-51410-4-git-send-email-liweihang@huawei.com
Signed-off-by: Xi Wang <wangxi11@huawei.com >
Signed-off-by: Lang Cheng <chenglang@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-04-22 15:59:54 -03:00
Xi Wang
cc23267aed
RDMA/hns: Optimize hns buffer allocation flow
...
When the value of nbufs is 1, the buffer is in direct mode, which may cause
confusion. So optimizes current codes to make it easier to maintain and
understand.
Link: https://lore.kernel.org/r/1586779091-51410-3-git-send-email-liweihang@huawei.com
Signed-off-by: Xi Wang <wangxi11@huawei.com >
Signed-off-by: Lang Cheng <chenglang@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-04-22 15:59:54 -03:00
Xi Wang
3c873161a0
RDMA/hns: Add support for addressing when hopnum is 0
...
Currently, WQE and EQE table have already used the mtr interface to config
and access memory by multi-hop addressing when hopnum is from 1 to 3. But
if hopnum is 0, each table need write its own but repetitive logic, and
many duplicate code exists in the mtr interfaces invoke process.
So wraps the public logic as 3 functions: hns_roce_mtr_create(),
hns_roce_mtr_destroy() and hns_roce_mtr_map() to support hopnum ranges from
0 to 3. In addition, makes the mtr interfaces easier to use.
Link: https://lore.kernel.org/r/1586779091-51410-2-git-send-email-liweihang@huawei.com
Signed-off-by: Xi Wang <wangxi11@huawei.com >
Signed-off-by: Weihang Li <liweihang@huawei.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-04-22 15:59:53 -03:00