All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/7] qed: Fixes series
@ 2017-03-14 13:25 Yuval Mintz
  2017-03-14 13:25 ` [PATCH net 1/7] qed: Align CIDs according to DORQ requirement Yuval Mintz
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Yuval Mintz @ 2017-03-14 13:25 UTC (permalink / raw)
  To: netdev; +Cc: Yuval Mintz

This address several different issues in qed.
The more significant portions:

Patch #1 would cause timeout when qedr utilizes the highest
CIDs availble for it [or when future qede adapters would utilize
queues in some constellations].

Patch #4 fixes a leak of mapped addresses; When iommu is enabled,
offloaded storage protocols might eventually run out of resources
and fail to map additional buffers.

Patches #6,#7 were missing in the initial iSCSI infrastructure
submissions, and would hamper qedi's stability when it reaches
out-of-order scenarios.

Dave,

Please consider applying these to 'net'.

Thanks,
Yuval

Ram Amrani (2):
  qed: Align CIDs according to DORQ requirement
  qed: Fix interrupt flags on Rx LL2

Tomer Tayar (1):
  qed: Prevent creation of too-big u32-chains

Yuval Mintz (4):
  qed: Fix mapping leak on LL2 rx flow
  qed: Free previous connections when releasing iSCSI
  qed: Correct out-of-bound access in OOO history
  qed: Enable iSCSI Out-of-Order

 drivers/net/ethernet/qlogic/qed/qed_cxt.c   |  3 ++-
 drivers/net/ethernet/qlogic/qed/qed_dev.c   |  5 ++---
 drivers/net/ethernet/qlogic/qed/qed_iscsi.c | 31 +++++++++++++++++++++++++++++
 drivers/net/ethernet/qlogic/qed/qed_ll2.c   | 11 ++++++----
 drivers/net/ethernet/qlogic/qed/qed_ooo.c   |  2 ++
 5 files changed, 44 insertions(+), 8 deletions(-)

-- 
1.9.3

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

* [PATCH net 1/7] qed: Align CIDs according to DORQ requirement
  2017-03-14 13:25 [PATCH net 0/7] qed: Fixes series Yuval Mintz
@ 2017-03-14 13:25 ` Yuval Mintz
  2017-03-14 13:25 ` [PATCH net 2/7] qed: Prevent creation of too-big u32-chains Yuval Mintz
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Yuval Mintz @ 2017-03-14 13:25 UTC (permalink / raw)
  To: netdev; +Cc: Ram Amrani, Yuval Mintz

From: Ram Amrani <Ram.Amrani@cavium.com>

The Doorbell HW block can be configured at a granularity
of 16 x CIDs, so we need to make sure that the actual number
of CIDs configured would be a multiplication of 16.

Today, when RoCE is enabled - given that the number is unaligned,
doorbelling the higher CIDs would fail to reach the firmware and
would eventually timeout.

Fixes: dbb799c39717 ("qed: Initialize hardware for new protocols")
Signed-off-by: Ram Amrani <Ram.Amrani@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
---
 drivers/net/ethernet/qlogic/qed/qed_cxt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_cxt.c b/drivers/net/ethernet/qlogic/qed/qed_cxt.c
index d42d03d..7e3a6fe 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_cxt.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_cxt.c
@@ -422,8 +422,9 @@ static void qed_cxt_set_proto_cid_count(struct qed_hwfn *p_hwfn,
 		u32 page_sz = p_mgr->clients[ILT_CLI_CDUC].p_size.val;
 		u32 cxt_size = CONN_CXT_SIZE(p_hwfn);
 		u32 elems_per_page = ILT_PAGE_IN_BYTES(page_sz) / cxt_size;
+		u32 align = elems_per_page * DQ_RANGE_ALIGN;
 
-		p_conn->cid_count = roundup(p_conn->cid_count, elems_per_page);
+		p_conn->cid_count = roundup(p_conn->cid_count, align);
 	}
 }
 
-- 
1.9.3

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

* [PATCH net 2/7] qed: Prevent creation of too-big u32-chains
  2017-03-14 13:25 [PATCH net 0/7] qed: Fixes series Yuval Mintz
  2017-03-14 13:25 ` [PATCH net 1/7] qed: Align CIDs according to DORQ requirement Yuval Mintz
@ 2017-03-14 13:25 ` Yuval Mintz
  2017-03-14 13:26 ` [PATCH net 3/7] qed: Fix mapping leak on LL2 rx flow Yuval Mintz
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Yuval Mintz @ 2017-03-14 13:25 UTC (permalink / raw)
  To: netdev; +Cc: Tomer Tayar, Yuval Mintz

From: Tomer Tayar <Tomer.Tayar@cavium.com>

Current Logic would allow the creation of a chain with U32_MAX + 1
elements, when the actual maximum supported by the driver infrastructure
is U32_MAX.

Fixes: a91eb52abb50 ("qed: Revisit chain implementation")
Signed-off-by: Tomer Tayar <Tomer.Tayar@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
---
 drivers/net/ethernet/qlogic/qed/qed_dev.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c
index e2a081c..e518f91 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_dev.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c
@@ -2389,9 +2389,8 @@ void qed_chain_free(struct qed_dev *cdev, struct qed_chain *p_chain)
 	 * size/capacity fields are of a u32 type.
 	 */
 	if ((cnt_type == QED_CHAIN_CNT_TYPE_U16 &&
-	     chain_size > 0x10000) ||
-	    (cnt_type == QED_CHAIN_CNT_TYPE_U32 &&
-	     chain_size > 0x100000000ULL)) {
+	     chain_size > ((u32)U16_MAX + 1)) ||
+	    (cnt_type == QED_CHAIN_CNT_TYPE_U32 && chain_size > U32_MAX)) {
 		DP_NOTICE(cdev,
 			  "The actual chain size (0x%llx) is larger than the maximal possible value\n",
 			  chain_size);
-- 
1.9.3

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

* [PATCH net 3/7] qed: Fix mapping leak on LL2 rx flow
  2017-03-14 13:25 [PATCH net 0/7] qed: Fixes series Yuval Mintz
  2017-03-14 13:25 ` [PATCH net 1/7] qed: Align CIDs according to DORQ requirement Yuval Mintz
  2017-03-14 13:25 ` [PATCH net 2/7] qed: Prevent creation of too-big u32-chains Yuval Mintz
@ 2017-03-14 13:26 ` Yuval Mintz
  2017-03-14 13:26 ` [PATCH net 4/7] qed: Free previous connections when releasing iSCSI Yuval Mintz
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Yuval Mintz @ 2017-03-14 13:26 UTC (permalink / raw)
  To: netdev; +Cc: Yuval Mintz

When receiving an Rx LL2 packet, qed fails to unmap the previous buffer.

Fixes: 0a7fb11c23c0 ("qed: Add Light L2 support");
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
---
 drivers/net/ethernet/qlogic/qed/qed_ll2.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_ll2.c b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
index 5fb34db..29ae5ec 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_ll2.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
@@ -211,6 +211,8 @@ static void qed_ll2b_complete_rx_packet(struct qed_hwfn *p_hwfn,
 	/* If need to reuse or there's no replacement buffer, repost this */
 	if (rc)
 		goto out_post;
+	dma_unmap_single(&cdev->pdev->dev, buffer->phys_addr,
+			 cdev->ll2->rx_size, DMA_FROM_DEVICE);
 
 	skb = build_skb(buffer->data, 0);
 	if (!skb) {
-- 
1.9.3

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

* [PATCH net 4/7] qed: Free previous connections when releasing iSCSI
  2017-03-14 13:25 [PATCH net 0/7] qed: Fixes series Yuval Mintz
                   ` (2 preceding siblings ...)
  2017-03-14 13:26 ` [PATCH net 3/7] qed: Fix mapping leak on LL2 rx flow Yuval Mintz
@ 2017-03-14 13:26 ` Yuval Mintz
  2017-03-14 13:26 ` [PATCH net 5/7] qed: Fix interrupt flags on Rx LL2 Yuval Mintz
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Yuval Mintz @ 2017-03-14 13:26 UTC (permalink / raw)
  To: netdev; +Cc: Yuval Mintz

Fixes: fc831825f99e ("qed: Add support for hardware offloaded iSCSI")
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
---
 drivers/net/ethernet/qlogic/qed/qed_iscsi.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_iscsi.c b/drivers/net/ethernet/qlogic/qed/qed_iscsi.c
index 3a44d6b..7e73b05 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_iscsi.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_iscsi.c
@@ -786,6 +786,23 @@ static void qed_iscsi_release_connection(struct qed_hwfn *p_hwfn,
 	spin_unlock_bh(&p_hwfn->p_iscsi_info->lock);
 }
 
+void qed_iscsi_free_connection(struct qed_hwfn *p_hwfn,
+			       struct qed_iscsi_conn *p_conn)
+{
+	qed_chain_free(p_hwfn->cdev, &p_conn->xhq);
+	qed_chain_free(p_hwfn->cdev, &p_conn->uhq);
+	qed_chain_free(p_hwfn->cdev, &p_conn->r2tq);
+	dma_free_coherent(&p_hwfn->cdev->pdev->dev,
+			  sizeof(struct tcp_upload_params),
+			  p_conn->tcp_upload_params_virt_addr,
+			  p_conn->tcp_upload_params_phys_addr);
+	dma_free_coherent(&p_hwfn->cdev->pdev->dev,
+			  sizeof(struct scsi_terminate_extra_params),
+			  p_conn->queue_cnts_virt_addr,
+			  p_conn->queue_cnts_phys_addr);
+	kfree(p_conn);
+}
+
 struct qed_iscsi_info *qed_iscsi_alloc(struct qed_hwfn *p_hwfn)
 {
 	struct qed_iscsi_info *p_iscsi_info;
@@ -807,6 +824,17 @@ void qed_iscsi_setup(struct qed_hwfn *p_hwfn,
 void qed_iscsi_free(struct qed_hwfn *p_hwfn,
 		    struct qed_iscsi_info *p_iscsi_info)
 {
+	struct qed_iscsi_conn *p_conn = NULL;
+
+	while (!list_empty(&p_hwfn->p_iscsi_info->free_list)) {
+		p_conn = list_first_entry(&p_hwfn->p_iscsi_info->free_list,
+					  struct qed_iscsi_conn, list_entry);
+		if (p_conn) {
+			list_del(&p_conn->list_entry);
+			qed_iscsi_free_connection(p_hwfn, p_conn);
+		}
+	}
+
 	kfree(p_iscsi_info);
 }
 
-- 
1.9.3

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

* [PATCH net 5/7] qed: Fix interrupt flags on Rx LL2
  2017-03-14 13:25 [PATCH net 0/7] qed: Fixes series Yuval Mintz
                   ` (3 preceding siblings ...)
  2017-03-14 13:26 ` [PATCH net 4/7] qed: Free previous connections when releasing iSCSI Yuval Mintz
@ 2017-03-14 13:26 ` Yuval Mintz
  2017-03-14 13:26 ` [PATCH net 6/7] qed: Correct out-of-bound access in OOO history Yuval Mintz
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Yuval Mintz @ 2017-03-14 13:26 UTC (permalink / raw)
  To: netdev; +Cc: Ram Amrani, Yuval Mintz

From: Ram Amrani <Ram.Amrani@cavium.com>

Before iterating over the the LL2 Rx ring, the ring's
spinlock is taken via spin_lock_irqsave().
The actual processing of the packet [including handling
by the protocol driver] is done without said lock,
so qed releases the spinlock and re-claims it afterwards.

Problem is that the final spin_lock_irqrestore() at the end
of the iteration uses the original flags saved from the
initial irqsave() instead of the flags from the most recent
irqsave(). So it's possible that the interrupt status would
be incorrect at the end of the processing.

Fixes: 0a7fb11c23c0 ("qed: Add Light L2 support");
CC: Ram Amrani <Ram.Amrani@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
---
 drivers/net/ethernet/qlogic/qed/qed_ll2.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_ll2.c b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
index 29ae5ec..0d3cef4 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_ll2.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
@@ -476,7 +476,7 @@ static int qed_ll2_txq_completion(struct qed_hwfn *p_hwfn, void *p_cookie)
 static int qed_ll2_rxq_completion_reg(struct qed_hwfn *p_hwfn,
 				      struct qed_ll2_info *p_ll2_conn,
 				      union core_rx_cqe_union *p_cqe,
-				      unsigned long lock_flags,
+				      unsigned long *p_lock_flags,
 				      bool b_last_cqe)
 {
 	struct qed_ll2_rx_queue *p_rx = &p_ll2_conn->rx_queue;
@@ -497,10 +497,10 @@ static int qed_ll2_rxq_completion_reg(struct qed_hwfn *p_hwfn,
 			  "Mismatch between active_descq and the LL2 Rx chain\n");
 	list_add_tail(&p_pkt->list_entry, &p_rx->free_descq);
 
-	spin_unlock_irqrestore(&p_rx->lock, lock_flags);
+	spin_unlock_irqrestore(&p_rx->lock, *p_lock_flags);
 	qed_ll2b_complete_rx_packet(p_hwfn, p_ll2_conn->my_id,
 				    p_pkt, &p_cqe->rx_cqe_fp, b_last_cqe);
-	spin_lock_irqsave(&p_rx->lock, lock_flags);
+	spin_lock_irqsave(&p_rx->lock, *p_lock_flags);
 
 	return 0;
 }
@@ -540,7 +540,8 @@ static int qed_ll2_rxq_completion(struct qed_hwfn *p_hwfn, void *cookie)
 			break;
 		case CORE_RX_CQE_TYPE_REGULAR:
 			rc = qed_ll2_rxq_completion_reg(p_hwfn, p_ll2_conn,
-							cqe, flags, b_last_cqe);
+							cqe, &flags,
+							b_last_cqe);
 			break;
 		default:
 			rc = -EIO;
-- 
1.9.3

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

* [PATCH net 6/7] qed: Correct out-of-bound access in OOO history
  2017-03-14 13:25 [PATCH net 0/7] qed: Fixes series Yuval Mintz
                   ` (4 preceding siblings ...)
  2017-03-14 13:26 ` [PATCH net 5/7] qed: Fix interrupt flags on Rx LL2 Yuval Mintz
@ 2017-03-14 13:26 ` Yuval Mintz
  2017-03-14 13:26 ` [PATCH net 7/7] qed: Enable iSCSI Out-of-Order Yuval Mintz
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Yuval Mintz @ 2017-03-14 13:26 UTC (permalink / raw)
  To: netdev; +Cc: Yuval Mintz

Need to set the number of entries in database, otherwise the logic
would quickly surpass the array.

Fixes: 1d6cff4fca43 ("qed: Add iSCSI out of order packet handling")
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
---
 drivers/net/ethernet/qlogic/qed/qed_ooo.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_ooo.c b/drivers/net/ethernet/qlogic/qed/qed_ooo.c
index 7d731c6..378afce 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_ooo.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_ooo.c
@@ -159,6 +159,8 @@ struct qed_ooo_info *qed_ooo_alloc(struct qed_hwfn *p_hwfn)
 	if (!p_ooo_info->ooo_history.p_cqes)
 		goto no_history_mem;
 
+	p_ooo_info->ooo_history.num_of_cqes = QED_MAX_NUM_OOO_HISTORY_ENTRIES;
+
 	return p_ooo_info;
 
 no_history_mem:
-- 
1.9.3

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

* [PATCH net 7/7] qed: Enable iSCSI Out-of-Order
  2017-03-14 13:25 [PATCH net 0/7] qed: Fixes series Yuval Mintz
                   ` (5 preceding siblings ...)
  2017-03-14 13:26 ` [PATCH net 6/7] qed: Correct out-of-bound access in OOO history Yuval Mintz
@ 2017-03-14 13:26 ` Yuval Mintz
  2017-03-14 13:29 ` FW: [PATCH net 0/7] qed: Fixes series Mintz, Yuval
  2017-03-14 18:38 ` David Miller
  8 siblings, 0 replies; 10+ messages in thread
From: Yuval Mintz @ 2017-03-14 13:26 UTC (permalink / raw)
  To: netdev; +Cc: Yuval Mintz

Missing in the initial submission, qed fails to propagate qedi's
request to enable OOO to firmware.

Fixes: fc831825f99e ("qed: Add support for hardware offloaded iSCSI")
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
---
 drivers/net/ethernet/qlogic/qed/qed_iscsi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_iscsi.c b/drivers/net/ethernet/qlogic/qed/qed_iscsi.c
index 7e73b05..098766f 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_iscsi.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_iscsi.c
@@ -190,6 +190,9 @@ struct qed_iscsi_conn {
 	p_init->num_sq_pages_in_ring = p_params->num_sq_pages_in_ring;
 	p_init->num_r2tq_pages_in_ring = p_params->num_r2tq_pages_in_ring;
 	p_init->num_uhq_pages_in_ring = p_params->num_uhq_pages_in_ring;
+	p_init->ooo_enable = p_params->ooo_enable;
+	p_init->ll2_rx_queue_id = p_hwfn->hw_info.resc_start[QED_LL2_QUEUE] +
+				  p_params->ll2_ooo_queue_id;
 	p_init->func_params.log_page_size = p_params->log_page_size;
 	val = p_params->num_tasks;
 	p_init->func_params.num_tasks = cpu_to_le16(val);
-- 
1.9.3

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

* FW: [PATCH net 0/7] qed: Fixes series
  2017-03-14 13:25 [PATCH net 0/7] qed: Fixes series Yuval Mintz
                   ` (6 preceding siblings ...)
  2017-03-14 13:26 ` [PATCH net 7/7] qed: Enable iSCSI Out-of-Order Yuval Mintz
@ 2017-03-14 13:29 ` Mintz, Yuval
  2017-03-14 18:38 ` David Miller
  8 siblings, 0 replies; 10+ messages in thread
From: Mintz, Yuval @ 2017-03-14 13:29 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

> Dave,
> 
> Please consider applying these to 'net'.

Apparently I failed adding you on E-mail, sending this only to netdev.
Does that suffice for your needs or do you need a re-send?

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

* Re: [PATCH net 0/7] qed: Fixes series
  2017-03-14 13:25 [PATCH net 0/7] qed: Fixes series Yuval Mintz
                   ` (7 preceding siblings ...)
  2017-03-14 13:29 ` FW: [PATCH net 0/7] qed: Fixes series Mintz, Yuval
@ 2017-03-14 18:38 ` David Miller
  8 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2017-03-14 18:38 UTC (permalink / raw)
  To: Yuval.Mintz; +Cc: netdev

From: Yuval Mintz <Yuval.Mintz@cavium.com>
Date: Tue, 14 Mar 2017 15:25:57 +0200

> This address several different issues in qed.
> The more significant portions:
> 
> Patch #1 would cause timeout when qedr utilizes the highest
> CIDs availble for it [or when future qede adapters would utilize
> queues in some constellations].
> 
> Patch #4 fixes a leak of mapped addresses; When iommu is enabled,
> offloaded storage protocols might eventually run out of resources
> and fail to map additional buffers.
> 
> Patches #6,#7 were missing in the initial iSCSI infrastructure
> submissions, and would hamper qedi's stability when it reaches
> out-of-order scenarios.

Series applied, thank you.

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

end of thread, other threads:[~2017-03-14 18:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-14 13:25 [PATCH net 0/7] qed: Fixes series Yuval Mintz
2017-03-14 13:25 ` [PATCH net 1/7] qed: Align CIDs according to DORQ requirement Yuval Mintz
2017-03-14 13:25 ` [PATCH net 2/7] qed: Prevent creation of too-big u32-chains Yuval Mintz
2017-03-14 13:26 ` [PATCH net 3/7] qed: Fix mapping leak on LL2 rx flow Yuval Mintz
2017-03-14 13:26 ` [PATCH net 4/7] qed: Free previous connections when releasing iSCSI Yuval Mintz
2017-03-14 13:26 ` [PATCH net 5/7] qed: Fix interrupt flags on Rx LL2 Yuval Mintz
2017-03-14 13:26 ` [PATCH net 6/7] qed: Correct out-of-bound access in OOO history Yuval Mintz
2017-03-14 13:26 ` [PATCH net 7/7] qed: Enable iSCSI Out-of-Order Yuval Mintz
2017-03-14 13:29 ` FW: [PATCH net 0/7] qed: Fixes series Mintz, Yuval
2017-03-14 18:38 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.