linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.19 030/219] RDMA/hns: Fix the bug while use multi-hop of pbl
       [not found] <20191122054911.1750-1-sashal@kernel.org>
@ 2019-11-22  5:46 ` Sasha Levin
  2019-11-22  5:46 ` [PATCH AUTOSEL 4.19 032/219] RDMA/vmw_pvrdma: Use atomic memory allocation in create AH Sasha Levin
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: Sasha Levin @ 2019-11-22  5:46 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Lijun Ou, Jason Gunthorpe, Sasha Levin, linux-rdma

From: Lijun Ou <oulijun@huawei.com>

[ Upstream commit 4af07f01f7a787ba5158352b98c9e3cb74995a1c ]

It will prevent multiply overflow when defines the pbl for u64 type.

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/infiniband/hw/hns/hns_roce_mr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_mr.c b/drivers/infiniband/hw/hns/hns_roce_mr.c
index 41a538d23b802..c68596d4e8037 100644
--- a/drivers/infiniband/hw/hns/hns_roce_mr.c
+++ b/drivers/infiniband/hw/hns/hns_roce_mr.c
@@ -1017,14 +1017,14 @@ struct ib_mr *hns_roce_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
 			goto err_umem;
 		}
 	} else {
-		int pbl_size = 1;
+		u64 pbl_size = 1;
 
 		bt_size = (1 << (hr_dev->caps.pbl_ba_pg_sz + PAGE_SHIFT)) / 8;
 		for (i = 0; i < hr_dev->caps.pbl_hop_num; i++)
 			pbl_size *= bt_size;
 		if (n > pbl_size) {
 			dev_err(dev,
-			    " MR len %lld err. MR page num is limited to %d!\n",
+			    " MR len %lld err. MR page num is limited to %lld!\n",
 			    length, pbl_size);
 			ret = -EINVAL;
 			goto err_umem;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH AUTOSEL 4.19 032/219] RDMA/vmw_pvrdma: Use atomic memory allocation in create AH
       [not found] <20191122054911.1750-1-sashal@kernel.org>
  2019-11-22  5:46 ` [PATCH AUTOSEL 4.19 030/219] RDMA/hns: Fix the bug while use multi-hop of pbl Sasha Levin
@ 2019-11-22  5:46 ` Sasha Levin
  2019-11-22  5:46 ` [PATCH AUTOSEL 4.19 087/219] net/mlx5: Continue driver initialization despite debugfs failure Sasha Levin
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: Sasha Levin @ 2019-11-22  5:46 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Gal Pressman, Adit Ranadive, Yuval Shaia, Jason Gunthorpe,
	Sasha Levin, linux-rdma

From: Gal Pressman <galpress@amazon.com>

[ Upstream commit a276a4d93bf1580d737f38d1810e5f4b166f3edd ]

Create address handle callback should not sleep, use GFP_ATOMIC instead of
GFP_KERNEL for memory allocation.

Fixes: 29c8d9eba550 ("IB: Add vmw_pvrdma driver")
Cc: Adit Ranadive <aditr@vmware.com>
Signed-off-by: Gal Pressman <galpress@amazon.com>
Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c
index b65d10b0a8759..f4cb5cf26006f 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c
@@ -555,7 +555,7 @@ struct ib_ah *pvrdma_create_ah(struct ib_pd *pd, struct rdma_ah_attr *ah_attr,
 	if (!atomic_add_unless(&dev->num_ahs, 1, dev->dsr->caps.max_ah))
 		return ERR_PTR(-ENOMEM);
 
-	ah = kzalloc(sizeof(*ah), GFP_KERNEL);
+	ah = kzalloc(sizeof(*ah), GFP_ATOMIC);
 	if (!ah) {
 		atomic_dec(&dev->num_ahs);
 		return ERR_PTR(-ENOMEM);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH AUTOSEL 4.19 087/219] net/mlx5: Continue driver initialization despite debugfs failure
       [not found] <20191122054911.1750-1-sashal@kernel.org>
  2019-11-22  5:46 ` [PATCH AUTOSEL 4.19 030/219] RDMA/hns: Fix the bug while use multi-hop of pbl Sasha Levin
  2019-11-22  5:46 ` [PATCH AUTOSEL 4.19 032/219] RDMA/vmw_pvrdma: Use atomic memory allocation in create AH Sasha Levin
@ 2019-11-22  5:46 ` Sasha Levin
  2019-11-22  5:47 ` [PATCH AUTOSEL 4.19 103/219] IB/qib: Fix an error code in qib_sdma_verbs_send() Sasha Levin
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: Sasha Levin @ 2019-11-22  5:46 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Leon Romanovsky, Saeed Mahameed, Sasha Levin, netdev, linux-rdma

From: Leon Romanovsky <leonro@mellanox.com>

[ Upstream commit 199fa087dc6b503baad06712716fac645a983e8a ]

The failure to create debugfs entry is unpleasant event, but not enough
to abort drier initialization. Align the mlx5_core code to debugfs design
and continue execution whenever debugfs_create_dir() successes or not.

Fixes: e126ba97dba9 ("mlx5: Add driver for Mellanox Connect-IB adapters")
Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/mellanox/mlx5/core/main.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 231ed508c240a..5fac00ea62457 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -859,11 +859,9 @@ static int mlx5_pci_init(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
 
 	priv->numa_node = dev_to_node(&dev->pdev->dev);
 
-	priv->dbg_root = debugfs_create_dir(dev_name(&pdev->dev), mlx5_debugfs_root);
-	if (!priv->dbg_root) {
-		dev_err(&pdev->dev, "Cannot create debugfs dir, aborting\n");
-		return -ENOMEM;
-	}
+	if (mlx5_debugfs_root)
+		priv->dbg_root =
+			debugfs_create_dir(pci_name(pdev), mlx5_debugfs_root);
 
 	err = mlx5_pci_enable_device(dev);
 	if (err) {
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH AUTOSEL 4.19 103/219] IB/qib: Fix an error code in qib_sdma_verbs_send()
       [not found] <20191122054911.1750-1-sashal@kernel.org>
                   ` (2 preceding siblings ...)
  2019-11-22  5:46 ` [PATCH AUTOSEL 4.19 087/219] net/mlx5: Continue driver initialization despite debugfs failure Sasha Levin
@ 2019-11-22  5:47 ` Sasha Levin
  2019-11-22  5:47 ` [PATCH AUTOSEL 4.19 112/219] RDMA/srp: Propagate ib_post_send() failures to the SCSI mid-layer Sasha Levin
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: Sasha Levin @ 2019-11-22  5:47 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Dan Carpenter, Jason Gunthorpe, Sasha Levin, linux-rdma

From: Dan Carpenter <dan.carpenter@oracle.com>

[ Upstream commit 5050ae5fa3d54c8e83e1e447cc7e3591110a7f57 ]

We accidentally return success on this error path.

Fixes: f931551bafe1 ("IB/qib: Add new qib driver for QLogic PCIe InfiniBand adapters")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/infiniband/hw/qib/qib_sdma.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/qib/qib_sdma.c b/drivers/infiniband/hw/qib/qib_sdma.c
index d0723d4aef5c9..7424e88b0d918 100644
--- a/drivers/infiniband/hw/qib/qib_sdma.c
+++ b/drivers/infiniband/hw/qib/qib_sdma.c
@@ -576,8 +576,10 @@ int qib_sdma_verbs_send(struct qib_pportdata *ppd,
 		dw = (len + 3) >> 2;
 		addr = dma_map_single(&ppd->dd->pcidev->dev, sge->vaddr,
 				      dw << 2, DMA_TO_DEVICE);
-		if (dma_mapping_error(&ppd->dd->pcidev->dev, addr))
+		if (dma_mapping_error(&ppd->dd->pcidev->dev, addr)) {
+			ret = -ENOMEM;
 			goto unmap;
+		}
 		sdmadesc[0] = 0;
 		make_sdma_desc(ppd, sdmadesc, (u64) addr, dw, dwoffset);
 		/* SDmaUseLargeBuf has to be set in every descriptor */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH AUTOSEL 4.19 112/219] RDMA/srp: Propagate ib_post_send() failures to the SCSI mid-layer
       [not found] <20191122054911.1750-1-sashal@kernel.org>
                   ` (3 preceding siblings ...)
  2019-11-22  5:47 ` [PATCH AUTOSEL 4.19 103/219] IB/qib: Fix an error code in qib_sdma_verbs_send() Sasha Levin
@ 2019-11-22  5:47 ` Sasha Levin
  2019-11-22  5:47 ` [PATCH AUTOSEL 4.19 129/219] IB/rxe: Make counters thread safe Sasha Levin
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: Sasha Levin @ 2019-11-22  5:47 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Bart Van Assche, Sergey Gorenko, Max Gurtovoy, Laurence Oberman,
	Doug Ledford, Sasha Levin, linux-rdma

From: Bart Van Assche <bvanassche@acm.org>

[ Upstream commit 2ee00f6a98c36f7e4ba07cc33f24cc5a69060cc9 ]

This patch avoids that the SCSI mid-layer keeps retrying forever if
ib_post_send() fails. This was discovered while testing immediate
data support and passing a too large num_sge value to ib_post_send().

Cc: Sergey Gorenko <sergeygo@mellanox.com>
Cc: Max Gurtovoy <maxg@mellanox.com>
Cc: Laurence Oberman <loberman@redhat.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/infiniband/ulp/srp/ib_srp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index bc6a44a16445c..03ee53adaacd2 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -2357,6 +2357,7 @@ static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd)
 
 	if (srp_post_send(ch, iu, len)) {
 		shost_printk(KERN_ERR, target->scsi_host, PFX "Send failed\n");
+		scmnd->result = DID_ERROR << 16;
 		goto err_unmap;
 	}
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH AUTOSEL 4.19 129/219] IB/rxe: Make counters thread safe
       [not found] <20191122054911.1750-1-sashal@kernel.org>
                   ` (4 preceding siblings ...)
  2019-11-22  5:47 ` [PATCH AUTOSEL 4.19 112/219] RDMA/srp: Propagate ib_post_send() failures to the SCSI mid-layer Sasha Levin
@ 2019-11-22  5:47 ` Sasha Levin
  2019-11-22  5:48 ` [PATCH AUTOSEL 4.19 160/219] infiniband: bnxt_re: qplib: Check the return value of send_message Sasha Levin
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: Sasha Levin @ 2019-11-22  5:47 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Parav Pandit, Jason Gunthorpe, Sasha Levin, linux-rdma

From: Parav Pandit <parav@mellanox.com>

[ Upstream commit d5108e69fe013ff47ab815b849caba9cc33ca1e5 ]

Current rxe device counters are not thread safe.
When multiple QPs are used, they can be racy.
Make them thread safe by making it atomic64.

Fixes: 0b1e5b99a48b ("IB/rxe: Add port protocol stats")
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/infiniband/sw/rxe/rxe_hw_counters.c | 2 +-
 drivers/infiniband/sw/rxe/rxe_verbs.h       | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_hw_counters.c b/drivers/infiniband/sw/rxe/rxe_hw_counters.c
index 6aeb7a165e469..ea4542a9d69e6 100644
--- a/drivers/infiniband/sw/rxe/rxe_hw_counters.c
+++ b/drivers/infiniband/sw/rxe/rxe_hw_counters.c
@@ -59,7 +59,7 @@ int rxe_ib_get_hw_stats(struct ib_device *ibdev,
 		return -EINVAL;
 
 	for (cnt = 0; cnt  < ARRAY_SIZE(rxe_counter_name); cnt++)
-		stats->value[cnt] = dev->stats_counters[cnt];
+		stats->value[cnt] = atomic64_read(&dev->stats_counters[cnt]);
 
 	return ARRAY_SIZE(rxe_counter_name);
 }
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.h b/drivers/infiniband/sw/rxe/rxe_verbs.h
index 3b731c7682e5b..a61782df4e805 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.h
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.h
@@ -408,16 +408,16 @@ struct rxe_dev {
 	spinlock_t		mmap_offset_lock; /* guard mmap_offset */
 	int			mmap_offset;
 
-	u64			stats_counters[RXE_NUM_OF_COUNTERS];
+	atomic64_t		stats_counters[RXE_NUM_OF_COUNTERS];
 
 	struct rxe_port		port;
 	struct list_head	list;
 	struct crypto_shash	*tfm;
 };
 
-static inline void rxe_counter_inc(struct rxe_dev *rxe, enum rxe_counters cnt)
+static inline void rxe_counter_inc(struct rxe_dev *rxe, enum rxe_counters index)
 {
-	rxe->stats_counters[cnt]++;
+	atomic64_inc(&rxe->stats_counters[index]);
 }
 
 static inline struct rxe_dev *to_rdev(struct ib_device *dev)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH AUTOSEL 4.19 160/219] infiniband: bnxt_re: qplib: Check the return value of send_message
       [not found] <20191122054911.1750-1-sashal@kernel.org>
                   ` (5 preceding siblings ...)
  2019-11-22  5:47 ` [PATCH AUTOSEL 4.19 129/219] IB/rxe: Make counters thread safe Sasha Levin
@ 2019-11-22  5:48 ` Sasha Levin
  2019-11-22  5:48 ` [PATCH AUTOSEL 4.19 161/219] infiniband/qedr: Potential null ptr dereference of qp Sasha Levin
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: Sasha Levin @ 2019-11-22  5:48 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Aditya Pakki, Devesh Sharma, Jason Gunthorpe, Sasha Levin, linux-rdma

From: Aditya Pakki <pakki001@umn.edu>

[ Upstream commit 94edd87a1c59f3efa6fdf4e98d6d492e6cec6173 ]

In bnxt_qplib_map_tc2cos(), bnxt_qplib_rcfw_send_message() can return an
error value but it is lost. Propagate this error to the callers.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Acked-By: Devesh Sharma <devesh.sharma@broadcom.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/infiniband/hw/bnxt_re/qplib_sp.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/bnxt_re/qplib_sp.c b/drivers/infiniband/hw/bnxt_re/qplib_sp.c
index 4097f3fa25c5f..09e7d3dd30553 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_sp.c
+++ b/drivers/infiniband/hw/bnxt_re/qplib_sp.c
@@ -775,9 +775,8 @@ int bnxt_qplib_map_tc2cos(struct bnxt_qplib_res *res, u16 *cids)
 	req.cos0 = cpu_to_le16(cids[0]);
 	req.cos1 = cpu_to_le16(cids[1]);
 
-	bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp, NULL,
-				     0);
-	return 0;
+	return bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp,
+						NULL, 0);
 }
 
 int bnxt_qplib_get_roce_stats(struct bnxt_qplib_rcfw *rcfw,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH AUTOSEL 4.19 161/219] infiniband/qedr: Potential null ptr dereference of qp
       [not found] <20191122054911.1750-1-sashal@kernel.org>
                   ` (6 preceding siblings ...)
  2019-11-22  5:48 ` [PATCH AUTOSEL 4.19 160/219] infiniband: bnxt_re: qplib: Check the return value of send_message Sasha Levin
@ 2019-11-22  5:48 ` Sasha Levin
  2019-11-22  5:49 ` [PATCH AUTOSEL 4.19 211/219] RDMA/hns: Fix the bug with updating rq head pointer when flush cqe Sasha Levin
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: Sasha Levin @ 2019-11-22  5:48 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Aditya Pakki, Michal Kalderon, Jason Gunthorpe, Sasha Levin, linux-rdma

From: Aditya Pakki <pakki001@umn.edu>

[ Upstream commit 9c6260de505b63638dd86fcc33849b17f6146d94 ]

idr_find() may fail and return a NULL pointer. The fix checks the return
value of the function and returns an error in case of NULL.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Acked-by: Michal Kalderon <michal.kalderon@marvell.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/infiniband/hw/qedr/qedr_iw_cm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/infiniband/hw/qedr/qedr_iw_cm.c b/drivers/infiniband/hw/qedr/qedr_iw_cm.c
index 505fa36487629..93b16237b7677 100644
--- a/drivers/infiniband/hw/qedr/qedr_iw_cm.c
+++ b/drivers/infiniband/hw/qedr/qedr_iw_cm.c
@@ -492,6 +492,8 @@ int qedr_iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
 	int i;
 
 	qp = idr_find(&dev->qpidr.idr, conn_param->qpn);
+	if (unlikely(!qp))
+		return -EINVAL;
 
 	laddr = (struct sockaddr_in *)&cm_id->m_local_addr;
 	raddr = (struct sockaddr_in *)&cm_id->m_remote_addr;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH AUTOSEL 4.19 211/219] RDMA/hns: Fix the bug with updating rq head pointer when flush cqe
       [not found] <20191122054911.1750-1-sashal@kernel.org>
                   ` (7 preceding siblings ...)
  2019-11-22  5:48 ` [PATCH AUTOSEL 4.19 161/219] infiniband/qedr: Potential null ptr dereference of qp Sasha Levin
@ 2019-11-22  5:49 ` Sasha Levin
  2019-11-22  5:49 ` [PATCH AUTOSEL 4.19 212/219] RDMA/hns: Bugfix for the scene without receiver queue Sasha Levin
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: Sasha Levin @ 2019-11-22  5:49 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Lijun Ou, Jason Gunthorpe, Sasha Levin, linux-rdma

From: Lijun Ou <oulijun@huawei.com>

[ Upstream commit 9c6ccc035c209dda07685e8dba829a203ba17499 ]

When flush cqe with srq, the driver disable to update the rq head pointer
into the hardware.

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index cf878e1b71fc1..587db5cf3be15 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -3499,13 +3499,16 @@ static int hns_roce_v2_modify_qp(struct ib_qp *ibqp,
 		roce_set_field(qpc_mask->byte_160_sq_ci_pi,
 			       V2_QPC_BYTE_160_SQ_PRODUCER_IDX_M,
 			       V2_QPC_BYTE_160_SQ_PRODUCER_IDX_S, 0);
-		roce_set_field(context->byte_84_rq_ci_pi,
+
+		if (!ibqp->srq) {
+			roce_set_field(context->byte_84_rq_ci_pi,
 			       V2_QPC_BYTE_84_RQ_PRODUCER_IDX_M,
 			       V2_QPC_BYTE_84_RQ_PRODUCER_IDX_S,
 			       hr_qp->rq.head);
-		roce_set_field(qpc_mask->byte_84_rq_ci_pi,
+			roce_set_field(qpc_mask->byte_84_rq_ci_pi,
 			       V2_QPC_BYTE_84_RQ_PRODUCER_IDX_M,
 			       V2_QPC_BYTE_84_RQ_PRODUCER_IDX_S, 0);
+		}
 	}
 
 	if (attr_mask & IB_QP_AV) {
@@ -3967,7 +3970,8 @@ static void hns_roce_set_qps_to_err(struct hns_roce_dev *hr_dev, u32 qpn)
 	if (hr_qp->ibqp.uobject) {
 		if (hr_qp->sdb_en == 1) {
 			hr_qp->sq.head = *(int *)(hr_qp->sdb.virt_addr);
-			hr_qp->rq.head = *(int *)(hr_qp->rdb.virt_addr);
+			if (hr_qp->rdb_en == 1)
+				hr_qp->rq.head = *(int *)(hr_qp->rdb.virt_addr);
 		} else {
 			dev_warn(hr_dev->dev, "flush cqe is unsupported in userspace!\n");
 			return;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH AUTOSEL 4.19 212/219] RDMA/hns: Bugfix for the scene without receiver queue
       [not found] <20191122054911.1750-1-sashal@kernel.org>
                   ` (8 preceding siblings ...)
  2019-11-22  5:49 ` [PATCH AUTOSEL 4.19 211/219] RDMA/hns: Fix the bug with updating rq head pointer when flush cqe Sasha Levin
@ 2019-11-22  5:49 ` Sasha Levin
  2019-11-22  5:49 ` [PATCH AUTOSEL 4.19 213/219] RDMA/hns: Fix the state of rereg mr Sasha Levin
  2019-11-22  5:49 ` [PATCH AUTOSEL 4.19 214/219] RDMA/hns: Use GFP_ATOMIC in hns_roce_v2_modify_qp Sasha Levin
  11 siblings, 0 replies; 12+ messages in thread
From: Sasha Levin @ 2019-11-22  5:49 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Lijun Ou, Jason Gunthorpe, Sasha Levin, linux-rdma

From: Lijun Ou <oulijun@huawei.com>

[ Upstream commit 4d103905eb1e4f14cb62fcf962c9d35da7005dea ]

In some application scenario, the user could not have receive queue when
run rdma write or read operation.

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/infiniband/hw/hns/hns_roce_qp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c
index 2fa4fb17f6d3c..44729ae5f11cd 100644
--- a/drivers/infiniband/hw/hns/hns_roce_qp.c
+++ b/drivers/infiniband/hw/hns/hns_roce_qp.c
@@ -503,7 +503,8 @@ static int hns_roce_qp_has_sq(struct ib_qp_init_attr *attr)
 static int hns_roce_qp_has_rq(struct ib_qp_init_attr *attr)
 {
 	if (attr->qp_type == IB_QPT_XRC_INI ||
-	    attr->qp_type == IB_QPT_XRC_TGT || attr->srq)
+	    attr->qp_type == IB_QPT_XRC_TGT || attr->srq ||
+	    !attr->cap.max_recv_wr)
 		return 0;
 
 	return 1;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH AUTOSEL 4.19 213/219] RDMA/hns: Fix the state of rereg mr
       [not found] <20191122054911.1750-1-sashal@kernel.org>
                   ` (9 preceding siblings ...)
  2019-11-22  5:49 ` [PATCH AUTOSEL 4.19 212/219] RDMA/hns: Bugfix for the scene without receiver queue Sasha Levin
@ 2019-11-22  5:49 ` Sasha Levin
  2019-11-22  5:49 ` [PATCH AUTOSEL 4.19 214/219] RDMA/hns: Use GFP_ATOMIC in hns_roce_v2_modify_qp Sasha Levin
  11 siblings, 0 replies; 12+ messages in thread
From: Sasha Levin @ 2019-11-22  5:49 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Yixian Liu, Jason Gunthorpe, Sasha Levin, linux-rdma

From: Yixian Liu <liuyixian@huawei.com>

[ Upstream commit ab22bf05216a6bb4812448f3a8609489047cf311 ]

The state of mr after reregister operation should be set to valid
state. Otherwise, it will keep the same as the state before reregistered.

Signed-off-by: Yixian Liu <liuyixian@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 587db5cf3be15..9ab3ab3c4219f 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -1773,6 +1773,9 @@ static int hns_roce_v2_rereg_write_mtpt(struct hns_roce_dev *hr_dev,
 	struct hns_roce_v2_mpt_entry *mpt_entry = mb_buf;
 	int ret = 0;
 
+	roce_set_field(mpt_entry->byte_4_pd_hop_st, V2_MPT_BYTE_4_MPT_ST_M,
+		       V2_MPT_BYTE_4_MPT_ST_S, V2_MPT_ST_VALID);
+
 	if (flags & IB_MR_REREG_PD) {
 		roce_set_field(mpt_entry->byte_4_pd_hop_st, V2_MPT_BYTE_4_PD_M,
 			       V2_MPT_BYTE_4_PD_S, pdn);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH AUTOSEL 4.19 214/219] RDMA/hns: Use GFP_ATOMIC in hns_roce_v2_modify_qp
       [not found] <20191122054911.1750-1-sashal@kernel.org>
                   ` (10 preceding siblings ...)
  2019-11-22  5:49 ` [PATCH AUTOSEL 4.19 213/219] RDMA/hns: Fix the state of rereg mr Sasha Levin
@ 2019-11-22  5:49 ` Sasha Levin
  11 siblings, 0 replies; 12+ messages in thread
From: Sasha Levin @ 2019-11-22  5:49 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: YueHaibing, Jason Gunthorpe, Sasha Levin, linux-rdma

From: YueHaibing <yuehaibing@huawei.com>

[ Upstream commit 4e69cf1fe2c52d189acdd06c1fd99cc258aba61f ]

The the below commit, hns_roce_v2_modify_qp is called inside spinlock
while using GFP_KERNEL. Change it to GFP_ATOMIC.

Fixes: 0425e3e6e0c7 ("RDMA/hns: Support flush cqe for hip08 in kernel space")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 9ab3ab3c4219f..2caa95ed966c5 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -3442,7 +3442,7 @@ static int hns_roce_v2_modify_qp(struct ib_qp *ibqp,
 	struct device *dev = hr_dev->dev;
 	int ret = -EINVAL;
 
-	context = kcalloc(2, sizeof(*context), GFP_KERNEL);
+	context = kcalloc(2, sizeof(*context), GFP_ATOMIC);
 	if (!context)
 		return -ENOMEM;
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-11-22  6:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20191122054911.1750-1-sashal@kernel.org>
2019-11-22  5:46 ` [PATCH AUTOSEL 4.19 030/219] RDMA/hns: Fix the bug while use multi-hop of pbl Sasha Levin
2019-11-22  5:46 ` [PATCH AUTOSEL 4.19 032/219] RDMA/vmw_pvrdma: Use atomic memory allocation in create AH Sasha Levin
2019-11-22  5:46 ` [PATCH AUTOSEL 4.19 087/219] net/mlx5: Continue driver initialization despite debugfs failure Sasha Levin
2019-11-22  5:47 ` [PATCH AUTOSEL 4.19 103/219] IB/qib: Fix an error code in qib_sdma_verbs_send() Sasha Levin
2019-11-22  5:47 ` [PATCH AUTOSEL 4.19 112/219] RDMA/srp: Propagate ib_post_send() failures to the SCSI mid-layer Sasha Levin
2019-11-22  5:47 ` [PATCH AUTOSEL 4.19 129/219] IB/rxe: Make counters thread safe Sasha Levin
2019-11-22  5:48 ` [PATCH AUTOSEL 4.19 160/219] infiniband: bnxt_re: qplib: Check the return value of send_message Sasha Levin
2019-11-22  5:48 ` [PATCH AUTOSEL 4.19 161/219] infiniband/qedr: Potential null ptr dereference of qp Sasha Levin
2019-11-22  5:49 ` [PATCH AUTOSEL 4.19 211/219] RDMA/hns: Fix the bug with updating rq head pointer when flush cqe Sasha Levin
2019-11-22  5:49 ` [PATCH AUTOSEL 4.19 212/219] RDMA/hns: Bugfix for the scene without receiver queue Sasha Levin
2019-11-22  5:49 ` [PATCH AUTOSEL 4.19 213/219] RDMA/hns: Fix the state of rereg mr Sasha Levin
2019-11-22  5:49 ` [PATCH AUTOSEL 4.19 214/219] RDMA/hns: Use GFP_ATOMIC in hns_roce_v2_modify_qp Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).