patches for DPDK stable branches
 help / color / mirror / Atom feed
* patch 'raw/skeleton: fix selftest' has been queued to stable release 21.11.4
@ 2023-03-22 10:31 Kevin Traynor
  2023-03-22 10:31 ` patch 'reorder: fix sequence number mbuf field register' " Kevin Traynor
                   ` (20 more replies)
  0 siblings, 21 replies; 22+ messages in thread
From: Kevin Traynor @ 2023-03-22 10:31 UTC (permalink / raw)
  To: David Marchand; +Cc: Yu Jiang, Hemant Agrawal, dpdk stable

Hi,

FYI, your patch has been queued to stable release 21.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/24/23. 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

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

Thanks.

Kevin

---
From 7dd9b2a9fad4cc70fff8078ed433d2a863dd8c9d Mon Sep 17 00:00:00 2001
From: David Marchand <david.marchand@redhat.com>
Date: Fri, 10 Mar 2023 15:26:03 +0100
Subject: [PATCH] raw/skeleton: fix selftest

[ upstream commit 365ec3c4fe599048c67cc79817ae9dfa090753cc ]

ASan reported issues in this driver.

rte_rawdev_obj_t context object points at a uint16_t.
skeleton_rawdev_enqueue_bufs() and skeleton_rawdev_dequeue_bufs() were
incorrectly casting to an int.

The enqueue/dequeue selftest had a leak on the enqueued string and was
wrong in passing a rte_rawdev_buf pointer array.
Fix this by allocating buffers on the stack and check that returned
string is the expected one.

Bugzilla ID: 999
Fixes: 61c592a8d035 ("raw/skeleton: introduce skeleton rawdev driver")
Fixes: 55ca1b0f2151 ("raw/skeleton: add test cases")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Tested-by:  Yu Jiang <yux.jiang@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/raw/skeleton/skeleton_rawdev.c      |  4 +-
 drivers/raw/skeleton/skeleton_rawdev_test.c | 46 +++++++++------------
 2 files changed, 21 insertions(+), 29 deletions(-)

diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c
index a49e000146..03b2019e99 100644
--- a/drivers/raw/skeleton/skeleton_rawdev.c
+++ b/drivers/raw/skeleton/skeleton_rawdev.c
@@ -422,5 +422,5 @@ static int skeleton_rawdev_enqueue_bufs(struct rte_rawdev *dev,
 	 * just an integer - for example, a queue-pair.
 	 */
-	q_id = *((int *)context);
+	q_id = *((uint16_t *)context);
 
 	for (i = 0; i < count; i++)
@@ -444,5 +444,5 @@ static int skeleton_rawdev_dequeue_bufs(struct rte_rawdev *dev,
 	 * just an integer - for example, a queue-pair.
 	 */
-	q_id = *((int *)context);
+	q_id = *((uint16_t *)context);
 
 	for (i = 0; i < count; i++)
diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c b/drivers/raw/skeleton/skeleton_rawdev_test.c
index 484468eeb4..cad05ed60f 100644
--- a/drivers/raw/skeleton/skeleton_rawdev_test.c
+++ b/drivers/raw/skeleton/skeleton_rawdev_test.c
@@ -369,40 +369,32 @@ test_rawdev_enqdeq(void)
 {
 	int ret;
-	unsigned int count = 1;
 	uint16_t queue_id = 0;
-	struct rte_rawdev_buf buffers[1];
-	struct rte_rawdev_buf *deq_buffers = NULL;
+	struct rte_rawdev_buf buffer;
+	struct rte_rawdev_buf *buffers[1];
+	struct rte_rawdev_buf deq_buffer;
+	struct rte_rawdev_buf *deq_buffers[1];
 
-	buffers[0].buf_addr = malloc(strlen(TEST_DEV_NAME) + 3);
-	if (!buffers[0].buf_addr)
-		goto cleanup;
-	snprintf(buffers[0].buf_addr, strlen(TEST_DEV_NAME) + 2, "%s%d",
+	buffers[0] = &buffer;
+	buffer.buf_addr = malloc(strlen(TEST_DEV_NAME) + 3);
+	if (!buffer.buf_addr)
+		return TEST_FAILED;
+	snprintf(buffer.buf_addr, strlen(TEST_DEV_NAME) + 2, "%s%d",
 		 TEST_DEV_NAME, 0);
 
-	ret = rte_rawdev_enqueue_buffers(test_dev_id,
-					 (struct rte_rawdev_buf **)&buffers,
-					 count, &queue_id);
-	RTE_TEST_ASSERT_EQUAL((unsigned int)ret, count,
+	ret = rte_rawdev_enqueue_buffers(test_dev_id, buffers,
+					 RTE_DIM(buffers), &queue_id);
+	RTE_TEST_ASSERT_EQUAL((unsigned int)ret, RTE_DIM(buffers),
 			      "Unable to enqueue buffers");
 
-	deq_buffers = malloc(sizeof(struct rte_rawdev_buf) * count);
-	if (!deq_buffers)
-		goto cleanup;
-
-	ret = rte_rawdev_dequeue_buffers(test_dev_id,
-					(struct rte_rawdev_buf **)&deq_buffers,
-					count, &queue_id);
-	RTE_TEST_ASSERT_EQUAL((unsigned int)ret, count,
+	deq_buffers[0] = &deq_buffer;
+	ret = rte_rawdev_dequeue_buffers(test_dev_id, deq_buffers,
+					RTE_DIM(deq_buffers), &queue_id);
+	RTE_TEST_ASSERT_EQUAL((unsigned int)ret, RTE_DIM(buffers),
 			      "Unable to dequeue buffers");
+	RTE_TEST_ASSERT_EQUAL(deq_buffers[0]->buf_addr, buffers[0]->buf_addr,
+			      "Did not retrieve expected object");
 
-	if (deq_buffers)
-		free(deq_buffers);
-
+	free(buffer.buf_addr);
 	return TEST_SUCCESS;
-cleanup:
-	if (buffers[0].buf_addr)
-		free(buffers[0].buf_addr);
-
-	return TEST_FAILED;
 }
 
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-22 10:30:07.955179303 +0000
+++ 0001-raw-skeleton-fix-selftest.patch	2023-03-22 10:30:07.867866508 +0000
@@ -1 +1 @@
-From 365ec3c4fe599048c67cc79817ae9dfa090753cc Mon Sep 17 00:00:00 2001
+From 7dd9b2a9fad4cc70fff8078ed433d2a863dd8c9d Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 365ec3c4fe599048c67cc79817ae9dfa090753cc ]
+
@@ -20 +21,0 @@
-Cc: stable@dpdk.org
@@ -27,2 +28,2 @@
- drivers/raw/skeleton/skeleton_rawdev_test.c | 44 +++++++++------------
- 2 files changed, 21 insertions(+), 27 deletions(-)
+ drivers/raw/skeleton/skeleton_rawdev_test.c | 46 +++++++++------------
+ 2 files changed, 21 insertions(+), 29 deletions(-)
@@ -31 +32 @@
-index 53fe49f936..6e99d35536 100644
+index a49e000146..03b2019e99 100644
@@ -34 +35 @@
-@@ -429,5 +429,5 @@ static int skeleton_rawdev_enqueue_bufs(struct rte_rawdev *dev,
+@@ -422,5 +422,5 @@ static int skeleton_rawdev_enqueue_bufs(struct rte_rawdev *dev,
@@ -41 +42 @@
-@@ -451,5 +451,5 @@ static int skeleton_rawdev_dequeue_bufs(struct rte_rawdev *dev,
+@@ -444,5 +444,5 @@ static int skeleton_rawdev_dequeue_bufs(struct rte_rawdev *dev,
@@ -49 +50 @@
-index ca15c49990..b7a7f623aa 100644
+index 484468eeb4..cad05ed60f 100644
@@ -52 +53 @@
-@@ -371,38 +371,32 @@ test_rawdev_enqdeq(void)
+@@ -369,40 +369,32 @@ test_rawdev_enqdeq(void)
@@ -100 +101,2 @@
--	free(deq_buffers);
+-	if (deq_buffers)
+-		free(deq_buffers);
@@ -105 +107,2 @@
--	free(buffers[0].buf_addr);
+-	if (buffers[0].buf_addr)
+-		free(buffers[0].buf_addr);


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

* patch 'reorder: fix sequence number mbuf field register' has been queued to stable release 21.11.4
  2023-03-22 10:31 patch 'raw/skeleton: fix selftest' has been queued to stable release 21.11.4 Kevin Traynor
@ 2023-03-22 10:31 ` Kevin Traynor
  2023-03-22 10:31 ` patch 'test: fix segment length in packet generator' " Kevin Traynor
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kevin Traynor @ 2023-03-22 10:31 UTC (permalink / raw)
  To: Volodymyr Fialko; +Cc: dpdk stable

Hi,

FYI, your patch has been queued to stable release 21.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/24/23. 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

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

Thanks.

Kevin

---
From b71a128da3d4951b5e872af7a9bf73905cd406a6 Mon Sep 17 00:00:00 2001
From: Volodymyr Fialko <vfialko@marvell.com>
Date: Mon, 13 Mar 2023 14:04:28 +0100
Subject: [PATCH] reorder: fix sequence number mbuf field register

[ upstream commit ec87595f4de01cb81878874d209fa03e6963b3e4 ]

It's possible to initialize reorder buffer with user allocated memory via
rte_reorder_init() function. In such case, rte_reorder_create() is not
required and reorder dynamic field in rte_mbuf will not be registered.

Both reorder lib and mbuf dynamic field are using `rte_mcfg_tailq`
read/write lock for synchronization. To avoid deadlocking, move reorder
buffer initialization before queue insertion.

Fixes: 01f3496695b5 ("reorder: switch sequence number to dynamic mbuf field")

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
---
 lib/reorder/rte_reorder.c | 95 +++++++++++++++++++++++++--------------
 lib/reorder/rte_reorder.h |  1 +
 2 files changed, 62 insertions(+), 34 deletions(-)

diff --git a/lib/reorder/rte_reorder.c b/lib/reorder/rte_reorder.c
index a5b9663aa5..5d4fab17ff 100644
--- a/lib/reorder/rte_reorder.c
+++ b/lib/reorder/rte_reorder.c
@@ -62,4 +62,9 @@ rte_reorder_init(struct rte_reorder_buffer *b, unsigned int bufsize,
 	const unsigned int min_bufsize = sizeof(*b) +
 					(2 * size * sizeof(struct rte_mbuf *));
+	static const struct rte_mbuf_dynfield reorder_seqn_dynfield_desc = {
+		.name = RTE_REORDER_SEQN_DYNFIELD_NAME,
+		.size = sizeof(rte_reorder_seqn_t),
+		.align = __alignof__(rte_reorder_seqn_t),
+	};
 
 	if (b == NULL) {
@@ -88,4 +93,13 @@ rte_reorder_init(struct rte_reorder_buffer *b, unsigned int bufsize,
 	}
 
+	rte_reorder_seqn_dynfield_offset = rte_mbuf_dynfield_register(&reorder_seqn_dynfield_desc);
+	if (rte_reorder_seqn_dynfield_offset < 0) {
+		RTE_LOG(ERR, REORDER,
+			"Failed to register mbuf field for reorder sequence number, rte_errno: %i\n",
+			rte_errno);
+		rte_errno = ENOMEM;
+		return NULL;
+	}
+
 	memset(b, 0, bufsize);
 	strlcpy(b->name, name, sizeof(b->name));
@@ -100,19 +114,43 @@ rte_reorder_init(struct rte_reorder_buffer *b, unsigned int bufsize,
 }
 
+/*
+ * Insert new entry into global list.
+ * Returns pointer to already inserted entry if such exists, or to newly inserted one.
+ */
+static struct rte_tailq_entry *
+rte_reorder_entry_insert(struct rte_tailq_entry *new_te)
+{
+	struct rte_reorder_list *reorder_list;
+	struct rte_reorder_buffer *b, *nb;
+	struct rte_tailq_entry *te;
+
+	rte_mcfg_tailq_write_lock();
+
+	reorder_list = RTE_TAILQ_CAST(rte_reorder_tailq.head, rte_reorder_list);
+	/* guarantee there's no existing */
+	TAILQ_FOREACH(te, reorder_list, next) {
+		b = (struct rte_reorder_buffer *) te->data;
+		nb = (struct rte_reorder_buffer *) new_te->data;
+		if (strncmp(nb->name, b->name, RTE_REORDER_NAMESIZE) == 0)
+			break;
+	}
+
+	if (te == NULL) {
+		TAILQ_INSERT_TAIL(reorder_list, new_te, next);
+		te = new_te;
+	}
+
+	rte_mcfg_tailq_write_unlock();
+
+	return te;
+}
+
 struct rte_reorder_buffer*
 rte_reorder_create(const char *name, unsigned socket_id, unsigned int size)
 {
 	struct rte_reorder_buffer *b = NULL;
-	struct rte_tailq_entry *te;
-	struct rte_reorder_list *reorder_list;
+	struct rte_tailq_entry *te, *te_inserted;
 	const unsigned int bufsize = sizeof(struct rte_reorder_buffer) +
 					(2 * size * sizeof(struct rte_mbuf *));
-	static const struct rte_mbuf_dynfield reorder_seqn_dynfield_desc = {
-		.name = RTE_REORDER_SEQN_DYNFIELD_NAME,
-		.size = sizeof(rte_reorder_seqn_t),
-		.align = __alignof__(rte_reorder_seqn_t),
-	};
-
-	reorder_list = RTE_TAILQ_CAST(rte_reorder_tailq.head, rte_reorder_list);
 
 	/* Check user arguments. */
@@ -130,23 +168,4 @@ rte_reorder_create(const char *name, unsigned socket_id, unsigned int size)
 	}
 
-	rte_reorder_seqn_dynfield_offset =
-		rte_mbuf_dynfield_register(&reorder_seqn_dynfield_desc);
-	if (rte_reorder_seqn_dynfield_offset < 0) {
-		RTE_LOG(ERR, REORDER, "Failed to register mbuf field for reorder sequence number\n");
-		rte_errno = ENOMEM;
-		return NULL;
-	}
-
-	rte_mcfg_tailq_write_lock();
-
-	/* guarantee there's no existing */
-	TAILQ_FOREACH(te, reorder_list, next) {
-		b = (struct rte_reorder_buffer *) te->data;
-		if (strncmp(name, b->name, RTE_REORDER_NAMESIZE) == 0)
-			break;
-	}
-	if (te != NULL)
-		goto exit;
-
 	/* allocate tailq entry */
 	te = rte_zmalloc("REORDER_TAILQ_ENTRY", sizeof(*te), 0);
@@ -154,6 +173,5 @@ rte_reorder_create(const char *name, unsigned socket_id, unsigned int size)
 		RTE_LOG(ERR, REORDER, "Failed to allocate tailq entry\n");
 		rte_errno = ENOMEM;
-		b = NULL;
-		goto exit;
+		return NULL;
 	}
 
@@ -164,12 +182,21 @@ rte_reorder_create(const char *name, unsigned socket_id, unsigned int size)
 		rte_errno = ENOMEM;
 		rte_free(te);
+		return NULL;
 	} else {
-		rte_reorder_init(b, bufsize, name, size);
+		if (rte_reorder_init(b, bufsize, name, size) == NULL) {
+			rte_free(b);
+			rte_free(te);
+			return NULL;
+		}
 		te->data = (void *)b;
-		TAILQ_INSERT_TAIL(reorder_list, te, next);
 	}
 
-exit:
-	rte_mcfg_tailq_write_unlock();
+	te_inserted = rte_reorder_entry_insert(te);
+	if (te_inserted != te) {
+		rte_free(b);
+		rte_free(te);
+		return te_inserted->data;
+	}
+
 	return b;
 }
diff --git a/lib/reorder/rte_reorder.h b/lib/reorder/rte_reorder.h
index dd679da114..0620f36026 100644
--- a/lib/reorder/rte_reorder.h
+++ b/lib/reorder/rte_reorder.h
@@ -82,4 +82,5 @@ rte_reorder_create(const char *name, unsigned socket_id, unsigned int size);
  *   On error case, rte_errno will be set appropriately:
  *    - EINVAL - invalid parameters
+ *    - ENOMEM - not enough memory to register dynamic field
  */
 struct rte_reorder_buffer *
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-22 10:30:07.977686456 +0000
+++ 0002-reorder-fix-sequence-number-mbuf-field-register.patch	2023-03-22 10:30:07.869866511 +0000
@@ -1 +1 @@
-From ec87595f4de01cb81878874d209fa03e6963b3e4 Mon Sep 17 00:00:00 2001
+From b71a128da3d4951b5e872af7a9bf73905cd406a6 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit ec87595f4de01cb81878874d209fa03e6963b3e4 ]
+
@@ -15 +16,0 @@
-Cc: stable@dpdk.org
@@ -24 +25 @@
-index 9026403ea6..4bf36f6df6 100644
+index a5b9663aa5..5d4fab17ff 100644
@@ -163 +164 @@
-index 7ed5f66a2e..f1207f72a9 100644
+index dd679da114..0620f36026 100644
@@ -166 +167 @@
-@@ -83,4 +83,5 @@ rte_reorder_create(const char *name, unsigned socket_id, unsigned int size);
+@@ -82,4 +82,5 @@ rte_reorder_create(const char *name, unsigned socket_id, unsigned int size);


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

* patch 'test: fix segment length in packet generator' has been queued to stable release 21.11.4
  2023-03-22 10:31 patch 'raw/skeleton: fix selftest' has been queued to stable release 21.11.4 Kevin Traynor
  2023-03-22 10:31 ` patch 'reorder: fix sequence number mbuf field register' " Kevin Traynor
@ 2023-03-22 10:31 ` Kevin Traynor
  2023-03-22 10:31 ` patch 'test/mbuf: fix test with mbuf debug enabled' " Kevin Traynor
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kevin Traynor @ 2023-03-22 10:31 UTC (permalink / raw)
  To: Zhuobin Huang; +Cc: David Marchand, dpdk stable

Hi,

FYI, your patch has been queued to stable release 21.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/24/23. 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

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

Thanks.

Kevin

---
From 988dc26cabb05a62859cc343006e8351124b6684 Mon Sep 17 00:00:00 2001
From: Zhuobin Huang <zobin1999@gmail.com>
Date: Mon, 6 Mar 2023 14:51:56 +0800
Subject: [PATCH] test: fix segment length in packet generator

[ upstream commit b88b8af25e7cbb267584bd4c36d3615c4b20109f ]

Assign correct data length to each segments according to the given
pkt_len and nb_pkt_segs, instead of using pkt_len as the data_len
of every packet segment.

Fixes: a9c9e9698d5e ("app/test: allow to create packets of different sizes")

Signed-off-by: Zhuobin Huang <zobin1999@gmail.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
---
 .mailmap                          |  1 +
 app/test/packet_burst_generator.c | 26 ++++++++++++++++----------
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/.mailmap b/.mailmap
index 4018f0fc47..6a56239c3a 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1585,4 +1585,5 @@ Zhirun Yan <zhirun.yan@intel.com>
 Zhiwei He <zhiwei.he@intel.com>
 Zhiyong Yang <zhiyong.yang@intel.com>
+Zhuobin Huang <zobin1999@gmail.com>
 Zi Hu <huzilucky@gmail.com>
 Zijie Pan <zijie.pan@6wind.com>
diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c
index 8ac24577ba..7556bb5512 100644
--- a/app/test/packet_burst_generator.c
+++ b/app/test/packet_burst_generator.c
@@ -263,9 +263,9 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst,
 		int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs)
 {
-	int i, nb_pkt = 0;
-	size_t eth_hdr_size;
-
+	const uint8_t pkt_seg_data_len = pkt_len / nb_pkt_segs;
 	struct rte_mbuf *pkt_seg;
 	struct rte_mbuf *pkt;
+	size_t eth_hdr_size;
+	int i, nb_pkt = 0;
 
 	for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) {
@@ -278,5 +278,5 @@ nomore_mbuf:
 		}
 
-		pkt->data_len = pkt_len;
+		pkt->data_len = pkt_seg_data_len;
 		pkt_seg = pkt;
 		for (i = 1; i < nb_pkt_segs; i++) {
@@ -288,5 +288,8 @@ nomore_mbuf:
 			}
 			pkt_seg = pkt_seg->next;
-			pkt_seg->data_len = pkt_len;
+			if (i != nb_pkt_segs - 1)
+				pkt_seg->data_len = pkt_seg_data_len;
+			else
+				pkt_seg->data_len = pkt_seg_data_len + pkt_len % nb_pkt_segs;
 		}
 		pkt_seg->next = NULL; /* Last segment of packet. */
@@ -344,9 +347,9 @@ generate_packet_burst_proto(struct rte_mempool *mp,
 		int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs)
 {
-	int i, nb_pkt = 0;
-	size_t eth_hdr_size;
-
+	const uint8_t pkt_seg_data_len = pkt_len / nb_pkt_segs;
 	struct rte_mbuf *pkt_seg;
 	struct rte_mbuf *pkt;
+	size_t eth_hdr_size;
+	int i, nb_pkt = 0;
 
 	for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) {
@@ -359,5 +362,5 @@ nomore_mbuf:
 		}
 
-		pkt->data_len = pkt_len;
+		pkt->data_len = pkt_seg_data_len;
 		pkt_seg = pkt;
 		for (i = 1; i < nb_pkt_segs; i++) {
@@ -369,5 +372,8 @@ nomore_mbuf:
 			}
 			pkt_seg = pkt_seg->next;
-			pkt_seg->data_len = pkt_len;
+			if (i != nb_pkt_segs - 1)
+				pkt_seg->data_len = pkt_seg_data_len;
+			else
+				pkt_seg->data_len = pkt_seg_data_len + pkt_len % nb_pkt_segs;
 		}
 		pkt_seg->next = NULL; /* Last segment of packet. */
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-22 10:30:08.000627723 +0000
+++ 0003-test-fix-segment-length-in-packet-generator.patch	2023-03-22 10:30:07.873866516 +0000
@@ -1 +1 @@
-From b88b8af25e7cbb267584bd4c36d3615c4b20109f Mon Sep 17 00:00:00 2001
+From 988dc26cabb05a62859cc343006e8351124b6684 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit b88b8af25e7cbb267584bd4c36d3615c4b20109f ]
+
@@ -30 +32 @@
-index 6b42b9b83b..867a88da00 100644
+index 8ac24577ba..7556bb5512 100644
@@ -33 +35 @@
-@@ -264,9 +264,9 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst,
+@@ -263,9 +263,9 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst,
@@ -46 +48 @@
-@@ -279,5 +279,5 @@ nomore_mbuf:
+@@ -278,5 +278,5 @@ nomore_mbuf:
@@ -53 +55 @@
-@@ -289,5 +289,8 @@ nomore_mbuf:
+@@ -288,5 +288,8 @@ nomore_mbuf:
@@ -63 +65 @@
-@@ -345,9 +348,9 @@ generate_packet_burst_proto(struct rte_mempool *mp,
+@@ -344,9 +347,9 @@ generate_packet_burst_proto(struct rte_mempool *mp,
@@ -76 +78 @@
-@@ -360,5 +363,5 @@ nomore_mbuf:
+@@ -359,5 +362,5 @@ nomore_mbuf:
@@ -83 +85 @@
-@@ -370,5 +373,8 @@ nomore_mbuf:
+@@ -369,5 +372,8 @@ nomore_mbuf:


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

* patch 'test/mbuf: fix test with mbuf debug enabled' has been queued to stable release 21.11.4
  2023-03-22 10:31 patch 'raw/skeleton: fix selftest' has been queued to stable release 21.11.4 Kevin Traynor
  2023-03-22 10:31 ` patch 'reorder: fix sequence number mbuf field register' " Kevin Traynor
  2023-03-22 10:31 ` patch 'test: fix segment length in packet generator' " Kevin Traynor
@ 2023-03-22 10:31 ` Kevin Traynor
  2023-03-22 10:31 ` patch 'test/crypto: fix ZUC digest length in comparison' " Kevin Traynor
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kevin Traynor @ 2023-03-22 10:31 UTC (permalink / raw)
  To: Pavel Ivashchenko; +Cc: Olivier Matz, dpdk stable

Hi,

FYI, your patch has been queued to stable release 21.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/24/23. 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

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

Thanks.

Kevin

---
From 655c88665d3403664d1ab4e6f6baaa2f099273c7 Mon Sep 17 00:00:00 2001
From: Pavel Ivashchenko <pivashchenko@nfware.com>
Date: Thu, 16 Mar 2023 22:14:56 +0300
Subject: [PATCH] test/mbuf: fix test with mbuf debug enabled

[ upstream commit ce5440e0350df101443aa4d0e96bea0a06ef9364 ]

How to reproduce:

1. Define RTE_LIBRTE_MBUF_DEBUG
2. MALLOC_PERTURB_=178 DPDK_TEST=mbuf_autotest gdb --args
	obj-x86_64-linux-gnu/app/test/dpdk-test
	--file-prefix=mbuf_autotest

   PANIC in rte_mbuf_sanity_check():
   bad pkt_len

   ...
   #6  0x00007ffff7d3d4cc in rte_mbuf_sanity_check
	(m=m@entry=0x17f8c3400, is_header=is_header@entry=1)
	at ../lib/mbuf/rte_mbuf.c:384
   #7  0x0000555555653d57 in rte_pktmbuf_free (m=0x17f8c3400)
	at ../lib/mbuf/rte_mbuf.h:1385
   #8  0x000055555565c7a6 in test_nb_segs_and_next_reset ()
	at ../app/test/test_mbuf.c:2752
   #9  test_mbuf () at ../app/test/test_mbuf.c:2967
   ...

   (gdb) frame 6
   #6  0x00007ffff7d3d4cc in rte_mbuf_sanity_check
	(m=m@entry=0x17f8c3400, is_header=is_header@entry=1)
	at ../lib/mbuf/rte_mbuf.c:384
   384			rte_panic("%s\n", reason);
   (gdb) p/d m->pkt_len
   $4 = 1500

Fixes: efc6f9104c80 ("mbuf: fix reset on mbuf free")

Signed-off-by: Pavel Ivashchenko <pivashchenko@nfware.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
---
 app/test/test_mbuf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
index 02b4a92db9..2287bce2f9 100644
--- a/app/test/test_mbuf.c
+++ b/app/test/test_mbuf.c
@@ -2746,4 +2746,5 @@ test_nb_segs_and_next_reset(void)
 	/* split m0 chain in two, between m1 and m2 */
 	m0->nb_segs = 2;
+	m0->pkt_len -= m2->data_len;
 	m1->next = NULL;
 	m2->nb_segs = 1;
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-22 10:30:08.024165922 +0000
+++ 0004-test-mbuf-fix-test-with-mbuf-debug-enabled.patch	2023-03-22 10:30:07.878866521 +0000
@@ -1 +1 @@
-From ce5440e0350df101443aa4d0e96bea0a06ef9364 Mon Sep 17 00:00:00 2001
+From 655c88665d3403664d1ab4e6f6baaa2f099273c7 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit ce5440e0350df101443aa4d0e96bea0a06ef9364 ]
+
@@ -36 +37,0 @@
-Cc: stable@dpdk.org
@@ -45 +46 @@
-index 81a6632d11..8d8d3b9386 100644
+index 02b4a92db9..2287bce2f9 100644
@@ -48 +49 @@
-@@ -2745,4 +2745,5 @@ test_nb_segs_and_next_reset(void)
+@@ -2746,4 +2746,5 @@ test_nb_segs_and_next_reset(void)


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

* patch 'test/crypto: fix ZUC digest length in comparison' has been queued to stable release 21.11.4
  2023-03-22 10:31 patch 'raw/skeleton: fix selftest' has been queued to stable release 21.11.4 Kevin Traynor
                   ` (2 preceding siblings ...)
  2023-03-22 10:31 ` patch 'test/mbuf: fix test with mbuf debug enabled' " Kevin Traynor
@ 2023-03-22 10:31 ` Kevin Traynor
  2023-03-22 10:31 ` patch 'test/crypto: fix capability check for ZUC cipher-auth' " Kevin Traynor
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kevin Traynor @ 2023-03-22 10:31 UTC (permalink / raw)
  To: Ciara Power; +Cc: Brian Dooley, Tejasree Kondoj, Pablo de Lara, dpdk stable

Hi,

FYI, your patch has been queued to stable release 21.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/24/23. 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

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

Thanks.

Kevin

---
From 0872c1aaad584c8592c4d1053be3bee5b675aadf Mon Sep 17 00:00:00 2001
From: Ciara Power <ciara.power@intel.com>
Date: Fri, 3 Mar 2023 09:38:18 +0000
Subject: [PATCH] test/crypto: fix ZUC digest length in comparison

[ upstream commit dc3042ba468196c6f51777b7d41596618b2e47f4 ]

The digest length used in ZUC tests for verifying the digest was
hardcoded at 4 bytes, which was suitable for ZUC-128 only.
Now that ZUC256 is supported by these test functions,
the digest length can vary.

Using the test vector digest length directly in these
comparisons allows for variable digest length.

Fixes: 83397b9f0739 ("test/crypto: add further ZUC test cases")
Fixes: fa5bf9345d4e ("test/crypto: add ZUC cases with 256-bit keys")

Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Brian Dooley <brian.dooley@intel.com>
Acked-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 app/test/test_cryptodev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index fea06b8628..0b4b216611 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -4887,5 +4887,5 @@ test_zuc_cipher_auth(const struct wireless_test_data *tdata)
 			ut_params->digest,
 			tdata->digest.data,
-			4,
+			tdata->digest.len,
 			"ZUC Generated auth tag not as expected");
 	return 0;
@@ -6449,5 +6449,5 @@ test_zuc_auth_cipher(const struct wireless_test_data *tdata,
 			ut_params->digest,
 			tdata->digest.data,
-			DIGEST_BYTE_LENGTH_KASUMI_F9,
+			tdata->digest.len,
 			"ZUC Generated auth tag not as expected");
 	}
@@ -6656,5 +6656,5 @@ test_zuc_auth_cipher_sgl(const struct wireless_test_data *tdata,
 			digest,
 			tdata->digest.data,
-			DIGEST_BYTE_LENGTH_KASUMI_F9,
+			tdata->digest.len,
 			"ZUC Generated auth tag not as expected");
 	}
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-22 10:30:08.047626742 +0000
+++ 0005-test-crypto-fix-ZUC-digest-length-in-comparison.patch	2023-03-22 10:30:07.895866541 +0000
@@ -1 +1 @@
-From dc3042ba468196c6f51777b7d41596618b2e47f4 Mon Sep 17 00:00:00 2001
+From 0872c1aaad584c8592c4d1053be3bee5b675aadf Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit dc3042ba468196c6f51777b7d41596618b2e47f4 ]
+
@@ -16 +17,0 @@
-Cc: stable@dpdk.org
@@ -27 +28 @@
-index 9b18883547..dea0788b4e 100644
+index fea06b8628..0b4b216611 100644
@@ -30 +31 @@
-@@ -4854,5 +4854,5 @@ test_zuc_cipher_auth(const struct wireless_test_data *tdata)
+@@ -4887,5 +4887,5 @@ test_zuc_cipher_auth(const struct wireless_test_data *tdata)
@@ -37 +38 @@
-@@ -6500,5 +6500,5 @@ test_zuc_auth_cipher(const struct wireless_test_data *tdata,
+@@ -6449,5 +6449,5 @@ test_zuc_auth_cipher(const struct wireless_test_data *tdata,
@@ -44 +45 @@
-@@ -6707,5 +6707,5 @@ test_zuc_auth_cipher_sgl(const struct wireless_test_data *tdata,
+@@ -6656,5 +6656,5 @@ test_zuc_auth_cipher_sgl(const struct wireless_test_data *tdata,


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

* patch 'test/crypto: fix capability check for ZUC cipher-auth' has been queued to stable release 21.11.4
  2023-03-22 10:31 patch 'raw/skeleton: fix selftest' has been queued to stable release 21.11.4 Kevin Traynor
                   ` (3 preceding siblings ...)
  2023-03-22 10:31 ` patch 'test/crypto: fix ZUC digest length in comparison' " Kevin Traynor
@ 2023-03-22 10:31 ` Kevin Traynor
  2023-03-22 10:31 ` patch 'app/compress-perf: fix remaining data for ops' " Kevin Traynor
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kevin Traynor @ 2023-03-22 10:31 UTC (permalink / raw)
  To: Ciara Power; +Cc: Brian Dooley, Tejasree Kondoj, Pablo de Lara, dpdk stable

Hi,

FYI, your patch has been queued to stable release 21.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/24/23. 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

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

Thanks.

Kevin

---
From 50f94c98a99308e2d9210f618fbc2093e58dca97 Mon Sep 17 00:00:00 2001
From: Ciara Power <ciara.power@intel.com>
Date: Fri, 3 Mar 2023 09:38:20 +0000
Subject: [PATCH] test/crypto: fix capability check for ZUC cipher-auth

[ upstream commit dd4d13779d63475aa13d2b9f9de06db145e39c78 ]

The cipher-auth test function for ZUC was not using the improved cipher
and auth capability check functions. This meant the required key and IV
lengths were not being checked, leading to problems with ZUC-256 tests
running, and failing, on devices that only support ZUC-128.

Fixes: 27b787132484 ("test/crypto: check cipher parameters")
Fixes: f93fce6de4aa ("test/crypto: check auth parameters")

Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Brian Dooley <brian.dooley@intel.com>
Acked-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 app/test/test_cryptodev.c | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 0b4b216611..a18b15d7c2 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -136,4 +136,15 @@ static int
 dev_configure_and_start(uint64_t ff_disable);
 
+static int
+check_cipher_capability(const struct crypto_testsuite_params *ts_params,
+			const enum rte_crypto_cipher_algorithm cipher_algo,
+			const uint16_t key_size, const uint16_t iv_size);
+
+static int
+check_auth_capability(const struct crypto_testsuite_params *ts_params,
+			const enum rte_crypto_auth_algorithm auth_algo,
+			const uint16_t key_size, const uint16_t iv_size,
+			const uint16_t tag_size);
+
 static struct rte_mbuf *
 setup_test_string(struct rte_mempool *mpool,
@@ -4795,5 +4806,4 @@ test_zuc_cipher_auth(const struct wireless_test_data *tdata)
 
 	struct rte_cryptodev_info dev_info;
-	struct rte_cryptodev_sym_capability_idx cap_idx;
 
 	rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
@@ -4817,17 +4827,12 @@ test_zuc_cipher_auth(const struct wireless_test_data *tdata)
 
 	/* Check if device supports ZUC EEA3 */
-	cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
-	cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_ZUC_EEA3;
-
-	if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
-			&cap_idx) == NULL)
+	if (check_cipher_capability(ts_params, RTE_CRYPTO_CIPHER_ZUC_EEA3,
+			tdata->key.len, tdata->cipher_iv.len) < 0)
 		return TEST_SKIPPED;
 
 	/* Check if device supports ZUC EIA3 */
-	cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
-	cap_idx.algo.auth = RTE_CRYPTO_AUTH_ZUC_EIA3;
-
-	if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
-			&cap_idx) == NULL)
+	if (check_auth_capability(ts_params, RTE_CRYPTO_AUTH_ZUC_EIA3,
+			tdata->key.len, tdata->auth_iv.len,
+			tdata->digest.len) < 0)
 		return TEST_SKIPPED;
 
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-22 10:30:08.079059306 +0000
+++ 0006-test-crypto-fix-capability-check-for-ZUC-cipher-auth.patch	2023-03-22 10:30:07.905866553 +0000
@@ -1 +1 @@
-From dd4d13779d63475aa13d2b9f9de06db145e39c78 Mon Sep 17 00:00:00 2001
+From 50f94c98a99308e2d9210f618fbc2093e58dca97 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit dd4d13779d63475aa13d2b9f9de06db145e39c78 ]
+
@@ -13 +14,0 @@
-Cc: stable@dpdk.org
@@ -24 +25 @@
-index 9447777224..26ae382ad4 100644
+index 0b4b216611..a18b15d7c2 100644
@@ -27 +28 @@
-@@ -137,4 +137,15 @@ static int
+@@ -136,4 +136,15 @@ static int
@@ -43 +44 @@
-@@ -4762,5 +4773,4 @@ test_zuc_cipher_auth(const struct wireless_test_data *tdata)
+@@ -4795,5 +4806,4 @@ test_zuc_cipher_auth(const struct wireless_test_data *tdata)
@@ -49 +50 @@
-@@ -4784,17 +4794,12 @@ test_zuc_cipher_auth(const struct wireless_test_data *tdata)
+@@ -4817,17 +4827,12 @@ test_zuc_cipher_auth(const struct wireless_test_data *tdata)


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

* patch 'app/compress-perf: fix remaining data for ops' has been queued to stable release 21.11.4
  2023-03-22 10:31 patch 'raw/skeleton: fix selftest' has been queued to stable release 21.11.4 Kevin Traynor
                   ` (4 preceding siblings ...)
  2023-03-22 10:31 ` patch 'test/crypto: fix capability check for ZUC cipher-auth' " Kevin Traynor
@ 2023-03-22 10:31 ` Kevin Traynor
  2023-03-22 10:31 ` patch 'app/bbdev: check statistics failure' " Kevin Traynor
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kevin Traynor @ 2023-03-22 10:31 UTC (permalink / raw)
  To: Arkadiusz Kusztal; +Cc: Ciara Power, Kai Ji, dpdk stable

Hi,

FYI, your patch has been queued to stable release 21.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/24/23. 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

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

Thanks.

Kevin

---
From 9daf33a2374292c161fe617dc8ee1aef81456ab2 Mon Sep 17 00:00:00 2001
From: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
Date: Fri, 10 Mar 2023 16:27:05 +0000
Subject: [PATCH] app/compress-perf: fix remaining data for ops

[ upstream commit cf8c0c65514a12d4f326417f7cf54433338ed226 ]

Individual variables are needed for tracking the remaining data for
compression and decompression.

Fixes: 83cc3b90ad7a ("app/compress-perf: fix testing single operation")

Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Kai Ji <kai.ji@intel.com>
---
 app/test-compress-perf/comp_perf_test_common.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/app/test-compress-perf/comp_perf_test_common.c b/app/test-compress-perf/comp_perf_test_common.c
index cd60958944..78487196ad 100644
--- a/app/test-compress-perf/comp_perf_test_common.c
+++ b/app/test-compress-perf/comp_perf_test_common.c
@@ -367,4 +367,5 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem)
 {
 	uint32_t remaining_data = test_data->input_data_sz;
+	uint32_t remaining_data_decomp = test_data->input_data_sz;
 	uint8_t *input_data_ptr = test_data->input_data;
 	size_t data_sz = 0;
@@ -483,5 +484,5 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem)
 
 		if (decompress_only)
-			data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
+			data_sz = RTE_MIN(remaining_data_decomp, test_data->seg_sz);
 		else
 			data_sz = test_data->out_seg_sz;
@@ -497,9 +498,9 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem)
 			rte_memcpy(data_addr, input_data_ptr, data_sz);
 			input_data_ptr += data_sz;
-			remaining_data -= data_sz;
+			remaining_data_decomp -= data_sz;
 		}
 
 		/* Chain mbufs if needed for output mbufs */
-		for (j = 1; j < segs_per_mbuf && remaining_data > 0; j++) {
+		for (j = 1; j < segs_per_mbuf && remaining_data_decomp > 0; j++) {
 			struct rte_mbuf *next_seg =
 				rte_pktmbuf_alloc(mem->comp_buf_pool);
@@ -522,5 +523,5 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem)
 
 			if (decompress_only)
-				data_sz = RTE_MIN(remaining_data,
+				data_sz = RTE_MIN(remaining_data_decomp,
 						  test_data->seg_sz);
 			else
@@ -537,5 +538,5 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem)
 				rte_memcpy(data_addr, input_data_ptr, data_sz);
 				input_data_ptr += data_sz;
-				remaining_data -= data_sz;
+				remaining_data_decomp -= data_sz;
 			}
 
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-22 10:30:08.110123544 +0000
+++ 0007-app-compress-perf-fix-remaining-data-for-ops.patch	2023-03-22 10:30:07.906866554 +0000
@@ -1 +1 @@
-From cf8c0c65514a12d4f326417f7cf54433338ed226 Mon Sep 17 00:00:00 2001
+From 9daf33a2374292c161fe617dc8ee1aef81456ab2 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit cf8c0c65514a12d4f326417f7cf54433338ed226 ]
+
@@ -10 +11,0 @@
-Cc: stable@dpdk.org


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

* patch 'app/bbdev: check statistics failure' has been queued to stable release 21.11.4
  2023-03-22 10:31 patch 'raw/skeleton: fix selftest' has been queued to stable release 21.11.4 Kevin Traynor
                   ` (5 preceding siblings ...)
  2023-03-22 10:31 ` patch 'app/compress-perf: fix remaining data for ops' " Kevin Traynor
@ 2023-03-22 10:31 ` Kevin Traynor
  2023-03-22 10:31 ` patch 'net/vhost: add missing newline in logs' " Kevin Traynor
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kevin Traynor @ 2023-03-22 10:31 UTC (permalink / raw)
  To: Hernan Vargas; +Cc: Maxime Coquelin, dpdk stable

Hi,

FYI, your patch has been queued to stable release 21.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/24/23. 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

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

Thanks.

Kevin

---
From b3225c22153b05121d19502f8333ff4579c0a876 Mon Sep 17 00:00:00 2001
From: Hernan Vargas <hernan.vargas@intel.com>
Date: Wed, 8 Mar 2023 19:36:24 -0800
Subject: [PATCH] app/bbdev: check statistics failure

[ upstream commit ce1b62899167f6e2c49d8496afa43a9162167c6b ]

Add check for return value from get_bbdev_queue_stats.

Coverity issue: 383155
Fixes: c25604355a15 ("app/bbdev: add explicit check for counters")

Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 app/test-bbdev/test_bbdev_perf.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
index aab2c41ec1..3f2bac6136 100644
--- a/app/test-bbdev/test_bbdev_perf.c
+++ b/app/test-bbdev/test_bbdev_perf.c
@@ -4728,5 +4728,5 @@ offload_cost_test(struct active_device *ad,
 	return TEST_SKIPPED;
 #else
-	int iter;
+	int iter, ret;
 	uint16_t burst_sz = op_params->burst_sz;
 	const uint16_t num_to_process = op_params->num_to_process;
@@ -4819,5 +4819,8 @@ offload_cost_test(struct active_device *ad,
 
 	struct rte_bbdev_stats stats = {0};
-	get_bbdev_queue_stats(ad->dev_id, queue_id, &stats);
+	ret = get_bbdev_queue_stats(ad->dev_id, queue_id, &stats);
+	TEST_ASSERT_SUCCESS(ret,
+			"Failed to get stats for queue (%u) of device (%u)",
+			queue_id, ad->dev_id);
 	if (op_type != RTE_BBDEV_OP_LDPC_DEC) {
 		TEST_ASSERT_SUCCESS(stats.enqueued_count != num_to_process,
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-22 10:30:08.132506194 +0000
+++ 0008-app-bbdev-check-statistics-failure.patch	2023-03-22 10:30:07.909866558 +0000
@@ -1 +1 @@
-From ce1b62899167f6e2c49d8496afa43a9162167c6b Mon Sep 17 00:00:00 2001
+From b3225c22153b05121d19502f8333ff4579c0a876 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit ce1b62899167f6e2c49d8496afa43a9162167c6b ]
+
@@ -10 +11,0 @@
-Cc: stable@dpdk.org
@@ -19 +20 @@
-index 15ebcdfc15..276bbf0a2e 100644
+index aab2c41ec1..3f2bac6136 100644
@@ -22,3 +23,3 @@
-@@ -5680,5 +5680,5 @@ offload_cost_test(struct active_device *ad,
- 		struct test_op_params *op_params)
- {
+@@ -4728,5 +4728,5 @@ offload_cost_test(struct active_device *ad,
+ 	return TEST_SKIPPED;
+ #else
@@ -29 +30 @@
-@@ -5775,5 +5775,8 @@ offload_cost_test(struct active_device *ad,
+@@ -4819,5 +4819,8 @@ offload_cost_test(struct active_device *ad,
@@ -37,2 +38,2 @@
- 	if (stats.enqueue_warn_count > 0)
- 		printf("Warning reported on the queue : %10"PRIu64"\n",
+ 	if (op_type != RTE_BBDEV_OP_LDPC_DEC) {
+ 		TEST_ASSERT_SUCCESS(stats.enqueued_count != num_to_process,


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

* patch 'net/vhost: add missing newline in logs' has been queued to stable release 21.11.4
  2023-03-22 10:31 patch 'raw/skeleton: fix selftest' has been queued to stable release 21.11.4 Kevin Traynor
                   ` (6 preceding siblings ...)
  2023-03-22 10:31 ` patch 'app/bbdev: check statistics failure' " Kevin Traynor
@ 2023-03-22 10:31 ` Kevin Traynor
  2023-03-22 10:31 ` patch 'net/vhost: fix leak in interrupt handle setup' " Kevin Traynor
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kevin Traynor @ 2023-03-22 10:31 UTC (permalink / raw)
  To: David Marchand; +Cc: Chenbo Xia, dpdk stable

Hi,

FYI, your patch has been queued to stable release 21.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/24/23. 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

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

Thanks.

Kevin

---
From 14297e3110bb392e8acce99e0cb230994503e44c Mon Sep 17 00:00:00 2001
From: David Marchand <david.marchand@redhat.com>
Date: Thu, 9 Mar 2023 13:37:50 +0100
Subject: [PATCH] net/vhost: add missing newline in logs

[ upstream commit d539a20b7561d9e97d13f9b43d74ec030bd1a4ba ]

Fixes: 3f8ff12821e4 ("vhost: support interrupt mode")
Fixes: 8f1750f42e2d ("net/vhost: perform SW checksum in Rx path")
Fixes: 8ba1723783b2 ("net/vhost: perform SW checksum in Tx path")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
---
 drivers/net/vhost/rte_eth_vhost.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index a280e788fb..ad2d52475d 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -621,5 +621,5 @@ eth_rxq_intr_disable(struct rte_eth_dev *dev, uint16_t qid)
 	ret = rte_vhost_get_vhost_vring(vq->vid, (qid << 1) + 1, &vring);
 	if (ret < 0) {
-		VHOST_LOG(ERR, "Failed to get rxq%d's vring", qid);
+		VHOST_LOG(ERR, "Failed to get rxq%d's vring\n", qid);
 		return ret;
 	}
@@ -821,5 +821,5 @@ new_device(int vid)
 			if (eth_vhost_install_intr(eth_dev) < 0) {
 				VHOST_LOG(INFO,
-					"Failed to install interrupt handler.");
+					"Failed to install interrupt handler.\n");
 					return -1;
 			}
@@ -1157,5 +1157,5 @@ eth_dev_start(struct rte_eth_dev *eth_dev)
 			if (eth_vhost_install_intr(eth_dev) < 0) {
 				VHOST_LOG(INFO,
-					"Failed to install interrupt handler.");
+					"Failed to install interrupt handler.\n");
 					return -1;
 			}
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-22 10:30:08.157065379 +0000
+++ 0009-net-vhost-add-missing-newline-in-logs.patch	2023-03-22 10:30:07.910866559 +0000
@@ -1 +1 @@
-From d539a20b7561d9e97d13f9b43d74ec030bd1a4ba Mon Sep 17 00:00:00 2001
+From 14297e3110bb392e8acce99e0cb230994503e44c Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit d539a20b7561d9e97d13f9b43d74ec030bd1a4ba ]
+
@@ -9 +10,0 @@
-Cc: stable@dpdk.org
@@ -14,2 +15,2 @@
- drivers/net/vhost/rte_eth_vhost.c | 10 +++++-----
- 1 file changed, 5 insertions(+), 5 deletions(-)
+ drivers/net/vhost/rte_eth_vhost.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
@@ -18 +19 @@
-index 9c609b45a3..198bf4d1f4 100644
+index a280e788fb..ad2d52475d 100644
@@ -21,15 +22 @@
-@@ -298,5 +298,5 @@ vhost_dev_csum_configure(struct rte_eth_dev *eth_dev)
- 		if (!(rxmode->offloads &
- 				(RTE_ETH_RX_OFFLOAD_UDP_CKSUM | RTE_ETH_RX_OFFLOAD_TCP_CKSUM))) {
--			VHOST_LOG(NOTICE, "Rx csum will be done in SW, may impact performance.");
-+			VHOST_LOG(NOTICE, "Rx csum will be done in SW, may impact performance.\n");
- 			internal->rx_sw_csum = true;
- 		}
-@@ -306,5 +306,5 @@ vhost_dev_csum_configure(struct rte_eth_dev *eth_dev)
- 		if (txmode->offloads &
- 				(RTE_ETH_TX_OFFLOAD_UDP_CKSUM | RTE_ETH_TX_OFFLOAD_TCP_CKSUM)) {
--			VHOST_LOG(NOTICE, "Tx csum will be done in SW, may impact performance.");
-+			VHOST_LOG(NOTICE, "Tx csum will be done in SW, may impact performance.\n");
- 			internal->tx_sw_csum = true;
- 		}
-@@ -647,5 +647,5 @@ eth_rxq_intr_disable(struct rte_eth_dev *dev, uint16_t qid)
+@@ -621,5 +621,5 @@ eth_rxq_intr_disable(struct rte_eth_dev *dev, uint16_t qid)
@@ -42 +29 @@
-@@ -852,5 +852,5 @@ new_device(int vid)
+@@ -821,5 +821,5 @@ new_device(int vid)
@@ -49 +36 @@
-@@ -1192,5 +1192,5 @@ eth_dev_start(struct rte_eth_dev *eth_dev)
+@@ -1157,5 +1157,5 @@ eth_dev_start(struct rte_eth_dev *eth_dev)


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

* patch 'net/vhost: fix leak in interrupt handle setup' has been queued to stable release 21.11.4
  2023-03-22 10:31 patch 'raw/skeleton: fix selftest' has been queued to stable release 21.11.4 Kevin Traynor
                   ` (7 preceding siblings ...)
  2023-03-22 10:31 ` patch 'net/vhost: add missing newline in logs' " Kevin Traynor
@ 2023-03-22 10:31 ` Kevin Traynor
  2023-03-22 10:31 ` patch 'net/vhost: fix Rx interrupt' " Kevin Traynor
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kevin Traynor @ 2023-03-22 10:31 UTC (permalink / raw)
  To: David Marchand; +Cc: Chenbo Xia, dpdk stable

Hi,

FYI, your patch has been queued to stable release 21.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/24/23. 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

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

Thanks.

Kevin

---
From a38b2e569315d093d9dd58ed572ca3951319d419 Mon Sep 17 00:00:00 2001
From: David Marchand <david.marchand@redhat.com>
Date: Thu, 9 Mar 2023 13:37:51 +0100
Subject: [PATCH] net/vhost: fix leak in interrupt handle setup

[ upstream commit 24c3a04e16aeab45719cf038d2371ccf8d1bc780 ]

Do a systematic cleanup if any part of the interrupt handle setup fails.

Fixes: d61138d4f0e2 ("drivers: remove direct access to interrupt handle")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
---
 drivers/net/vhost/rte_eth_vhost.c | 53 ++++++++++++++++++++-----------
 1 file changed, 34 insertions(+), 19 deletions(-)

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index ad2d52475d..31ff871bbc 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -661,14 +661,16 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)
 	if (dev->intr_handle == NULL) {
 		VHOST_LOG(ERR, "Fail to allocate intr_handle\n");
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto error;
+	}
+	if (rte_intr_efd_counter_size_set(dev->intr_handle, sizeof(uint64_t))) {
+		ret = -rte_errno;
+		goto error;
 	}
-	if (rte_intr_efd_counter_size_set(dev->intr_handle, sizeof(uint64_t)))
-		return -rte_errno;
 
 	if (rte_intr_vec_list_alloc(dev->intr_handle, NULL, nb_rxq)) {
-		VHOST_LOG(ERR,
-			"Failed to allocate memory for interrupt vector\n");
-		rte_intr_instance_free(dev->intr_handle);
-		return -ENOMEM;
+		VHOST_LOG(ERR, "Failed to allocate memory for interrupt vector\n");
+		ret = -ENOMEM;
+		goto error;
 	}
 
@@ -676,8 +678,13 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)
 	VHOST_LOG(INFO, "Prepare intr vec\n");
 	for (i = 0; i < nb_rxq; i++) {
-		if (rte_intr_vec_list_index_set(dev->intr_handle, i, RTE_INTR_VEC_RXTX_OFFSET + i))
-			return -rte_errno;
-		if (rte_intr_efds_index_set(dev->intr_handle, i, -1))
-			return -rte_errno;
+		if (rte_intr_vec_list_index_set(dev->intr_handle, i,
+				RTE_INTR_VEC_RXTX_OFFSET + i)) {
+			ret = -rte_errno;
+			goto error;
+		}
+		if (rte_intr_efds_index_set(dev->intr_handle, i, -1)) {
+			ret = -rte_errno;
+			goto error;
+		}
 		vq = dev->data->rx_queues[i];
 		if (!vq) {
@@ -704,14 +711,22 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)
 	}
 
-	if (rte_intr_nb_efd_set(dev->intr_handle, nb_rxq))
-		return -rte_errno;
-
-	if (rte_intr_max_intr_set(dev->intr_handle, nb_rxq + 1))
-		return -rte_errno;
-
-	if (rte_intr_type_set(dev->intr_handle, RTE_INTR_HANDLE_VDEV))
-		return -rte_errno;
+	if (rte_intr_nb_efd_set(dev->intr_handle, nb_rxq)) {
+		ret = -rte_errno;
+		goto error;
+	}
+	if (rte_intr_max_intr_set(dev->intr_handle, nb_rxq + 1)) {
+		ret = -rte_errno;
+		goto error;
+	}
+	if (rte_intr_type_set(dev->intr_handle, RTE_INTR_HANDLE_VDEV)) {
+		ret = -rte_errno;
+		goto error;
+	}
 
 	return 0;
+
+error:
+	eth_vhost_uninstall_intr(dev);
+	return ret;
 }
 
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-22 10:30:08.180116749 +0000
+++ 0010-net-vhost-fix-leak-in-interrupt-handle-setup.patch	2023-03-22 10:30:07.911866560 +0000
@@ -1 +1 @@
-From 24c3a04e16aeab45719cf038d2371ccf8d1bc780 Mon Sep 17 00:00:00 2001
+From a38b2e569315d093d9dd58ed572ca3951319d419 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 24c3a04e16aeab45719cf038d2371ccf8d1bc780 ]
+
@@ -9 +10,0 @@
-Cc: stable@dpdk.org
@@ -18 +19 @@
-index 198bf4d1f4..96deb18d91 100644
+index ad2d52475d..31ff871bbc 100644
@@ -21 +22 @@
-@@ -687,14 +687,16 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)
+@@ -661,14 +661,16 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)
@@ -45 +46 @@
-@@ -702,8 +704,13 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)
+@@ -676,8 +678,13 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)
@@ -63 +64 @@
-@@ -730,14 +737,22 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)
+@@ -704,14 +711,22 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)


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

* patch 'net/vhost: fix Rx interrupt' has been queued to stable release 21.11.4
  2023-03-22 10:31 patch 'raw/skeleton: fix selftest' has been queued to stable release 21.11.4 Kevin Traynor
                   ` (8 preceding siblings ...)
  2023-03-22 10:31 ` patch 'net/vhost: fix leak in interrupt handle setup' " Kevin Traynor
@ 2023-03-22 10:31 ` Kevin Traynor
  2023-03-22 10:31 ` patch 'net/virtio: remove address width limit for modern devices' " Kevin Traynor
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kevin Traynor @ 2023-03-22 10:31 UTC (permalink / raw)
  To: David Marchand; +Cc: Chenbo Xia, Dukai Yuan, dpdk stable

Hi,

FYI, your patch has been queued to stable release 21.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/24/23. 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

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

Thanks.

Kevin

---
From 1585556d2cb3b4541747992b256d1b0672938bc6 Mon Sep 17 00:00:00 2001
From: David Marchand <david.marchand@redhat.com>
Date: Thu, 9 Mar 2023 13:37:52 +0100
Subject: [PATCH] net/vhost: fix Rx interrupt

[ upstream commit 7995bf4c295464c3a4c3f4ac500f890ab55567e7 ]

In the situation when a port was started while no virtio driver was
connected, Rx interrupts were broken.
They were also broken after a virtio driver reconnects.

There were several issues mixed in:
- this driver was not exposing a fixed file descriptor per Rx queue,
  If a virtio driver was not connected yet, each Rx queue vector was
  pointing at a -1 fd, and an application could interpret this as a lack
  of Rx interrupt support,
- when a virtio driver later (re)connected, this net/vhost driver was
  hacking into the EAL layer epoll fd to remove a old vring kickfd and
  insert the new vring kickfd. This hack constitutes a layer violation
  plus users of rte_eth_dev_rx_intr_ctl_q_get_fd() were not notified of
  this change,
- in the case of reconnection, because the interrupt handle was
  reallocated, a 0 fd was failing to be removed from the EAL layer
  epoll fd, which resulted in never fixing the EAL epoll fd,

To fix Rx interrupts:
- allocating (eth_vhost_install_intr) / releasing
  (eth_vhost_uninstall_intr) the interrupt handle is moved when
  starting / closing the port, while setting / resetting per rxq fd is
  triggered by vhost events via some new helpers (see
  eth_vhost_configure_intr and eth_vhost_unconfigure_intr),
- a "proxy" epoll fd is created per Rx queue at the time the interrupt
  handle is allocated, so applications can start waiting for events on
  those fds, even before a virtio driver initialises,
- when available, vring kickd are populated in the "proxy" epoll fd,

Bugzilla ID: 1135
Fixes: 3f8ff12821e4 ("vhost: support interrupt mode")
Fixes: 3d4cd4be577c ("net/vhost: fix interrupt mode")
Fixes: d61138d4f0e2 ("drivers: remove direct access to interrupt handle")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Tested-by: Dukai Yuan <dukaix.yuan@intel.com>
---
 drivers/net/vhost/rte_eth_vhost.c | 328 ++++++++++++------------------
 1 file changed, 132 insertions(+), 196 deletions(-)

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 31ff871bbc..4e44e123eb 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -98,6 +98,7 @@ struct vhost_queue {
 	uint16_t virtqueue_id;
 	struct vhost_stats stats;
-	int intr_enable;
 	rte_spinlock_t intr_lock;
+	struct epoll_event ev;
+	int kickfd;
 };
 
@@ -520,88 +521,57 @@ find_internal_resource(char *ifname)
 }
 
-static int
+static void
 eth_vhost_update_intr(struct rte_eth_dev *eth_dev, uint16_t rxq_idx)
-{
-	struct rte_intr_handle *handle = eth_dev->intr_handle;
-	struct rte_epoll_event rev, *elist;
-	int epfd, ret;
-
-	if (handle == NULL)
-		return 0;
-
-	elist = rte_intr_elist_index_get(handle, rxq_idx);
-	if (rte_intr_efds_index_get(handle, rxq_idx) == elist->fd)
-		return 0;
-
-	VHOST_LOG(INFO, "kickfd for rxq-%d was changed, updating handler.\n",
-			rxq_idx);
-
-	if (elist->fd != -1)
-		VHOST_LOG(ERR, "Unexpected previous kickfd value (Got %d, expected -1).\n",
-			elist->fd);
-
-	/*
-	 * First remove invalid epoll event, and then install
-	 * the new one. May be solved with a proper API in the
-	 * future.
-	 */
-	epfd = elist->epfd;
-	rev = *elist;
-	ret = rte_epoll_ctl(epfd, EPOLL_CTL_DEL, rev.fd,
-			elist);
-	if (ret) {
-		VHOST_LOG(ERR, "Delete epoll event failed.\n");
-		return ret;
-	}
-
-	rev.fd = rte_intr_efds_index_get(handle, rxq_idx);
-	if (rte_intr_elist_index_set(handle, rxq_idx, rev))
-		return -rte_errno;
-
-	elist = rte_intr_elist_index_get(handle, rxq_idx);
-	ret = rte_epoll_ctl(epfd, EPOLL_CTL_ADD, rev.fd, elist);
-	if (ret) {
-		VHOST_LOG(ERR, "Add epoll event failed.\n");
-		return ret;
-	}
-
-	return 0;
-}
-
-static int
-eth_rxq_intr_enable(struct rte_eth_dev *dev, uint16_t qid)
 {
 	struct rte_vhost_vring vring;
 	struct vhost_queue *vq;
-	int old_intr_enable, ret = 0;
 
-	vq = dev->data->rx_queues[qid];
-	if (!vq) {
-		VHOST_LOG(ERR, "rxq%d is not setup yet\n", qid);
-		return -1;
+	vq = eth_dev->data->rx_queues[rxq_idx];
+	if (vq == NULL || vq->vid < 0)
+		return;
+
+	if (rte_vhost_get_vhost_vring(vq->vid, (rxq_idx << 1) + 1, &vring) < 0) {
+		VHOST_LOG(DEBUG, "Failed to get rxq-%d's vring, skip!\n", rxq_idx);
+		return;
 	}
 
 	rte_spinlock_lock(&vq->intr_lock);
-	old_intr_enable = vq->intr_enable;
-	vq->intr_enable = 1;
-	ret = eth_vhost_update_intr(dev, qid);
+
+	/* Remove previous kickfd from proxy epoll */
+	if (vq->kickfd >= 0 && vq->kickfd != vring.kickfd) {
+		if (epoll_ctl(vq->ev.data.fd, EPOLL_CTL_DEL, vq->kickfd, &vq->ev) < 0) {
+			VHOST_LOG(DEBUG, "Failed to unregister %d from rxq-%d epoll: %s\n",
+				vq->kickfd, rxq_idx, strerror(errno));
+		} else {
+			VHOST_LOG(DEBUG, "Unregistered %d from rxq-%d epoll\n",
+				vq->kickfd, rxq_idx);
+		}
+		vq->kickfd = -1;
+	}
+
+	/* Add new one, if valid */
+	if (vq->kickfd != vring.kickfd && vring.kickfd >= 0) {
+		if (epoll_ctl(vq->ev.data.fd, EPOLL_CTL_ADD, vring.kickfd, &vq->ev) < 0) {
+			VHOST_LOG(ERR, "Failed to register %d in rxq-%d epoll: %s\n",
+				vring.kickfd, rxq_idx, strerror(errno));
+		} else {
+			vq->kickfd = vring.kickfd;
+			VHOST_LOG(DEBUG, "Registered %d in rxq-%d epoll\n",
+				vq->kickfd, rxq_idx);
+		}
+	}
+
 	rte_spinlock_unlock(&vq->intr_lock);
+}
 
-	if (ret < 0) {
-		VHOST_LOG(ERR, "Failed to update rxq%d's intr\n", qid);
-		vq->intr_enable = old_intr_enable;
-		return ret;
-	}
+static int
+eth_rxq_intr_enable(struct rte_eth_dev *dev, uint16_t qid)
+{
+	struct vhost_queue *vq = dev->data->rx_queues[qid];
 
-	ret = rte_vhost_get_vhost_vring(vq->vid, (qid << 1) + 1, &vring);
-	if (ret < 0) {
-		VHOST_LOG(ERR, "Failed to get rxq%d's vring\n", qid);
-		return ret;
-	}
-	VHOST_LOG(INFO, "Enable interrupt for rxq%d\n", qid);
-	rte_vhost_enable_guest_notification(vq->vid, (qid << 1) + 1, 1);
-	rte_wmb();
+	if (vq->vid >= 0)
+		rte_vhost_enable_guest_notification(vq->vid, (qid << 1) + 1, 1);
 
-	return ret;
+	return 0;
 }
 
@@ -609,24 +579,8 @@ static int
 eth_rxq_intr_disable(struct rte_eth_dev *dev, uint16_t qid)
 {
-	struct rte_vhost_vring vring;
-	struct vhost_queue *vq;
-	int ret = 0;
+	struct vhost_queue *vq = dev->data->rx_queues[qid];
 
-	vq = dev->data->rx_queues[qid];
-	if (!vq) {
-		VHOST_LOG(ERR, "rxq%d is not setup yet\n", qid);
-		return -1;
-	}
-
-	ret = rte_vhost_get_vhost_vring(vq->vid, (qid << 1) + 1, &vring);
-	if (ret < 0) {
-		VHOST_LOG(ERR, "Failed to get rxq%d's vring\n", qid);
-		return ret;
-	}
-	VHOST_LOG(INFO, "Disable interrupt for rxq%d\n", qid);
-	rte_vhost_enable_guest_notification(vq->vid, (qid << 1) + 1, 0);
-	rte_wmb();
-
-	vq->intr_enable = 0;
+	if (vq->vid >= 0)
+		rte_vhost_enable_guest_notification(vq->vid, (qid << 1) + 1, 0);
 
 	return 0;
@@ -639,4 +593,12 @@ eth_vhost_uninstall_intr(struct rte_eth_dev *dev)
 
 	if (intr_handle != NULL) {
+		int i;
+
+		for (i = 0; i < dev->data->nb_rx_queues; i++) {
+			int epoll_fd = rte_intr_efds_index_get(dev->intr_handle, i);
+
+			if (epoll_fd >= 0)
+				close(epoll_fd);
+		}
 		rte_intr_vec_list_free(intr_handle);
 		rte_intr_instance_free(intr_handle);
@@ -648,13 +610,9 @@ static int
 eth_vhost_install_intr(struct rte_eth_dev *dev)
 {
-	struct rte_vhost_vring vring;
-	struct vhost_queue *vq;
 	int nb_rxq = dev->data->nb_rx_queues;
-	int i;
-	int ret;
+	struct vhost_queue *vq;
 
-	/* uninstall firstly if we are reconnecting */
-	if (dev->intr_handle != NULL)
-		eth_vhost_uninstall_intr(dev);
+	int ret;
+	int i;
 
 	dev->intr_handle = rte_intr_instance_alloc(RTE_INTR_INSTANCE_F_PRIVATE);
@@ -664,5 +622,5 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)
 		goto error;
 	}
-	if (rte_intr_efd_counter_size_set(dev->intr_handle, sizeof(uint64_t))) {
+	if (rte_intr_efd_counter_size_set(dev->intr_handle, 0)) {
 		ret = -rte_errno;
 		goto error;
@@ -675,38 +633,26 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)
 	}
 
-
-	VHOST_LOG(INFO, "Prepare intr vec\n");
+	VHOST_LOG(DEBUG, "Prepare intr vec\n");
 	for (i = 0; i < nb_rxq; i++) {
+		int epoll_fd = epoll_create1(0);
+
+		if (epoll_fd < 0) {
+			VHOST_LOG(ERR, "Failed to create proxy epoll fd for rxq-%d\n", i);
+			ret = -errno;
+			goto error;
+		}
+
 		if (rte_intr_vec_list_index_set(dev->intr_handle, i,
-				RTE_INTR_VEC_RXTX_OFFSET + i)) {
-			ret = -rte_errno;
-			goto error;
-		}
-		if (rte_intr_efds_index_set(dev->intr_handle, i, -1)) {
+				RTE_INTR_VEC_RXTX_OFFSET + i) ||
+				rte_intr_efds_index_set(dev->intr_handle, i, epoll_fd)) {
 			ret = -rte_errno;
+			close(epoll_fd);
 			goto error;
 		}
+
 		vq = dev->data->rx_queues[i];
-		if (!vq) {
-			VHOST_LOG(INFO, "rxq-%d not setup yet, skip!\n", i);
-			continue;
-		}
-
-		ret = rte_vhost_get_vhost_vring(vq->vid, (i << 1) + 1, &vring);
-		if (ret < 0) {
-			VHOST_LOG(INFO,
-				"Failed to get rxq-%d's vring, skip!\n", i);
-			continue;
-		}
-
-		if (vring.kickfd < 0) {
-			VHOST_LOG(INFO,
-				"rxq-%d's kickfd is invalid, skip!\n", i);
-			continue;
-		}
-
-		if (rte_intr_efds_index_set(dev->intr_handle, i, vring.kickfd))
-			continue;
-		VHOST_LOG(INFO, "Installed intr vec for rxq-%d\n", i);
+		memset(&vq->ev, 0, sizeof(vq->ev));
+		vq->ev.events = EPOLLIN;
+		vq->ev.data.fd = epoll_fd;
 	}
 
@@ -731,4 +677,44 @@ error:
 }
 
+static void
+eth_vhost_configure_intr(struct rte_eth_dev *dev)
+{
+	int i;
+
+	VHOST_LOG(DEBUG, "Configure intr vec\n");
+	for (i = 0; i < dev->data->nb_rx_queues; i++)
+		eth_vhost_update_intr(dev, i);
+}
+
+static void
+eth_vhost_unconfigure_intr(struct rte_eth_dev *eth_dev)
+{
+	struct vhost_queue *vq;
+	int i;
+
+	VHOST_LOG(DEBUG, "Unconfigure intr vec\n");
+	for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
+		vq = eth_dev->data->rx_queues[i];
+		if (vq == NULL || vq->vid < 0)
+			continue;
+
+		rte_spinlock_lock(&vq->intr_lock);
+
+		/* Remove previous kickfd from proxy epoll */
+		if (vq->kickfd >= 0) {
+			if (epoll_ctl(vq->ev.data.fd, EPOLL_CTL_DEL, vq->kickfd, &vq->ev) < 0) {
+				VHOST_LOG(DEBUG, "Failed to unregister %d from rxq-%d epoll: %s\n",
+					vq->kickfd, i, strerror(errno));
+			} else {
+				VHOST_LOG(DEBUG, "Unregistered %d from rxq-%d epoll\n",
+					vq->kickfd, i);
+			}
+			vq->kickfd = -1;
+		}
+
+		rte_spinlock_unlock(&vq->intr_lock);
+	}
+}
+
 static void
 update_queuing_status(struct rte_eth_dev *dev, bool wait_queuing)
@@ -832,14 +818,6 @@ new_device(int vid)
 	if (rte_atomic32_read(&internal->started) == 1) {
 		queue_setup(eth_dev, internal);
-
-		if (dev_conf->intr_conf.rxq) {
-			if (eth_vhost_install_intr(eth_dev) < 0) {
-				VHOST_LOG(INFO,
-					"Failed to install interrupt handler.\n");
-					return -1;
-			}
-		}
-	} else {
-		VHOST_LOG(INFO, "RX/TX queues not exist yet\n");
+		if (dev_conf->intr_conf.rxq)
+			eth_vhost_configure_intr(eth_dev);
 	}
 
@@ -883,4 +861,5 @@ destroy_device(int vid)
 	rte_atomic32_set(&internal->dev_attached, 0);
 	update_queuing_status(eth_dev, true);
+	eth_vhost_unconfigure_intr(eth_dev);
 
 	eth_dev->data->dev_link.link_status = RTE_ETH_LINK_DOWN;
@@ -911,53 +890,8 @@ destroy_device(int vid)
 
 	VHOST_LOG(INFO, "Vhost device %d destroyed\n", vid);
-	eth_vhost_uninstall_intr(eth_dev);
 
 	rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
-static int
-vring_conf_update(int vid, struct rte_eth_dev *eth_dev, uint16_t vring_id)
-{
-	struct rte_eth_conf *dev_conf = &eth_dev->data->dev_conf;
-	struct pmd_internal *internal = eth_dev->data->dev_private;
-	struct vhost_queue *vq;
-	struct rte_vhost_vring vring;
-	int rx_idx = vring_id % 2 ? (vring_id - 1) >> 1 : -1;
-	int ret = 0;
-
-	/*
-	 * The vring kickfd may be changed after the new device notification.
-	 * Update it when the vring state is updated.
-	 */
-	if (rx_idx >= 0 && rx_idx < eth_dev->data->nb_rx_queues &&
-	    rte_atomic32_read(&internal->dev_attached) &&
-	    rte_atomic32_read(&internal->started) &&
-	    dev_conf->intr_conf.rxq) {
-		ret = rte_vhost_get_vhost_vring(vid, vring_id, &vring);
-		if (ret) {
-			VHOST_LOG(ERR, "Failed to get vring %d information.\n",
-					vring_id);
-			return ret;
-		}
-
-		if (rte_intr_efds_index_set(eth_dev->intr_handle, rx_idx,
-						   vring.kickfd))
-			return -rte_errno;
-
-		vq = eth_dev->data->rx_queues[rx_idx];
-		if (!vq) {
-			VHOST_LOG(ERR, "rxq%d is not setup yet\n", rx_idx);
-			return -1;
-		}
-
-		rte_spinlock_lock(&vq->intr_lock);
-		if (vq->intr_enable)
-			ret = eth_vhost_update_intr(eth_dev, rx_idx);
-		rte_spinlock_unlock(&vq->intr_lock);
-	}
-
-	return ret;
-}
-
 static int
 vring_state_changed(int vid, uint16_t vring, int enable)
@@ -979,7 +913,6 @@ vring_state_changed(int vid, uint16_t vring, int enable)
 	state = vring_states[eth_dev->data->port_id];
 
-	if (enable && vring_conf_update(vid, eth_dev, vring))
-		VHOST_LOG(INFO, "Failed to update vring-%d configuration.\n",
-			  (int)vring);
+	if (eth_dev->data->dev_conf.intr_conf.rxq && vring % 2)
+		eth_vhost_update_intr(eth_dev, (vring - 1) >> 1);
 
 	rte_spinlock_lock(&state->lock);
@@ -1166,15 +1099,14 @@ eth_dev_start(struct rte_eth_dev *eth_dev)
 	struct rte_eth_conf *dev_conf = &eth_dev->data->dev_conf;
 
+	eth_vhost_uninstall_intr(eth_dev);
+	if (dev_conf->intr_conf.rxq && eth_vhost_install_intr(eth_dev) < 0) {
+		VHOST_LOG(ERR, "Failed to install interrupt handler.\n");
+		return -1;
+	}
+
 	queue_setup(eth_dev, internal);
-
-	if (rte_atomic32_read(&internal->dev_attached) == 1) {
-		if (dev_conf->intr_conf.rxq) {
-			if (eth_vhost_install_intr(eth_dev) < 0) {
-				VHOST_LOG(INFO,
-					"Failed to install interrupt handler.\n");
-					return -1;
-			}
-		}
-	}
+	if (rte_atomic32_read(&internal->dev_attached) == 1 &&
+			dev_conf->intr_conf.rxq)
+		eth_vhost_configure_intr(eth_dev);
 
 	rte_atomic32_set(&internal->started, 1);
@@ -1232,4 +1164,6 @@ eth_dev_close(struct rte_eth_dev *dev)
 	rte_free(internal);
 
+	eth_vhost_uninstall_intr(dev);
+
 	dev->data->dev_private = NULL;
 
@@ -1259,4 +1193,5 @@ eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
 	vq->virtqueue_id = rx_queue_id * VIRTIO_QNUM + VIRTIO_TXQ;
 	rte_spinlock_init(&vq->intr_lock);
+	vq->kickfd = -1;
 	dev->data->rx_queues[rx_queue_id] = vq;
 
@@ -1281,4 +1216,5 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
 	vq->virtqueue_id = tx_queue_id * VIRTIO_QNUM + VIRTIO_RXQ;
 	rte_spinlock_init(&vq->intr_lock);
+	vq->kickfd = -1;
 	dev->data->tx_queues[tx_queue_id] = vq;
 
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-22 10:30:08.202826988 +0000
+++ 0011-net-vhost-fix-Rx-interrupt.patch	2023-03-22 10:30:07.913866562 +0000
@@ -1 +1 @@
-From 7995bf4c295464c3a4c3f4ac500f890ab55567e7 Mon Sep 17 00:00:00 2001
+From 1585556d2cb3b4541747992b256d1b0672938bc6 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 7995bf4c295464c3a4c3f4ac500f890ab55567e7 ]
+
@@ -39 +40,0 @@
-Cc: stable@dpdk.org
@@ -49 +50 @@
-index 96deb18d91..62ef955ebc 100644
+index 31ff871bbc..4e44e123eb 100644
@@ -52 +53 @@
-@@ -79,6 +79,7 @@ struct vhost_queue {
+@@ -98,6 +98,7 @@ struct vhost_queue {
@@ -61 +62 @@
-@@ -546,88 +547,57 @@ find_internal_resource(char *ifname)
+@@ -520,88 +521,57 @@ find_internal_resource(char *ifname)
@@ -191 +192 @@
-@@ -635,24 +605,8 @@ static int
+@@ -609,24 +579,8 @@ static int
@@ -219 +220 @@
-@@ -665,4 +619,12 @@ eth_vhost_uninstall_intr(struct rte_eth_dev *dev)
+@@ -639,4 +593,12 @@ eth_vhost_uninstall_intr(struct rte_eth_dev *dev)
@@ -232 +233 @@
-@@ -674,13 +636,9 @@ static int
+@@ -648,13 +610,9 @@ static int
@@ -249 +250 @@
-@@ -690,5 +648,5 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)
+@@ -664,5 +622,5 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)
@@ -256 +257 @@
-@@ -701,38 +659,26 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)
+@@ -675,38 +633,26 @@ eth_vhost_install_intr(struct rte_eth_dev *dev)
@@ -311 +312 @@
-@@ -757,4 +703,44 @@ error:
+@@ -731,4 +677,44 @@ error:
@@ -356 +357 @@
-@@ -863,14 +849,6 @@ new_device(int vid)
+@@ -832,14 +818,6 @@ new_device(int vid)
@@ -373 +374 @@
-@@ -916,4 +894,5 @@ destroy_device(int vid)
+@@ -883,4 +861,5 @@ destroy_device(int vid)
@@ -379 +380 @@
-@@ -944,53 +923,8 @@ destroy_device(int vid)
+@@ -911,53 +890,8 @@ destroy_device(int vid)
@@ -433 +434 @@
-@@ -1012,7 +946,6 @@ vring_state_changed(int vid, uint16_t vring, int enable)
+@@ -979,7 +913,6 @@ vring_state_changed(int vid, uint16_t vring, int enable)
@@ -443 +444 @@
-@@ -1201,15 +1134,14 @@ eth_dev_start(struct rte_eth_dev *eth_dev)
+@@ -1166,15 +1099,14 @@ eth_dev_start(struct rte_eth_dev *eth_dev)
@@ -468 +469 @@
-@@ -1267,4 +1199,6 @@ eth_dev_close(struct rte_eth_dev *dev)
+@@ -1232,4 +1164,6 @@ eth_dev_close(struct rte_eth_dev *dev)
@@ -475 +476 @@
-@@ -1294,4 +1228,5 @@ eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
+@@ -1259,4 +1193,5 @@ eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
@@ -481 +482 @@
-@@ -1316,4 +1251,5 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
+@@ -1281,4 +1216,5 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,


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

* patch 'net/virtio: remove address width limit for modern devices' has been queued to stable release 21.11.4
  2023-03-22 10:31 patch 'raw/skeleton: fix selftest' has been queued to stable release 21.11.4 Kevin Traynor
                   ` (9 preceding siblings ...)
  2023-03-22 10:31 ` patch 'net/vhost: fix Rx interrupt' " Kevin Traynor
@ 2023-03-22 10:31 ` Kevin Traynor
  2023-03-22 10:32 ` patch 'net/sfc: invalidate switch port entry on representor unplug' " Kevin Traynor
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kevin Traynor @ 2023-03-22 10:31 UTC (permalink / raw)
  To: David Marchand; +Cc: Maxime Coquelin, Andy Pei, Chenbo Xia, dpdk stable

Hi,

FYI, your patch has been queued to stable release 21.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/24/23. 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

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

Thanks.

Kevin

---
From f5922d3d3da7cb495de9092fdb3ea59ff5e30524 Mon Sep 17 00:00:00 2001
From: David Marchand <david.marchand@redhat.com>
Date: Tue, 14 Mar 2023 09:53:34 +0100
Subject: [PATCH] net/virtio: remove address width limit for modern devices

[ upstream commit 8b76b3a0d327f6bedc1343149e03619337ab0408 ]

Modern devices don't have the same limitation as legacy devices, because
vring addresses are not configured using a 32-bit register.

Fixes: 6ba1f63b5ab0 ("virtio: support specification 1.0")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Andy Pei <andy.pei@intel.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
---
 drivers/net/virtio/virtio_pci.c | 28 ++++++++--------------------
 1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 632451dcbe..46b9ba6682 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -34,20 +34,4 @@
 struct virtio_pci_internal virtio_pci_internal[RTE_MAX_ETHPORTS];
 
-static inline int
-check_vq_phys_addr_ok(struct virtqueue *vq)
-{
-	/* Virtio PCI device VIRTIO_PCI_QUEUE_PF register is 32bit,
-	 * and only accepts 32 bit page frame number.
-	 * Check if the allocated physical memory exceeds 16TB.
-	 */
-	if ((vq->vq_ring_mem + vq->vq_ring_size - 1) >>
-			(VIRTIO_PCI_QUEUE_ADDR_SHIFT + 32)) {
-		PMD_INIT_LOG(ERR, "vring address shouldn't be above 16TB!");
-		return 0;
-	}
-
-	return 1;
-}
-
 #define PCI_MSIX_ENABLE 0x8000
 
@@ -274,6 +258,13 @@ legacy_setup_queue(struct virtio_hw *hw, struct virtqueue *vq)
 	uint32_t src;
 
-	if (!check_vq_phys_addr_ok(vq))
+	/* Virtio PCI device VIRTIO_PCI_QUEUE_PFN register is 32bit,
+	 * and only accepts 32 bit page frame number.
+	 * Check if the allocated physical memory exceeds 16TB.
+	 */
+	if ((vq->vq_ring_mem + vq->vq_ring_size - 1) >>
+			(VIRTIO_PCI_QUEUE_ADDR_SHIFT + 32)) {
+		PMD_INIT_LOG(ERR, "vring address shouldn't be above 16TB!");
 		return -1;
+	}
 
 	rte_pci_ioport_write(VTPCI_IO(hw), &vq->vq_queue_index, 2,
@@ -477,7 +468,4 @@ modern_setup_queue(struct virtio_hw *hw, struct virtqueue *vq)
 	uint16_t notify_off;
 
-	if (!check_vq_phys_addr_ok(vq))
-		return -1;
-
 	desc_addr = vq->vq_ring_mem;
 	avail_addr = desc_addr + vq->vq_nentries * sizeof(struct vring_desc);
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-22 10:30:08.226570524 +0000
+++ 0012-net-virtio-remove-address-width-limit-for-modern-dev.patch	2023-03-22 10:30:07.913866562 +0000
@@ -1 +1 @@
-From 8b76b3a0d327f6bedc1343149e03619337ab0408 Mon Sep 17 00:00:00 2001
+From f5922d3d3da7cb495de9092fdb3ea59ff5e30524 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 8b76b3a0d327f6bedc1343149e03619337ab0408 ]
+
@@ -10 +11,0 @@
-Cc: stable@dpdk.org
@@ -21 +22 @@
-index 9cf4d760b4..29eb739b04 100644
+index 632451dcbe..46b9ba6682 100644


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

* patch 'net/sfc: invalidate switch port entry on representor unplug' has been queued to stable release 21.11.4
  2023-03-22 10:31 patch 'raw/skeleton: fix selftest' has been queued to stable release 21.11.4 Kevin Traynor
                   ` (10 preceding siblings ...)
  2023-03-22 10:31 ` patch 'net/virtio: remove address width limit for modern devices' " Kevin Traynor
@ 2023-03-22 10:32 ` Kevin Traynor
  2023-03-22 10:32 ` patch 'net/i40e: fix AVX512 fast-free path' " Kevin Traynor
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kevin Traynor @ 2023-03-22 10:32 UTC (permalink / raw)
  To: Ivan Malov; +Cc: Andy Moreton, Andrew Rybchenko, dpdk stable

Hi,

FYI, your patch has been queued to stable release 21.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/24/23. 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

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

Thanks.

Kevin

---
From 998d70414b63064c39071f20021c21b0b8ca4b2d Mon Sep 17 00:00:00 2001
From: Ivan Malov <ivan.malov@arknetworks.am>
Date: Fri, 10 Mar 2023 21:07:17 +0400
Subject: [PATCH] net/sfc: invalidate switch port entry on representor unplug

[ upstream commit 723327bed49fb434bfb24b1e4393d5c4db537fda ]

Once allocated, a switch port list entry always stays there,
even after unplugging the ethdev that created it. Currently,
the entry's ethdev ID is not cleared on unplug. Referencing
the ethdev ID of a detached representor from a flow rule is
going to succeed, which is a bug. Also, if the user unplugs
endpoint "A" representor and plugs one for "B" instead, the
latter will pick the same ethdev ID as the gone representor,
but it will have a new port list entry added for it. If the
user tries to reference the ethdev ID from a flow rule, the
code will fetch the wrong entry ("A" rather than "B") since
it sits closer to the list head. That is a serious bug, too.

Make the driver invalidate ethdev ID field on ethdev unplug.

Fixes: 1fb65e4dae8a ("net/sfc: support flow action port ID in transfer rules")
Fixes: a62ec90522a6 ("net/sfc: add port representors infrastructure")

Signed-off-by: Ivan Malov <ivan.malov@arknetworks.am>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
 drivers/net/sfc/sfc_repr.c   |  2 ++
 drivers/net/sfc/sfc_switch.c | 12 ++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/drivers/net/sfc/sfc_repr.c b/drivers/net/sfc/sfc_repr.c
index 0669780f86..170f110048 100644
--- a/drivers/net/sfc/sfc_repr.c
+++ b/drivers/net/sfc/sfc_repr.c
@@ -842,4 +842,6 @@ sfc_repr_dev_close(struct rte_eth_dev *dev)
 	(void)sfc_repr_proxy_del_port(srs->pf_port_id, srs->repr_id);
 
+	sfc_mae_clear_switch_port(srs->switch_domain_id, srs->switch_port_id);
+
 	dev->rx_pkt_burst = NULL;
 	dev->tx_pkt_burst = NULL;
diff --git a/drivers/net/sfc/sfc_switch.c b/drivers/net/sfc/sfc_switch.c
index 5c10e8fc74..8f1ee97fa8 100644
--- a/drivers/net/sfc/sfc_switch.c
+++ b/drivers/net/sfc/sfc_switch.c
@@ -490,4 +490,5 @@ sfc_mae_clear_switch_port(uint16_t switch_domain_id,
 {
 	struct sfc_mae_switch_domain *domain;
+	struct sfc_mae_switch_port *port;
 
 	rte_spinlock_lock(&sfc_mae_switch.lock);
@@ -505,4 +506,15 @@ sfc_mae_clear_switch_port(uint16_t switch_domain_id,
 	}
 
+	TAILQ_FOREACH(port, &domain->ports, switch_domain_ports) {
+		if (port->id == switch_port_id) {
+			/*
+			 * Invalidate the field to prevent wrong
+			 * look-ups from flow rule handling path.
+			 */
+			port->ethdev_port_id = RTE_MAX_ETHPORTS;
+			break;
+		}
+	}
+
 	rte_spinlock_unlock(&sfc_mae_switch.lock);
 	return 0;
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-22 10:30:08.248447220 +0000
+++ 0013-net-sfc-invalidate-switch-port-entry-on-representor-.patch	2023-03-22 10:30:07.915866565 +0000
@@ -1 +1 @@
-From 723327bed49fb434bfb24b1e4393d5c4db537fda Mon Sep 17 00:00:00 2001
+From 998d70414b63064c39071f20021c21b0b8ca4b2d Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 723327bed49fb434bfb24b1e4393d5c4db537fda ]
+
@@ -22 +23,0 @@
-Cc: stable@dpdk.org
@@ -33 +34 @@
-index 4b03b101d8..919048e278 100644
+index 0669780f86..170f110048 100644
@@ -36 +37 @@
-@@ -837,4 +837,6 @@ sfc_repr_dev_close(struct rte_eth_dev *dev)
+@@ -842,4 +842,6 @@ sfc_repr_dev_close(struct rte_eth_dev *dev)


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

* patch 'net/i40e: fix AVX512 fast-free path' has been queued to stable release 21.11.4
  2023-03-22 10:31 patch 'raw/skeleton: fix selftest' has been queued to stable release 21.11.4 Kevin Traynor
                   ` (11 preceding siblings ...)
  2023-03-22 10:32 ` patch 'net/sfc: invalidate switch port entry on representor unplug' " Kevin Traynor
@ 2023-03-22 10:32 ` Kevin Traynor
  2023-03-22 10:32 ` patch 'net/e1000: fix saving of stripped VLAN TCI' " Kevin Traynor
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kevin Traynor @ 2023-03-22 10:32 UTC (permalink / raw)
  To: Kamalakshitha Aligeri
  Cc: Ruifeng Wang, Feifei Wang, Morten Brørup, dpdk stable

Hi,

FYI, your patch has been queued to stable release 21.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/24/23. 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

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

Thanks.

Kevin

---
From ac111b80fe45d3c13c82068e12bba2645b04e6ed Mon Sep 17 00:00:00 2001
From: Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>
Date: Tue, 7 Mar 2023 19:32:21 +0000
Subject: [PATCH] net/i40e: fix AVX512 fast-free path
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[ upstream commit 1ad4bea0d73a7671095c2c675f9bb8b19503ac06 ]

In i40e_tx_free_bufs_avx512 fast-free path, when cache is NULL,
non fast-free path is being executed. Fixed the bug by calling
rte_mempool_generic_put API that handles the cache==NULL case.

Fixes: 5171b4ee6b6b ("net/i40e: optimize Tx by using AVX512")

Signed-off-by: Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Feifei Wang <feifei.wang2@arm.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 .mailmap                                |  1 +
 drivers/net/i40e/i40e_rxtx_vec_avx512.c | 12 ++++--------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/.mailmap b/.mailmap
index 6a56239c3a..f4568f4984 100644
--- a/.mailmap
+++ b/.mailmap
@@ -680,4 +680,5 @@ Kaiwen Deng <kaiwenx.deng@intel.com>
 Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
 Kamalakannan R <kamalakannan.r@intel.com>
+Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>
 Kamil Bednarczyk <kamil.bednarczyk@intel.com>
 Kamil Chalupnik <kamilx.chalupnik@intel.com>
diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx512.c b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
index 2e8a3f0df6..2ad9a920a1 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
@@ -907,14 +907,11 @@ i40e_tx_free_bufs_avx512(struct i40e_tx_queue *txq)
 				rte_lcore_id());
 
-		if (!cache || cache->len == 0)
-			goto normal;
-
-		cache_objs = &cache->objs[cache->len];
-
-		if (n > RTE_MEMPOOL_CACHE_MAX_SIZE) {
-			rte_mempool_ops_enqueue_bulk(mp, (void *)txep, n);
+		if (!cache || n > RTE_MEMPOOL_CACHE_MAX_SIZE) {
+			rte_mempool_generic_put(mp, (void *)txep, n, cache);
 			goto done;
 		}
 
+		cache_objs = &cache->objs[cache->len];
+
 		/* The cache follows the following algorithm
 		 *   1. Add the objects to the cache
@@ -948,5 +945,4 @@ i40e_tx_free_bufs_avx512(struct i40e_tx_queue *txq)
 	}
 
-normal:
 	m = rte_pktmbuf_prefree_seg(txep[0].mbuf);
 	if (likely(m)) {
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-22 10:30:08.271775142 +0000
+++ 0014-net-i40e-fix-AVX512-fast-free-path.patch	2023-03-22 10:30:07.917866567 +0000
@@ -1 +1 @@
-From 1ad4bea0d73a7671095c2c675f9bb8b19503ac06 Mon Sep 17 00:00:00 2001
+From ac111b80fe45d3c13c82068e12bba2645b04e6ed Mon Sep 17 00:00:00 2001
@@ -8,0 +9,2 @@
+[ upstream commit 1ad4bea0d73a7671095c2c675f9bb8b19503ac06 ]
+
@@ -14 +15,0 @@
-Cc: stable@dpdk.org
@@ -26 +27 @@
-index 9578b86866..c77cdc9ddf 100644
+index 6a56239c3a..f4568f4984 100644
@@ -29 +30 @@
-@@ -682,4 +682,5 @@ Kaiwen Deng <kaiwenx.deng@intel.com>
+@@ -680,4 +680,5 @@ Kaiwen Deng <kaiwenx.deng@intel.com>
@@ -36 +37 @@
-index d3c7bfd121..ad0893324d 100644
+index 2e8a3f0df6..2ad9a920a1 100644
@@ -39 +40 @@
-@@ -784,14 +784,11 @@ i40e_tx_free_bufs_avx512(struct i40e_tx_queue *txq)
+@@ -907,14 +907,11 @@ i40e_tx_free_bufs_avx512(struct i40e_tx_queue *txq)
@@ -58 +59 @@
-@@ -825,5 +822,4 @@ i40e_tx_free_bufs_avx512(struct i40e_tx_queue *txq)
+@@ -948,5 +945,4 @@ i40e_tx_free_bufs_avx512(struct i40e_tx_queue *txq)


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

* patch 'net/e1000: fix saving of stripped VLAN TCI' has been queued to stable release 21.11.4
  2023-03-22 10:31 patch 'raw/skeleton: fix selftest' has been queued to stable release 21.11.4 Kevin Traynor
                   ` (12 preceding siblings ...)
  2023-03-22 10:32 ` patch 'net/i40e: fix AVX512 fast-free path' " Kevin Traynor
@ 2023-03-22 10:32 ` Kevin Traynor
  2023-03-22 10:32 ` patch 'net/i40e: fix MAC loopback on X722' " Kevin Traynor
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kevin Traynor @ 2023-03-22 10:32 UTC (permalink / raw)
  To: Visa Hankala; +Cc: Wenjun Wu, dpdk stable

Hi,

FYI, your patch has been queued to stable release 21.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/24/23. 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

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

Thanks.

Kevin

---
From acfff39a6d2e1c3ff1595d00970092adee2b6903 Mon Sep 17 00:00:00 2001
From: Visa Hankala <visa@hankala.org>
Date: Sun, 12 Mar 2023 13:44:42 +0000
Subject: [PATCH] net/e1000: fix saving of stripped VLAN TCI

[ upstream commit 8d57c9fcfcda3122aa38fba08a029ec248eeb52d ]

When receiving a scattered packet, save the stripped VLAN TCI
in the first mbuf segment where users expect to find it.

Fixes: 805803445a02 ("e1000: support EM devices (also known as e1000/e1000e)")

Signed-off-by: Visa Hankala <visa@hankala.org>
Acked-by: Wenjun Wu <wenjun1.wu@intel.com>
---
 .mailmap                    | 1 +
 drivers/net/e1000/em_rxtx.c | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/.mailmap b/.mailmap
index f4568f4984..3337f8a9e6 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1415,4 +1415,5 @@ Vincent S. Cojot <vcojot@redhat.com>
 Vipin Varghese <vipin.varghese@amd.com> <vipin.varghese@intel.com>
 Vipul Ashri <vipul.ashri@oracle.com>
+Visa Hankala <visa@hankala.org>
 Vishal Kulkarni <vishal@chelsio.com>
 Vishwas Danivas <vishwas@pensando.io>
diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c
index cea5b490ba..73602313a7 100644
--- a/drivers/net/e1000/em_rxtx.c
+++ b/drivers/net/e1000/em_rxtx.c
@@ -1031,4 +1031,5 @@ eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 *    - hardware offload data, if any:
 		 *      - IP checksum flag,
+		 *      - VLAN TCI, if any,
 		 *      - error flags.
 		 */
@@ -1040,5 +1041,5 @@ eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 		/* Only valid if RTE_MBUF_F_RX_VLAN set in pkt_flags */
-		rxm->vlan_tci = rte_le_to_cpu_16(rxd.special);
+		first_seg->vlan_tci = rte_le_to_cpu_16(rxd.special);
 
 		/* Prefetch data of first segment, if configured to do so. */
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-22 10:30:08.295553752 +0000
+++ 0015-net-e1000-fix-saving-of-stripped-VLAN-TCI.patch	2023-03-22 10:30:07.920866570 +0000
@@ -1 +1 @@
-From 8d57c9fcfcda3122aa38fba08a029ec248eeb52d Mon Sep 17 00:00:00 2001
+From acfff39a6d2e1c3ff1595d00970092adee2b6903 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 8d57c9fcfcda3122aa38fba08a029ec248eeb52d ]
+
@@ -10 +11,0 @@
-Cc: stable@dpdk.org
@@ -20 +21 @@
-index c77cdc9ddf..e69e75ca72 100644
+index f4568f4984..3337f8a9e6 100644
@@ -23 +24 @@
-@@ -1418,4 +1418,5 @@ Vincent S. Cojot <vcojot@redhat.com>
+@@ -1415,4 +1415,5 @@ Vincent S. Cojot <vcojot@redhat.com>
@@ -30 +31 @@
-index d48fd52404..cb5ce2307b 100644
+index cea5b490ba..73602313a7 100644


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

* patch 'net/i40e: fix MAC loopback on X722' has been queued to stable release 21.11.4
  2023-03-22 10:31 patch 'raw/skeleton: fix selftest' has been queued to stable release 21.11.4 Kevin Traynor
                   ` (13 preceding siblings ...)
  2023-03-22 10:32 ` patch 'net/e1000: fix saving of stripped VLAN TCI' " Kevin Traynor
@ 2023-03-22 10:32 ` Kevin Traynor
  2023-03-22 10:32 ` patch 'net/iavf: fix device stop during reset' " Kevin Traynor
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kevin Traynor @ 2023-03-22 10:32 UTC (permalink / raw)
  To: Wenjing Qiao; +Cc: Dukai Yuan, dpdk stable

Hi,

FYI, your patch has been queued to stable release 21.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/24/23. 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

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

Thanks.

Kevin

---
From e71d71bc0cb12c85616ccb24ff24a507b5344371 Mon Sep 17 00:00:00 2001
From: Wenjing Qiao <wenjing.qiao@intel.com>
Date: Mon, 13 Mar 2023 23:16:19 -0400
Subject: [PATCH] net/i40e: fix MAC loopback on X722

[ upstream commit 6355ff768b0b5871cc82a69194b376db39ee6e9c ]

If enabling MAC loopback mode on X722 NIC, transmitted packets are not
seen in the receive queue. The root cause is using wrong loopback mode
bits. Correct it according to the X722 datasheet.

Fixes: 3a838ab649df ("net/i40e: support MAC loopback")
Fixes: 5712e6407089 ("net/i40e: revert enhancing loopback AQ command")

Signed-off-by: Wenjing Qiao <wenjing.qiao@intel.com>
Tested-by: Dukai Yuan <dukaix.yuan@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 17 ++++++++++++++---
 drivers/net/i40e/i40e_ethdev.h |  3 +++
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 1d417dbf8a..07deb272c3 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2448,8 +2448,19 @@ i40e_dev_start(struct rte_eth_dev *dev)
 	}
 
+	/* Disable mac loopback mode */
+	if (dev->data->dev_conf.lpbk_mode == I40E_AQ_LB_MODE_NONE) {
+		ret = i40e_aq_set_lb_modes(hw, I40E_AQ_LB_MODE_NONE, NULL);
+		if (ret != I40E_SUCCESS) {
+			PMD_DRV_LOG(ERR, "fail to set loopback link");
+			goto tx_err;
+		}
+	}
+
 	/* Enable mac loopback mode */
-	if (dev->data->dev_conf.lpbk_mode == I40E_AQ_LB_MODE_NONE ||
-	    dev->data->dev_conf.lpbk_mode == I40E_AQ_LB_PHY_LOCAL) {
-		ret = i40e_aq_set_lb_modes(hw, dev->data->dev_conf.lpbk_mode, NULL);
+	if (dev->data->dev_conf.lpbk_mode == I40E_AQ_LB_MODE_EN) {
+		if (hw->mac.type == I40E_MAC_X722)
+			ret = i40e_aq_set_lb_modes(hw, I40E_AQ_LB_MAC_LOCAL_X722, NULL);
+		else
+			ret = i40e_aq_set_lb_modes(hw, I40E_AQ_LB_MAC, NULL);
 		if (ret != I40E_SUCCESS) {
 			PMD_DRV_LOG(ERR, "fail to set loopback link");
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index e918771256..c4abbae6c3 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -49,4 +49,7 @@
 /*flag of no loopback*/
 #define I40E_AQ_LB_MODE_NONE	  0x0
+#define I40E_AQ_LB_MODE_EN	  0x01
+#define I40E_AQ_LB_MAC		  0x01
+#define I40E_AQ_LB_MAC_LOCAL_X722 0x04
 /*
  * vlan_id is a 12 bit number.
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-22 10:30:08.319221247 +0000
+++ 0016-net-i40e-fix-MAC-loopback-on-X722.patch	2023-03-22 10:30:07.929866581 +0000
@@ -1 +1 @@
-From 6355ff768b0b5871cc82a69194b376db39ee6e9c Mon Sep 17 00:00:00 2001
+From e71d71bc0cb12c85616ccb24ff24a507b5344371 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 6355ff768b0b5871cc82a69194b376db39ee6e9c ]
+
@@ -12 +13,0 @@
-Cc: stable@dpdk.org
@@ -22 +23 @@
-index 371f42233e..cb0070f94b 100644
+index 1d417dbf8a..07deb272c3 100644
@@ -25 +26 @@
-@@ -2412,8 +2412,19 @@ i40e_dev_start(struct rte_eth_dev *dev)
+@@ -2448,8 +2448,19 @@ i40e_dev_start(struct rte_eth_dev *dev)
@@ -49 +50 @@
-index 7c4cc44a27..9b806d130e 100644
+index e918771256..c4abbae6c3 100644


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

* patch 'net/iavf: fix device stop during reset' has been queued to stable release 21.11.4
  2023-03-22 10:31 patch 'raw/skeleton: fix selftest' has been queued to stable release 21.11.4 Kevin Traynor
                   ` (14 preceding siblings ...)
  2023-03-22 10:32 ` patch 'net/i40e: fix MAC loopback on X722' " Kevin Traynor
@ 2023-03-22 10:32 ` Kevin Traynor
  2023-03-22 10:32 ` patch 'net/mlx5: fix hairpin Tx queue reference count' " Kevin Traynor
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kevin Traynor @ 2023-03-22 10:32 UTC (permalink / raw)
  To: Zhichao Zeng; +Cc: Qi Zhang, dpdk stable

Hi,

FYI, your patch has been queued to stable release 21.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/24/23. 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

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

Thanks.

Kevin

---
From 35f911011c689d17c542d07a12a924dd0636207d Mon Sep 17 00:00:00 2001
From: Zhichao Zeng <zhichaox.zeng@intel.com>
Date: Thu, 16 Mar 2023 15:14:49 +0800
Subject: [PATCH] net/iavf: fix device stop during reset

[ upstream commit 24b8bc86dc489ab77d7de7626cc6af7ac9eaba0b ]

The rte_eth_dev_stop will return wrong value as error will return from
iavf PMD during device reset.

This patch is a work around to fix it by return 0 in dev_stop during
device reset.

Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")

Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 630779fb21..a115a9f641 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -1035,4 +1035,7 @@ iavf_dev_stop(struct rte_eth_dev *dev)
 	PMD_INIT_FUNC_TRACE();
 
+	if (vf->vf_reset)
+		return 0;
+
 	if (adapter->closed)
 		return -1;
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-22 10:30:08.349725571 +0000
+++ 0017-net-iavf-fix-device-stop-during-reset.patch	2023-03-22 10:30:07.930866582 +0000
@@ -1 +1 @@
-From 24b8bc86dc489ab77d7de7626cc6af7ac9eaba0b Mon Sep 17 00:00:00 2001
+From 35f911011c689d17c542d07a12a924dd0636207d Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 24b8bc86dc489ab77d7de7626cc6af7ac9eaba0b ]
+
@@ -13 +14,0 @@
-Cc: stable@dpdk.org
@@ -22 +23 @@
-index 3196210f2c..f6d68403ce 100644
+index 630779fb21..a115a9f641 100644
@@ -25 +26 @@
-@@ -1066,4 +1066,7 @@ iavf_dev_stop(struct rte_eth_dev *dev)
+@@ -1035,4 +1035,7 @@ iavf_dev_stop(struct rte_eth_dev *dev)


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

* patch 'net/mlx5: fix hairpin Tx queue reference count' has been queued to stable release 21.11.4
  2023-03-22 10:31 patch 'raw/skeleton: fix selftest' has been queued to stable release 21.11.4 Kevin Traynor
                   ` (15 preceding siblings ...)
  2023-03-22 10:32 ` patch 'net/iavf: fix device stop during reset' " Kevin Traynor
@ 2023-03-22 10:32 ` Kevin Traynor
  2023-03-22 10:32 ` patch 'doc: fix LPM support in l3forward guide' " Kevin Traynor
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kevin Traynor @ 2023-03-22 10:32 UTC (permalink / raw)
  To: Bing Zhao; +Cc: Matan Azrad, Viacheslav Ovsiienko, dpdk stable

Hi,

FYI, your patch has been queued to stable release 21.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/24/23. 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

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

Thanks.

Kevin

---
From 7a7e85c4de66dbbcb0c2db9dee384528ae4057ab Mon Sep 17 00:00:00 2001
From: Bing Zhao <bingz@nvidia.com>
Date: Tue, 7 Mar 2023 12:31:08 +0200
Subject: [PATCH] net/mlx5: fix hairpin Tx queue reference count

[ upstream commit 9284987a85b07e168b165fc258523a3a4fde58e2 ]

When calling the haipin unbind interface, all the hairpin Tx queues
of the port will be unbound from the peer Rx queues. If one of the
Tx queue is working in the auto bind mode, the interface will return
directly.

Only when the Tx and peer Rx ports are the same, the auto bind mode
is supported. In this condition branch, the Tx queue release is
missed and the reference count is not decreased. Then in the port
stop stage, the hardware resources of this Tx queue won't be
freed. There would be some assertion or failure when starting the
port again.

With this commit, the reference count will be operated correctly.

Fixes: 37cd4501e873 ("net/mlx5: support two ports hairpin mode")

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/net/mlx5/mlx5_trigger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
index 4800624ea3..feffcc4ce0 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -895,9 +895,9 @@ mlx5_hairpin_unbind_single_port(struct rte_eth_dev *dev, uint16_t rx_port)
 		/* Indeed, only the first used queue needs to be checked. */
 		if (txq_ctrl->hairpin_conf.manual_bind == 0) {
+			mlx5_txq_release(dev, i);
 			if (cur_port != rx_port) {
 				rte_errno = EINVAL;
 				DRV_LOG(ERR, "port %u and port %u are in"
 					" auto-bind mode", cur_port, rx_port);
-				mlx5_txq_release(dev, i);
 				return -rte_errno;
 			} else {
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-22 10:30:08.372249363 +0000
+++ 0018-net-mlx5-fix-hairpin-Tx-queue-reference-count.patch	2023-03-22 10:30:07.932866584 +0000
@@ -1 +1 @@
-From 9284987a85b07e168b165fc258523a3a4fde58e2 Mon Sep 17 00:00:00 2001
+From 7a7e85c4de66dbbcb0c2db9dee384528ae4057ab Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 9284987a85b07e168b165fc258523a3a4fde58e2 ]
+
@@ -21 +22,0 @@
-Cc: stable@dpdk.org
@@ -31 +32 @@
-index 3457bf65d3..bbaa7d2aa0 100644
+index 4800624ea3..feffcc4ce0 100644
@@ -34 +35 @@
-@@ -897,9 +897,9 @@ mlx5_hairpin_unbind_single_port(struct rte_eth_dev *dev, uint16_t rx_port)
+@@ -895,9 +895,9 @@ mlx5_hairpin_unbind_single_port(struct rte_eth_dev *dev, uint16_t rx_port)


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

* patch 'doc: fix LPM support in l3forward guide' has been queued to stable release 21.11.4
  2023-03-22 10:31 patch 'raw/skeleton: fix selftest' has been queued to stable release 21.11.4 Kevin Traynor
                   ` (16 preceding siblings ...)
  2023-03-22 10:32 ` patch 'net/mlx5: fix hairpin Tx queue reference count' " Kevin Traynor
@ 2023-03-22 10:32 ` Kevin Traynor
  2023-03-22 10:32 ` patch 'bus/ifpga: fix devargs handling' " Kevin Traynor
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: Kevin Traynor @ 2023-03-22 10:32 UTC (permalink / raw)
  To: Kamalakshitha Aligeri
  Cc: Honnappa Nagarahalli, Ruifeng Wang, Konstantin Ananyev, dpdk stable

Hi,

FYI, your patch has been queued to stable release 21.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/24/23. 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

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

Thanks.

Kevin

---
From 34934b2b198e36c19eb3d021a60bb9bcb91db2dd Mon Sep 17 00:00:00 2001
From: Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>
Date: Mon, 6 Mar 2023 16:25:07 +0000
Subject: [PATCH] doc: fix LPM support in l3forward guide

[ upstream commit 2bf48044dca1892e571fd4964eecaacf6cb0c1c2 ]

LPM based lookup supports both IPv4 and IPv6 forwarding.

Fixes: 6a094e328598 ("examples/l3fwd: implement FIB lookup method")

Signed-off-by: Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
---
 doc/guides/sample_app_ug/l3_forward.rst | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/doc/guides/sample_app_ug/l3_forward.rst b/doc/guides/sample_app_ug/l3_forward.rst
index 6d7d7c5cc1..9fb44e2c23 100644
--- a/doc/guides/sample_app_ug/l3_forward.rst
+++ b/doc/guides/sample_app_ug/l3_forward.rst
@@ -45,7 +45,6 @@ The set of LPM and FIB rules used by the application is statically configured
 and loaded into the LPM or FIB object at initialization time.
 
-In the sample application, hash-based and FIB-based forwarding supports
+In the sample application, hash-based, LPM-based, FIB-based and ACL-based forwarding supports
 both IPv4 and IPv6.
-LPM-based forwarding supports IPv4 only.
 
 Compiling the Application
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-22 10:30:08.395236348 +0000
+++ 0019-doc-fix-LPM-support-in-l3forward-guide.patch	2023-03-22 10:30:07.932866584 +0000
@@ -1 +1 @@
-From 2bf48044dca1892e571fd4964eecaacf6cb0c1c2 Mon Sep 17 00:00:00 2001
+From 34934b2b198e36c19eb3d021a60bb9bcb91db2dd Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 2bf48044dca1892e571fd4964eecaacf6cb0c1c2 ]
+
@@ -9 +10,0 @@
-Cc: stable@dpdk.org
@@ -20 +21 @@
-index 94b22da01e..1cc2c1dd1d 100644
+index 6d7d7c5cc1..9fb44e2c23 100644
@@ -23,2 +24,2 @@
-@@ -57,7 +57,6 @@ The 5-tuple syntax consists of a source IP address, a destination IP address,
- a source port, a destination port and a protocol identifier.
+@@ -45,7 +45,6 @@ The set of LPM and FIB rules used by the application is statically configured
+ and loaded into the LPM or FIB object at initialization time.
@@ -26 +27 @@
--In the sample application, hash-based, FIB-based and ACL-based forwarding supports
+-In the sample application, hash-based and FIB-based forwarding supports
@@ -30 +30,0 @@
- During the initialization phase route rules for IPv4 and IPv6 are read from rule files.
@@ -31,0 +32 @@
+ Compiling the Application


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

* patch 'bus/ifpga: fix devargs handling' has been queued to stable release 21.11.4
  2023-03-22 10:31 patch 'raw/skeleton: fix selftest' has been queued to stable release 21.11.4 Kevin Traynor
                   ` (17 preceding siblings ...)
  2023-03-22 10:32 ` patch 'doc: fix LPM support in l3forward guide' " Kevin Traynor
@ 2023-03-22 10:32 ` Kevin Traynor
  2023-03-22 10:32 ` patch 'net/ipn3ke: fix thread exit' " Kevin Traynor
  2023-03-22 10:32 ` patch 'net/ipn3ke: fix representor name' " Kevin Traynor
  20 siblings, 0 replies; 22+ messages in thread
From: Kevin Traynor @ 2023-03-22 10:32 UTC (permalink / raw)
  To: Wei Huang; +Cc: Tianfei Zhang, Rosen Xu, dpdk stable

Hi,

FYI, your patch has been queued to stable release 21.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/24/23. 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

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

Thanks.

Kevin

---
From 400ac4f9daafb903b476b2e43b5853024407d12f Mon Sep 17 00:00:00 2001
From: Wei Huang <wei.huang@intel.com>
Date: Thu, 16 Mar 2023 16:44:12 -0400
Subject: [PATCH] bus/ifpga: fix devargs handling

[ upstream commit 8a0b28b4d9581497d7b347c7c8797317707cd58f ]

In function ifpga_scan_one(), variable 'path' is NULL if device argument
'afu_bts' is not set, subsequent string copy with 'path' would lead to
segmentation fault.

Fixes: 6fa4aa2b3645 ("bus/ifpga: fix forcing optional devargs")

Signed-off-by: Wei Huang <wei.huang@intel.com>
Acked-by: Tianfei Zhang <tianfei.zhang@intel.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
---
 drivers/bus/ifpga/ifpga_bus.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index c5c8bbd572..f82b93af65 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -137,4 +137,6 @@ ifpga_scan_one(struct rte_rawdev *rawdev,
 		}
 		afu_pr_conf.pr_enable = 1;
+		strlcpy(afu_pr_conf.bs_path, path,
+			sizeof(afu_pr_conf.bs_path));
 	} else {
 		afu_pr_conf.pr_enable = 0;
@@ -176,5 +178,4 @@ ifpga_scan_one(struct rte_rawdev *rawdev,
 		goto end;
 
-	strlcpy(afu_pr_conf.bs_path, path, sizeof(afu_pr_conf.bs_path));
 	if (rawdev->dev_ops &&
 		rawdev->dev_ops->firmware_load &&
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-22 10:30:08.417427812 +0000
+++ 0020-bus-ifpga-fix-devargs-handling.patch	2023-03-22 10:30:07.933866586 +0000
@@ -1 +1 @@
-From 8a0b28b4d9581497d7b347c7c8797317707cd58f Mon Sep 17 00:00:00 2001
+From 400ac4f9daafb903b476b2e43b5853024407d12f Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 8a0b28b4d9581497d7b347c7c8797317707cd58f ]
+
@@ -11 +12,0 @@
-Cc: stable@dpdk.org
@@ -21 +22 @@
-index bb943b58b5..07e316b38e 100644
+index c5c8bbd572..f82b93af65 100644
@@ -24 +25 @@
-@@ -136,4 +136,6 @@ ifpga_scan_one(struct rte_rawdev *rawdev,
+@@ -137,4 +137,6 @@ ifpga_scan_one(struct rte_rawdev *rawdev,
@@ -31 +32 @@
-@@ -175,5 +177,4 @@ ifpga_scan_one(struct rte_rawdev *rawdev,
+@@ -176,5 +178,4 @@ ifpga_scan_one(struct rte_rawdev *rawdev,


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

* patch 'net/ipn3ke: fix thread exit' has been queued to stable release 21.11.4
  2023-03-22 10:31 patch 'raw/skeleton: fix selftest' has been queued to stable release 21.11.4 Kevin Traynor
                   ` (18 preceding siblings ...)
  2023-03-22 10:32 ` patch 'bus/ifpga: fix devargs handling' " Kevin Traynor
@ 2023-03-22 10:32 ` Kevin Traynor
  2023-03-22 10:32 ` patch 'net/ipn3ke: fix representor name' " Kevin Traynor
  20 siblings, 0 replies; 22+ messages in thread
From: Kevin Traynor @ 2023-03-22 10:32 UTC (permalink / raw)
  To: Wei Huang; +Cc: Rosen Xu, dpdk stable

Hi,

FYI, your patch has been queued to stable release 21.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/24/23. 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

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

Thanks.

Kevin

---
From b3fbfee3fb57095b45b1fb9c720d14abffa9681f Mon Sep 17 00:00:00 2001
From: Wei Huang <wei.huang@intel.com>
Date: Thu, 16 Mar 2023 16:45:06 -0400
Subject: [PATCH] net/ipn3ke: fix thread exit

[ upstream commit d8f8e928a7ba23283300b1b80259d0c102348005 ]

Thread does not exit after driver is removed. When there is no
more representor exist, the variable 'num' will be 0 and thread
can exit safely at this time.

Fixes: 70d6b7f550f4 ("net/ipn3ke: add representor")

Signed-off-by: Wei Huang <wei.huang@intel.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
---
 drivers/net/ipn3ke/ipn3ke_representor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index abbecfdf2e..9059e4ce0a 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -2580,5 +2580,5 @@ ipn3ke_rpst_scan_handle_request(__rte_unused void *param)
 		rte_delay_us(50 * MS);
 
-		if (num == 0xffffff)
+		if (num == 0 || num == 0xffffff)
 			return NULL;
 	}
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-22 10:30:08.439579853 +0000
+++ 0021-net-ipn3ke-fix-thread-exit.patch	2023-03-22 10:30:07.934866587 +0000
@@ -1 +1 @@
-From d8f8e928a7ba23283300b1b80259d0c102348005 Mon Sep 17 00:00:00 2001
+From b3fbfee3fb57095b45b1fb9c720d14abffa9681f Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit d8f8e928a7ba23283300b1b80259d0c102348005 ]
+
@@ -11 +12,0 @@
-Cc: stable@dpdk.org
@@ -20 +21 @@
-index 2ef96a984a..e50fc73f43 100644
+index abbecfdf2e..9059e4ce0a 100644


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

* patch 'net/ipn3ke: fix representor name' has been queued to stable release 21.11.4
  2023-03-22 10:31 patch 'raw/skeleton: fix selftest' has been queued to stable release 21.11.4 Kevin Traynor
                   ` (19 preceding siblings ...)
  2023-03-22 10:32 ` patch 'net/ipn3ke: fix thread exit' " Kevin Traynor
@ 2023-03-22 10:32 ` Kevin Traynor
  20 siblings, 0 replies; 22+ messages in thread
From: Kevin Traynor @ 2023-03-22 10:32 UTC (permalink / raw)
  To: Wei Huang; +Cc: Rosen Xu, dpdk stable

Hi,

FYI, your patch has been queued to stable release 21.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/24/23. 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

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

Thanks.

Kevin

---
From 398c55fee9f187ae8f73cd064140c78aa84cd700 Mon Sep 17 00:00:00 2001
From: Wei Huang <wei.huang@intel.com>
Date: Thu, 16 Mar 2023 16:44:56 -0400
Subject: [PATCH] net/ipn3ke: fix representor name

[ upstream commit f66141886fec510764d7be89a2787e8931a00b77 ]

The device name used in rte_eth_dev_allocated() function
is afu device name instead of representor name, this patch
correct it.

Fixes: c01c748e4ae6 ("net/ipn3ke: add new driver")

Signed-off-by: Wei Huang <wei.huang@intel.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
---
 drivers/net/ipn3ke/ipn3ke_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.c b/drivers/net/ipn3ke/ipn3ke_ethdev.c
index 014e438dd5..d36bf99fab 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.c
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.c
@@ -562,5 +562,5 @@ static int ipn3ke_vswitch_remove(struct rte_afu_device *afu_dev)
 			afu_dev->device.name, i);
 
-		ethdev = rte_eth_dev_allocated(afu_dev->device.name);
+		ethdev = rte_eth_dev_allocated(name);
 		if (ethdev != NULL)
 			rte_eth_dev_destroy(ethdev, ipn3ke_rpst_uninit);
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-22 10:30:08.462621106 +0000
+++ 0022-net-ipn3ke-fix-representor-name.patch	2023-03-22 10:30:07.935866588 +0000
@@ -1 +1 @@
-From f66141886fec510764d7be89a2787e8931a00b77 Mon Sep 17 00:00:00 2001
+From 398c55fee9f187ae8f73cd064140c78aa84cd700 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit f66141886fec510764d7be89a2787e8931a00b77 ]
+
@@ -11 +12,0 @@
-Cc: stable@dpdk.org
@@ -20 +21 @@
-index 70a06a3b15..2c15611a23 100644
+index 014e438dd5..d36bf99fab 100644
@@ -23 +24 @@
-@@ -559,5 +559,5 @@ static int ipn3ke_vswitch_remove(struct rte_afu_device *afu_dev)
+@@ -562,5 +562,5 @@ static int ipn3ke_vswitch_remove(struct rte_afu_device *afu_dev)


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

end of thread, other threads:[~2023-03-22 10:32 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22 10:31 patch 'raw/skeleton: fix selftest' has been queued to stable release 21.11.4 Kevin Traynor
2023-03-22 10:31 ` patch 'reorder: fix sequence number mbuf field register' " Kevin Traynor
2023-03-22 10:31 ` patch 'test: fix segment length in packet generator' " Kevin Traynor
2023-03-22 10:31 ` patch 'test/mbuf: fix test with mbuf debug enabled' " Kevin Traynor
2023-03-22 10:31 ` patch 'test/crypto: fix ZUC digest length in comparison' " Kevin Traynor
2023-03-22 10:31 ` patch 'test/crypto: fix capability check for ZUC cipher-auth' " Kevin Traynor
2023-03-22 10:31 ` patch 'app/compress-perf: fix remaining data for ops' " Kevin Traynor
2023-03-22 10:31 ` patch 'app/bbdev: check statistics failure' " Kevin Traynor
2023-03-22 10:31 ` patch 'net/vhost: add missing newline in logs' " Kevin Traynor
2023-03-22 10:31 ` patch 'net/vhost: fix leak in interrupt handle setup' " Kevin Traynor
2023-03-22 10:31 ` patch 'net/vhost: fix Rx interrupt' " Kevin Traynor
2023-03-22 10:31 ` patch 'net/virtio: remove address width limit for modern devices' " Kevin Traynor
2023-03-22 10:32 ` patch 'net/sfc: invalidate switch port entry on representor unplug' " Kevin Traynor
2023-03-22 10:32 ` patch 'net/i40e: fix AVX512 fast-free path' " Kevin Traynor
2023-03-22 10:32 ` patch 'net/e1000: fix saving of stripped VLAN TCI' " Kevin Traynor
2023-03-22 10:32 ` patch 'net/i40e: fix MAC loopback on X722' " Kevin Traynor
2023-03-22 10:32 ` patch 'net/iavf: fix device stop during reset' " Kevin Traynor
2023-03-22 10:32 ` patch 'net/mlx5: fix hairpin Tx queue reference count' " Kevin Traynor
2023-03-22 10:32 ` patch 'doc: fix LPM support in l3forward guide' " Kevin Traynor
2023-03-22 10:32 ` patch 'bus/ifpga: fix devargs handling' " Kevin Traynor
2023-03-22 10:32 ` patch 'net/ipn3ke: fix thread exit' " Kevin Traynor
2023-03-22 10:32 ` patch 'net/ipn3ke: fix representor name' " Kevin Traynor

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).