patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: David Marchand <david.marchand@redhat.com>
Cc: Yu Jiang <yux.jiang@intel.com>,
	Hemant Agrawal <hemant.agrawal@nxp.com>,
	dpdk stable <stable@dpdk.org>
Subject: patch 'raw/skeleton: fix selftest' has been queued to stable release 21.11.4
Date: Wed, 22 Mar 2023 10:31:48 +0000	[thread overview]
Message-ID: <20230322103209.456098-1-ktraynor@redhat.com> (raw)

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


             reply	other threads:[~2023-03-22 10:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22 10:31 Kevin Traynor [this message]
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

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20230322103209.456098-1-ktraynor@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=david.marchand@redhat.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=stable@dpdk.org \
    --cc=yux.jiang@intel.com \
    /path/to/YOUR_REPLY

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).