patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: Rasesh Mody <rmody@marvell.com>
Cc: dpdk stable <stable@dpdk.org>
Subject: [dpdk-stable] patch 'net/qede/base: fix page index for PBL chains' has been queued to LTS release 18.11.6
Date: Tue,  3 Dec 2019 18:27:12 +0000	[thread overview]
Message-ID: <20191203182714.17297-63-ktraynor@redhat.com> (raw)
In-Reply-To: <20191203182714.17297-1-ktraynor@redhat.com>

Hi,

FYI, your patch has been queued to LTS release 18.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/10/19. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable-queue/commit/ca9e7fab8cbd768a945ea6993c4551f63fe7f6c8

Thanks.

Kevin.

---
From ca9e7fab8cbd768a945ea6993c4551f63fe7f6c8 Mon Sep 17 00:00:00 2001
From: Rasesh Mody <rmody@marvell.com>
Date: Sun, 6 Oct 2019 13:14:01 -0700
Subject: [PATCH] net/qede/base: fix page index for PBL chains

[ upstream commit 766d68ac2d116f5a08de0b8667939408ce362c44 ]

ecore_chain_set_prod/cons() sets the wrong page index in chains with
non-power of 2 page count. Fix ecore_chain_set_prod/cons() for PBL
chains with non power of 2 page count.
Calculate the right page index according to current indexes.

Fixes: ec94dbc57362 ("qede: add base driver")

Signed-off-by: Rasesh Mody <rmody@marvell.com>
---
 drivers/net/qede/base/ecore_chain.h | 84 ++++++++++++++++++++---------
 1 file changed, 58 insertions(+), 26 deletions(-)

diff --git a/drivers/net/qede/base/ecore_chain.h b/drivers/net/qede/base/ecore_chain.h
index 6d0382d3a..c69920be5 100644
--- a/drivers/net/qede/base/ecore_chain.h
+++ b/drivers/net/qede/base/ecore_chain.h
@@ -87,6 +87,6 @@ struct ecore_chain {
 
 		union {
-			struct ecore_chain_pbl_u16	u16;
-			struct ecore_chain_pbl_u32	u32;
+			struct ecore_chain_pbl_u16	pbl_u16;
+			struct ecore_chain_pbl_u32	pbl_u32;
 		} c;
 	} pbl;
@@ -406,5 +406,5 @@ static OSAL_INLINE void *ecore_chain_produce(struct ecore_chain *p_chain)
 		     p_chain->elem_per_page_mask) == p_chain->next_page_mask) {
 			p_prod_idx = &p_chain->u.chain16.prod_idx;
-			p_prod_page_idx = &p_chain->pbl.c.u16.prod_page_idx;
+			p_prod_page_idx = &p_chain->pbl.c.pbl_u16.prod_page_idx;
 			ecore_chain_advance_page(p_chain, &p_chain->p_prod_elem,
 						 p_prod_idx, p_prod_page_idx);
@@ -415,5 +415,5 @@ static OSAL_INLINE void *ecore_chain_produce(struct ecore_chain *p_chain)
 		     p_chain->elem_per_page_mask) == p_chain->next_page_mask) {
 			p_prod_idx = &p_chain->u.chain32.prod_idx;
-			p_prod_page_idx = &p_chain->pbl.c.u32.prod_page_idx;
+			p_prod_page_idx = &p_chain->pbl.c.pbl_u32.prod_page_idx;
 			ecore_chain_advance_page(p_chain, &p_chain->p_prod_elem,
 						 p_prod_idx, p_prod_page_idx);
@@ -480,5 +480,5 @@ static OSAL_INLINE void *ecore_chain_consume(struct ecore_chain *p_chain)
 		     p_chain->elem_per_page_mask) == p_chain->next_page_mask) {
 			p_cons_idx = &p_chain->u.chain16.cons_idx;
-			p_cons_page_idx = &p_chain->pbl.c.u16.cons_page_idx;
+			p_cons_page_idx = &p_chain->pbl.c.pbl_u16.cons_page_idx;
 			ecore_chain_advance_page(p_chain, &p_chain->p_cons_elem,
 						 p_cons_idx, p_cons_page_idx);
@@ -489,5 +489,5 @@ static OSAL_INLINE void *ecore_chain_consume(struct ecore_chain *p_chain)
 		     p_chain->elem_per_page_mask) == p_chain->next_page_mask) {
 			p_cons_idx = &p_chain->u.chain32.cons_idx;
-			p_cons_page_idx = &p_chain->pbl.c.u32.cons_page_idx;
+			p_cons_page_idx = &p_chain->pbl.c.pbl_u32.cons_page_idx;
 			ecore_chain_advance_page(p_chain, &p_chain->p_cons_elem,
 						 p_cons_idx, p_cons_page_idx);
@@ -533,9 +533,9 @@ static OSAL_INLINE void ecore_chain_reset(struct ecore_chain *p_chain)
 
 		if (is_chain_u16(p_chain)) {
-			p_chain->pbl.c.u16.prod_page_idx = (u16)reset_val;
-			p_chain->pbl.c.u16.cons_page_idx = (u16)reset_val;
+			p_chain->pbl.c.pbl_u16.prod_page_idx = (u16)reset_val;
+			p_chain->pbl.c.pbl_u16.cons_page_idx = (u16)reset_val;
 		} else {
-			p_chain->pbl.c.u32.prod_page_idx = reset_val;
-			p_chain->pbl.c.u32.cons_page_idx = reset_val;
+			p_chain->pbl.c.pbl_u32.prod_page_idx = reset_val;
+			p_chain->pbl.c.pbl_u32.cons_page_idx = reset_val;
 		}
 	}
@@ -726,16 +726,32 @@ static OSAL_INLINE void ecore_chain_set_prod(struct ecore_chain *p_chain,
 {
 	if (p_chain->mode == ECORE_CHAIN_MODE_PBL) {
-		/* Use "prod_idx-1" since ecore_chain_produce() advances the
-		 * page index before the producer index when getting to
-		 * "next_page_mask".
+		u32 cur_prod, page_mask, page_cnt, page_diff;
+
+		cur_prod = is_chain_u16(p_chain) ? p_chain->u.chain16.prod_idx
+						 : p_chain->u.chain32.prod_idx;
+
+		/* Assume that number of elements in a page is power of 2 */
+		page_mask = ~p_chain->elem_per_page_mask;
+
+		/* Use "cur_prod - 1" and "prod_idx - 1" since producer index
+		 * reaches the first element of next page before the page index
+		 * is incremented. See ecore_chain_produce().
+		 * Index wrap around is not a problem because the difference
+		 * between current and given producer indexes is always
+		 * positive and lower than the chain's capacity.
 		 */
-		u32 elem_idx =
-			(prod_idx - 1 + p_chain->capacity) % p_chain->capacity;
-		u32 page_idx = elem_idx / p_chain->elem_per_page;
+		page_diff = (((cur_prod - 1) & page_mask) -
+			     ((prod_idx - 1) & page_mask)) /
+			    p_chain->elem_per_page;
 
+		page_cnt = ecore_chain_get_page_cnt(p_chain);
 		if (is_chain_u16(p_chain))
-			p_chain->pbl.c.u16.prod_page_idx = (u16)page_idx;
+			p_chain->pbl.c.pbl_u16.prod_page_idx =
+				(p_chain->pbl.c.pbl_u16.prod_page_idx -
+				 page_diff + page_cnt) % page_cnt;
 		else
-			p_chain->pbl.c.u32.prod_page_idx = page_idx;
+			p_chain->pbl.c.pbl_u32.prod_page_idx =
+				(p_chain->pbl.c.pbl_u32.prod_page_idx -
+				 page_diff + page_cnt) % page_cnt;
 	}
 
@@ -757,16 +773,32 @@ static OSAL_INLINE void ecore_chain_set_cons(struct ecore_chain *p_chain,
 {
 	if (p_chain->mode == ECORE_CHAIN_MODE_PBL) {
-		/* Use "cons_idx-1" since ecore_chain_consume() advances the
-		 * page index before the consumer index when getting to
-		 * "next_page_mask".
+		u32 cur_cons, page_mask, page_cnt, page_diff;
+
+		cur_cons = is_chain_u16(p_chain) ? p_chain->u.chain16.cons_idx
+						 : p_chain->u.chain32.cons_idx;
+
+		/* Assume that number of elements in a page is power of 2 */
+		page_mask = ~p_chain->elem_per_page_mask;
+
+		/* Use "cur_cons - 1" and "cons_idx - 1" since consumer index
+		 * reaches the first element of next page before the page index
+		 * is incremented. See ecore_chain_consume().
+		 * Index wrap around is not a problem because the difference
+		 * between current and given consumer indexes is always
+		 * positive and lower than the chain's capacity.
 		 */
-		u32 elem_idx =
-			(cons_idx - 1 + p_chain->capacity) % p_chain->capacity;
-		u32 page_idx = elem_idx / p_chain->elem_per_page;
+		page_diff = (((cur_cons - 1) & page_mask) -
+			     ((cons_idx - 1) & page_mask)) /
+			    p_chain->elem_per_page;
 
+		page_cnt = ecore_chain_get_page_cnt(p_chain);
 		if (is_chain_u16(p_chain))
-			p_chain->pbl.c.u16.cons_page_idx = (u16)page_idx;
+			p_chain->pbl.c.pbl_u16.cons_page_idx =
+				(p_chain->pbl.c.pbl_u16.cons_page_idx -
+				 page_diff + page_cnt) % page_cnt;
 		else
-			p_chain->pbl.c.u32.cons_page_idx = page_idx;
+			p_chain->pbl.c.pbl_u32.cons_page_idx =
+				(p_chain->pbl.c.pbl_u32.cons_page_idx -
+				 page_diff + page_cnt) % page_cnt;
 	}
 
-- 
2.21.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2019-12-03 17:29:55.387004259 +0000
+++ 0063-net-qede-base-fix-page-index-for-PBL-chains.patch	2019-12-03 17:29:51.797748974 +0000
@@ -1 +1 @@
-From 766d68ac2d116f5a08de0b8667939408ce362c44 Mon Sep 17 00:00:00 2001
+From ca9e7fab8cbd768a945ea6993c4551f63fe7f6c8 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 766d68ac2d116f5a08de0b8667939408ce362c44 ]
+
@@ -12 +13,0 @@
-Cc: stable@dpdk.org


  parent reply	other threads:[~2019-12-03 18:29 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-03 18:26 [dpdk-stable] patch 'ethdev: remove redundant device info cleanup before get' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/sfc: fix missing notification on link status change' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'vhost: fix slave request fd leak' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bonding: fix link speed update in broadcast mode' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'app/testpmd: fix crash on port reset' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'vhost: forbid reallocation when running' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'vhost: fix vring address handling during live migration' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'vhost: protect vring access done by application' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/vhost: fix redundant queue state event' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'vhost: fix vring memory partially mapped' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/virtio: fix Rx stats with vectorized functions' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/virtio: get all pending Rx packets in vectorized paths' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/mlx5: fix BlueField VF type recognition' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/cxgbe: add prefix to global functions' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/cxgbe: fix null access when allocating CLIP entry' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/cxgbe: fix slot allocation for IPv6 flows' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/cxgbe: fix parsing VLAN ID rewrite action' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/cxgbe: fix prefetch for non-coalesced Tx packets' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/cxgbe: avoid polling link status before device start' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/ixgbe: fix X553 speed capability' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/i40e: set speed to undefined for default case' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bonding: fix slave id types' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bonding: fix OOB access in other aggregator modes' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/null: fix multi-process Rx and Tx' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bnxt: remove duplicate barrier' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bnxt: replace memory barrier for doorbell response' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bnxt: enforce IO barrier for doorbell command' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bnxt: fix flow steering' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bnxt: fix accessing variable before null check' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/szedata2: fix dependency " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bnxt: fix multicast filter programming' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/qede: limit Rx ring index read for debug' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/atlantic: add FW mailbox guard mutex' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/cxgbe: fix races on flow API operations' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'event/sw: fix xstats reset value' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'event/dpaa2: fix default queue configuration' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'build: avoid overlinking' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'vfio: fix leak with multiprocess' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'service: use log for error messages' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'test/mbuf: fix forged mbuf in clone test' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'eal/ppc: fix 64-bit atomic exchange operation' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'devtools: fix cleanup of checkpatch temporary file' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'event/dpaa: fix number of supported atomic flows' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'test/lpm: fix measured cycles for delete' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'eal/linux: restore specific hugepage ordering for ppc' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'eal: remove dead code on NUMA node detection' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'crypto/dpaa_sec: fix auth-cipher check for AEAD' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'cryptodev: fix checks related to device id' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'doc: fix typo in l2fwd-crypto guide' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'crypto/qat: fix null auth when using VFIO' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'crypto/qat: fix AES CMAC mininum digest size' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'lib/distributor: fix deadlock on aarch64' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'test/distributor: fix spurious failure' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'bus/pci: remove useless link dependency on ethdev' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'net/mlx5: validate flow rule item order' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'test/bonding: fix LSC related cases' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'test/bonding: fix LSC timeout unit' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'net/enic: fix probe for secondary process' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'net/enic: fix crash in " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'net/tap: fix blocked Rx packets' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'net/bnxt: return error if setting link up fails' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'net/bnxt: remove unnecessary variable assignment' " Kevin Traynor
2019-12-03 18:27 ` Kevin Traynor [this message]
2019-12-03 18:27 ` [dpdk-stable] patch 'net/bnxt: fix dereference before null check' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'net/bnxt: cleanup comments' " Kevin Traynor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191203182714.17297-63-ktraynor@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=rmody@marvell.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).