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
Dan Carpenter
24c567ff75
IB/hfi1: Fix hfi1_netdev_rx_init() error handling
...
The hfi1_vnic_up() function doesn't check whether hfi1_netdev_rx_init()
returns errors. In hfi1_vnic_init() we need to change the code to
preserve the error code instead of returning success.
Fixes: 2280740f01
("IB/hfi1: Virtual Network Interface Controller (VNIC) HW support")
Fixes: 4730f4a6c6
("IB/hfi1: Activate the dummy netdev")
Link: https://lore.kernel.org/r/20200530140224.GA1330098@mwanda
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-06-02 20:32:54 -03:00
Jason Gunthorpe
4d12c04caa
RDMA: Remove 'max_map_per_fmr'
...
Now that FMR support is gone, this attribute can be deleted from all
places.
Link: https://lore.kernel.org/r/13-v3-f58e6669d5d3+2cf-fmr_removal_jgg@mellanox.com
Reviewed-by: Max Gurtovoy <maxg@mellanox.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-06-02 20:32:54 -03:00
Jason Gunthorpe
649392bf75
RDMA: Remove 'max_fmr'
...
Now that FMR support is gone, this attribute can be deleted from all
places.
Link: https://lore.kernel.org/r/12-v3-f58e6669d5d3+2cf-fmr_removal_jgg@mellanox.com
Reviewed-by: Max Gurtovoy <maxg@mellanox.com >
Reviewed-by: Bernard Metzler <bmt@zurich.ibm.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-06-02 20:32:54 -03:00
Max Gurtovoy
d6747b3715
RDMA/mthca: Remove FMR support for memory registration
...
Remove the ancient and unsafe FMR method.
Link: https://lore.kernel.org/r/9-v3-f58e6669d5d3+2cf-fmr_removal_jgg@mellanox.com
Reviewed-by: Max Gurtovoy <maxg@mellanox.com >
Signed-off-by: Max Gurtovoy <maxg@mellanox.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-06-02 20:32:54 -03:00
Max Gurtovoy
1f55b7ab90
RDMA/mlx4: Remove FMR support for memory registration
...
HCA's that are driven by mlx4 driver support FRWR method to register
memory. Remove the ancient and unsafe FMR method.
Link: https://lore.kernel.org/r/8-v3-f58e6669d5d3+2cf-fmr_removal_jgg@mellanox.com
Reviewed-by: Max Gurtovoy <maxg@mellanox.com >
Signed-off-by: Max Gurtovoy <maxg@mellanox.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-06-02 20:32:54 -03:00
Jason Gunthorpe
f0c73c70db
RDMA/i40iw: Remove FMR leftovers
...
The ibfmr member is never referenced, remove it.
Link: https://lore.kernel.org/r/7-v3-f58e6669d5d3+2cf-fmr_removal_jgg@mellanox.com
Reviewed-by: Max Gurtovoy <maxg@mellanox.com >
Acked-by: Shiraz Saleem <shiraz.saleem@intel.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-06-02 20:32:54 -03:00
Jason Gunthorpe
7c08bc1956
RDMA/bnxt_re: Remove FMR leftovers
...
The bnxt_re_fmr struct is never referenced and the max_fmr items
in bnxt_qplib_dev_attr are never read.
Link: https://lore.kernel.org/r/6-v3-f58e6669d5d3+2cf-fmr_removal_jgg@mellanox.com
Reviewed-by: Max Gurtovoy <maxg@mellanox.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-06-02 20:32:53 -03:00
Gal Pressman
d29d58e772
RDMA/mlx5: Remove FMR leftovers
...
Remove a few leftovers from FMR functionality which are no longer used.
Link: https://lore.kernel.org/r/5-v3-f58e6669d5d3+2cf-fmr_removal_jgg@mellanox.com
Signed-off-by: Gal Pressman <galpress@amazon.com >
Signed-off-by: Max Gurtovoy <maxg@mellanox.com >
Acked-by: Leon Romanovsky <leonro@mellanox.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-06-02 20:32:53 -03:00
Linus Torvalds
e0cd920687
Merge branch 'uaccess.access_ok' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
...
Pull uaccess/access_ok updates from Al Viro:
"Removals of trivially pointless access_ok() calls.
Note: the fiemap stuff was removed from the series, since they are
duplicates with part of ext4 series carried in Ted's tree"
* 'uaccess.access_ok' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
vmci_host: get rid of pointless access_ok()
hfi1: get rid of pointless access_ok()
usb: get rid of pointless access_ok() calls
lpfc_debugfs: get rid of pointless access_ok()
efi_test: get rid of pointless access_ok()
drm_read(): get rid of pointless access_ok()
via-pmu: don't bother with access_ok()
drivers/crypto/ccp/sev-dev.c: get rid of pointless access_ok()
omapfb: get rid of pointless access_ok() calls
amifb: get rid of pointless access_ok() calls
drivers/fpga/dfl-afu-dma-region.c: get rid of pointless access_ok()
drivers/fpga/dfl-fme-pr.c: get rid of pointless access_ok()
cm4000_cs.c cmm_ioctl(): get rid of pointless access_ok()
nvram: drop useless access_ok()
n_hdlc_tty_read(): remove pointless access_ok()
tomoyo_write_control(): get rid of pointless access_ok()
btrfs_ioctl_send(): don't bother with access_ok()
fat_dir_ioctl(): hadn't needed that access_ok() for more than a decade...
dlmfs_file_write(): get rid of pointless access_ok()
2020-06-01 16:09:43 -07:00
David S. Miller
1806c13dc2
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
...
xdp_umem.c had overlapping changes between the 64-bit math fix
for the calculation of npgs and the removal of the zerocopy
memory type which got rid of the chunk_size_nohdr member.
The mlx5 Kconfig conflict is a case where we just take the
net-next copy of the Kconfig entry dependency as it takes on
the ESWITCH dependency by one level of indirection which is
what the 'net' conflicting change is trying to ensure.
Signed-off-by: David S. Miller <davem@davemloft.net >
2020-05-31 17:48:46 -07:00
Saeed Mahameed
971ae1ed03
Merge branch 'mlx5-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux
...
net/mlx5: Add ability to read and write ECE options
net/mlx5: Add support for RDMA TX FT headers modifying
net/mlx5: Move iseg access helper routines close to mlx5_core driver
net/mlx5: Cleanup mlx5_ifc_fte_match_set_misc2_bits
net/mlx5: Add support in forward to namespace
{IB/net}/mlx5: Simplify don't trap code
net/mlx5: Replace zero-length array with flexible-array
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com >
2020-05-29 14:38:57 -07:00
Colin Ian King
bcafcdfdae
IB/hfi1: Fix spelling mistake "enought" -> "enough"
...
There is a spelling mistake in an error message. Fix it.
Link: https://lore.kernel.org/r/20200528110709.400935-1-colin.king@canonical.com
Signed-off-by: Colin Ian King <colin.king@canonical.com >
Acked-by: Dennis Dalessandro <dennis.dalessandro@intel.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-29 15:27:51 -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
Mark Zhang
802dcc7fc5
RDMA/mlx5: Support TX port affinity for VF drivers in LAG mode
...
The mlx5 VF driver doesn't set QP tx port affinity because it doesn't know
if the lag is active or not, since the "lag_active" works only for PF
interfaces. In this case for VF interfaces only one lag is used which
brings performance issue.
Add a lag_tx_port_affinity CAP bit; When it is enabled and
"num_lag_ports > 1", then driver always set QP tx affinity, regardless
of lag state.
Link: https://lore.kernel.org/r/20200527055014.355093-1-leon@kernel.org
Signed-off-by: Mark Zhang <markz@mellanox.com >
Reviewed-by: Maor Gottlieb <maorg@mellanox.com >
Signed-off-by: Leon Romanovsky <leonro@mellanox.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-29 15:15:30 -03:00
Al Viro
fd8ec4dd4a
hfi1: get rid of pointless access_ok()
...
pin_user_pages_fast() doesn't need that from its caller.
NB: only reachable from ->ioctl(), and only under USER_DS
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk >
2020-05-29 11:06:32 -04:00
Leon Romanovsky
50aec2c313
RDMA/mlx5: Return ECE data after modify QP
...
After users sets the ECE option, FW will return the agreed/supported bits
through an output structures of modify QP stages for regular QPs or
through create QP for the DCT.
Link: https://lore.kernel.org/r/20200526115440.205922-9-leon@kernel.org
Reviewed-by: Mark Zhang <markz@mellanox.com >
Signed-off-by: Leon Romanovsky <leonro@mellanox.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-27 16:07:49 -03:00
Leon Romanovsky
5f62a521ff
RDMA/mlx5: Set ECE options during modify QP
...
The most common way to set ECE option will be during modify QP command in
INIT2RTR, RTR2RTS and RTS2RTS stages, so update mlx5 to support it.
The new bit in the comp_mask is needed to mark that kernel supports ECE
and can receive data instead of "reserved" field in the struct
mlx5_ib_modify_qp.
Link: https://lore.kernel.org/r/20200526115440.205922-8-leon@kernel.org
Reviewed-by: Mark Zhang <markz@mellanox.com >
Signed-off-by: Leon Romanovsky <leonro@mellanox.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-27 16:07:49 -03:00
Leon Romanovsky
f18e26af6a
RDMA/mlx5: Convert modify QP to use MLX5_SET macros
...
Instead of hand crafted mlx5_qp_context and mlx5_qp_path use common
MLX5_SET() macros.
Link: https://lore.kernel.org/r/20200526115440.205922-7-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com >
Reviewed-by: Mark Zhang <markz@mellanox.com >
Signed-off-by: Leon Romanovsky <leonro@mellanox.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-27 16:07:49 -03:00
Leon Romanovsky
70bd7fb876
RDMA/mlx5: Remove manually crafted QP context the query call
...
As a preparation to removal hand crafted mlx5_qp_context, convert
query_qp_attr() to use proper MLX5_GET() macros.
Link: https://lore.kernel.org/r/20200526115440.205922-6-leon@kernel.org
Reviewed-by: Mark Zhang <markz@mellanox.com >
Signed-off-by: Leon Romanovsky <leonro@mellanox.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-27 16:07:49 -03:00
Leon Romanovsky
64bae2d455
RDMA/mlx5: Use direct modify QP implementation
...
As a preparation to removal hand crafted mlx5_qp_context, convert counter
code to use mlx5_cmd_exec_in() directly.
Link: https://lore.kernel.org/r/20200526115440.205922-5-leon@kernel.org
Reviewed-by: Mark Zhang <markz@mellanox.com >
Signed-off-by: Leon Romanovsky <leonro@mellanox.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-27 16:07:49 -03:00
Leon Romanovsky
e383085c24
RDMA/mlx5: Set ECE options during QP create
...
Allow users to ask creation of QPs with specific ECE options. Such early
set even before RDMA-CM connection is established is useful if user knows
exactly which option he needs.
Link: https://lore.kernel.org/r/20200526115440.205922-4-leon@kernel.org
Reviewed-by: Mark Zhang <markz@mellanox.com >
Signed-off-by: Leon Romanovsky <leonro@mellanox.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-27 16:07:49 -03:00
Leon Romanovsky
3e09a427ae
RDMA/mlx5: Get ECE options from FW during create QP
...
Supported ECE options are returned from FW in the create_qp phase and zero
means that field is not valid. Such default value allows us to reuse
reserved field without worries about comp_mask.
Update create QP API to return ECE options.
Link: https://lore.kernel.org/r/20200526115440.205922-3-leon@kernel.org
Reviewed-by: Mark Zhang <markz@mellanox.com >
Signed-off-by: Leon Romanovsky <leonro@mellanox.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-27 16:07:49 -03:00
Jason Gunthorpe
e4fdf7625b
Merge branch 'mellanox/mlx5-next' into rdma.git for/next
...
From the mlx5-next branch at
git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux
Required for dependencies in following patches
* branch 'mellanox/mlx5-next':
net/mlx5: Add ability to read and write ECE options
net/mlx5: Add support for RDMA TX FT headers modifying
net/mlx5: Move iseg access helper routines close to mlx5_core driver
net/mlx5: Cleanup mlx5_ifc_fte_match_set_misc2_bits
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-27 16:01:17 -03:00
Mark Zhang
d246a30615
IB/mlx5: Fix DEVX support for MLX5_CMD_OP_INIT2INIT_QP command
...
The commit citied in the Fixes line wasn't complete and solved
only part of the problems. Update the mlx5_ib to properly support
MLX5_CMD_OP_INIT2INIT_QP command in the DEVX, that is required when
modify the QP tx_port_affinity.
Fixes: 819f7427ba
("RDMA/mlx5: Add init2init as a modify command")
Link: https://lore.kernel.org/r/20200527135703.482501-1-leon@kernel.org
Signed-off-by: Mark Zhang <markz@mellanox.com >
Reviewed-by: Maor Gottlieb <maorg@mellanox.com >
Signed-off-by: Leon Romanovsky <leonro@mellanox.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-27 15:53:21 -03:00
Potnuri Bharat Teja
49ea0c036e
RDMA/iw_cxgb4: cleanup device debugfs entries on ULD remove
...
Remove device specific debugfs entries immediately if LLD detaches a
particular ULD device in case of fatal PCI errors.
Link: https://lore.kernel.org/r/20200524190814.17599-1-bharat@chelsio.com
Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-25 15:38:35 -03:00
Qiushi Wu
db857e6ae5
RDMA/pvrdma: Fix missing pci disable in pvrdma_pci_probe()
...
In function pvrdma_pci_probe(), pdev was not disabled in one error
path. Thus replace the jump target “err_free_device” by
"err_disable_pdev".
Fixes: 29c8d9eba5
("IB: Add vmw_pvrdma driver")
Link: https://lore.kernel.org/r/20200523030457.16160-1-wu000273@umn.edu
Signed-off-by: Qiushi Wu <wu000273@umn.edu >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-25 14:24:09 -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
Maor Gottlieb
189277f381
RDMA/mlx5: Fix NULL pointer dereference in destroy_prefetch_work
...
q_deferred_work isn't initialized when creating an explicit ODP memory
region. This can lead to a NULL pointer dereference when user performs
asynchronous prefetch MR. Fix it by initializing q_deferred_work for
explicit ODP.
BUG: kernel NULL pointer dereference, address: 0000000000000000
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
PGD 0 P4D 0
Oops: 0000 [#1 ] SMP PTI
CPU: 4 PID: 6074 Comm: kworker/u16:6 Not tainted 5.7.0-rc1-for-upstream-perf-2020-04-17_07-03-39-64 #1
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014
Workqueue: events_unbound mlx5_ib_prefetch_mr_work [mlx5_ib]
RIP: 0010:__wake_up_common+0x49/0x120
Code: 04 89 54 24 0c 89 4c 24 08 74 0a 41 f6 01 04 0f 85 8e 00 00 00 48 8b 47 08 48 83 e8 18 4c 8d 67 08 48 8d 50 18 49 39 d4 74 66 <48> 8b 70 18 31 db 4c 8d 7e e8 eb 17 49 8b 47 18 48 8d 50 e8 49 8d
RSP: 0000:ffffc9000097bd88 EFLAGS: 00010082
RAX: ffffffffffffffe8 RBX: ffff888454cd9f90 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000003 RDI: ffff888454cd9f90
RBP: ffffc9000097bdd0 R08: 0000000000000000 R09: ffffc9000097bdd0
R10: 0000000000000000 R11: 0000000000000001 R12: ffff888454cd9f98
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000003
FS: 0000000000000000(0000) GS:ffff88846fd00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 000000044c19e002 CR4: 0000000000760ee0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
Call Trace:
__wake_up_common_lock+0x7a/0xc0
destroy_prefetch_work+0x5a/0x60 [mlx5_ib]
mlx5_ib_prefetch_mr_work+0x64/0x80 [mlx5_ib]
process_one_work+0x15b/0x360
worker_thread+0x49/0x3d0
kthread+0xf5/0x130
? rescuer_thread+0x310/0x310
? kthread_bind+0x10/0x10
ret_from_fork+0x1f/0x30
Fixes: de5ed007a0
("IB/mlx5: Fix implicit ODP race")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20200521072504.567406-1-leon@kernel.org
Signed-off-by: Maor Gottlieb <maorg@mellanox.com >
Signed-off-by: Leon Romanovsky <leonro@mellanox.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-21 20:51:50 -03:00
Jason Gunthorpe
0ac8903cbb
RDMA/core: Allow the ioctl layer to abort a fully created uobject
...
While creating a uobject every create reaches a point where the uobject is
fully initialized. For ioctls that go on to copy_to_user this means they
need to open code the destruction of a fully created uobject - ie the
RDMA_REMOVE_DESTROY sort of flow.
Open coding this creates bugs, eg the CQ does not properly flush the
events list when it does its error unwind.
Provide a uverbs_finalize_uobj_create() function which indicates that the
uobject is fully initialized and that abort should call to destroy_hw to
destroy the uobj->object and related.
Methods can call this function if they go on to have error cases after
setting uobj->object. Once done those error cases can simply do return,
without an error unwind.
Link: https://lore.kernel.org/r/20200519072711.257271-2-leon@kernel.org
Signed-off-by: Yishai Hadas <yishaih@mellanox.com >
Signed-off-by: Leon Romanovsky <leonro@mellanox.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-21 20:10:46 -03:00
Jason Gunthorpe
eafd47fc20
Merge tag 'v5.7-rc6' into rdma.git for-next
...
Linux 5.7-rc6
Conflict in drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c
resolved by deleting dr_cq_event, matching how netdev resolved it.
Required for dependencies in the following patches.
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-21 17:08:27 -03:00
Piotr Stankiewicz
0ad45e5fdc
IB/hfi1: Enable the transmit side of the datagram ipoib netdev
...
This patch hooks the transmit side of the datagram netdev with
ipoib by setting the rdma_netdev_get_params function for the
hfi1 ib_device_ops structue. It also enables the receiving side
by adding the AIP capability into the default capabilities.
Link: https://lore.kernel.org/r/20200511160712.173205.65700.stgit@awfm-01.aw.intel.com
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com >
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com >
Signed-off-by: Piotr Stankiewicz <piotr.stankiewicz@intel.com >
Signed-off-by: Kaike Wan <kaike.wan@intel.com >
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-21 11:23:58 -03:00
Grzegorz Andrejczuk
7638c0e965
IB/hfi1: Add packet histogram trace event
...
Add a simple trace event taking context number and building simple
histogram to print packets distribution between contexts.
Link: https://lore.kernel.org/r/20200511160700.173205.84270.stgit@awfm-01.aw.intel.com
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com >
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com >
Signed-off-by: Grzegorz Andrejczuk <grzegorz.andrejczuk@intel.com >
Signed-off-by: Kaike Wan <kaike.wan@intel.com >
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-21 11:23:57 -03:00
Grzegorz Andrejczuk
4730f4a6c6
IB/hfi1: Activate the dummy netdev
...
As described in earlier patches, ipoib netdev will share receive
contexts with existing VNIC netdev through a dummy netdev. The
following changes are made to achieve that:
- Set up netdev receive contexts after user contexts. A function is
added to count the available netdev receive contexts.
- Add functions to set/get receive map table free index.
- Rename NUM_VNIC_MAP_ENTRIES as NUM_NETDEV_MAP_ENTRIES.
- Let the dummy netdev own the receive contexts instead of VNIC.
- Allocate the dummy netdev when the hfi1 device is added and free it
when the device is removed.
- Initialize AIP RSM rules when the IpoIb rxq is initialized and
remove the rules when it is de-initialized.
- Convert VNIC to use the dummy netdev.
Link: https://lore.kernel.org/r/20200511160649.173205.4626.stgit@awfm-01.aw.intel.com
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com >
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com >
Signed-off-by: Sadanand Warrier <sadanand.warrier@intel.com >
Signed-off-by: Grzegorz Andrejczuk <grzegorz.andrejczuk@intel.com >
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-21 11:23:56 -03:00
Grzegorz Andrejczuk
370caa5b58
IB/hfi1: Add rx functions for dummy netdev
...
This patch adds the rx functions for the dummy netdev:
- Functions to allocate/free the dummy netdev.
- Functions to allocate/free receiving contexts for the netdev.
- Functions to initialize/de-initialize the receive queue.
- Functions to enable/disable the receive queue.
Link: https://lore.kernel.org/r/20200511160643.173205.75087.stgit@awfm-01.aw.intel.com
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com >
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com >
Signed-off-by: Sadanand Warrier <sadanand.warrier@intel.com >
Signed-off-by: Grzegorz Andrejczuk <grzegorz.andrejczuk@intel.com >
Signed-off-by: Kaike Wan <kaike.wan@intel.com >
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-21 11:23:56 -03:00
Grzegorz Andrejczuk
0bae02d56b
IB/hfi1: Add interrupt handler functions for accelerated ipoib
...
This patch adds the interrupt handler function, the NAPI poll
function, and its associated helper functions for receiving
accelerated ipoib packets. While we are here, fix the formats
of two error printouts.
Link: https://lore.kernel.org/r/20200511160637.173205.64890.stgit@awfm-01.aw.intel.com
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com >
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com >
Signed-off-by: Sadanand Warrier <sadanand.warrier@intel.com >
Signed-off-by: Grzegorz Andrejczuk <grzegorz.andrejczuk@intel.com >
Signed-off-by: Kaike Wan <kaike.wan@intel.com >
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-21 11:23:56 -03:00
Kaike Wan
6991abcb99
IB/hfi1: Add functions to receive accelerated ipoib packets
...
Ipoib netdev will share receive contexts with existing VNIC netdev.
To achieve that, a dummy netdev is allocated with hfi1_devdata to
own the receive contexts, and ipoib and VNIC netdevs will be put
on top of it. Each receive context is associated with a single
NAPI object.
This patch adds the functions to receive incoming packets for
accelerated ipoib.
Link: https://lore.kernel.org/r/20200511160631.173205.54184.stgit@awfm-01.aw.intel.com
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com >
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com >
Signed-off-by: Sadanand Warrier <sadanand.warrier@intel.com >
Signed-off-by: Grzegorz Andrejczuk <grzegorz.andrejczuk@intel.com >
Signed-off-by: Kaike Wan <kaike.wan@intel.com >
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-21 11:23:56 -03:00
Grzegorz Andrejczuk
89dcaa366b
IB/hfi1: Rename num_vnic_contexts as num_netdev_contexts
...
Rename num_vnic_contexts as num_ndetdev_contexts since VNIC and ipoib
will share the same set of receive contexts.
Link: https://lore.kernel.org/r/20200511160625.173205.53306.stgit@awfm-01.aw.intel.com
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com >
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com >
Signed-off-by: Sadanand Warrier <sadanand.warrier@intel.com >
Signed-off-by: Grzegorz Andrejczuk <grzegorz.andrejczuk@intel.com >
Signed-off-by: Kaike Wan <kaike.wan@intel.com >
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-21 11:23:55 -03:00