DPDK patches and discussions
 help / color / mirror / Atom feed
From: <pbhagavatula@marvell.com>
To: <jerinj@marvell.com>, Naga Harish K S V <s.v.naga.harish.k@intel.com>
Cc: <dev@dpdk.org>, Pavan Nikhilesh <pbhagavatula@marvell.com>
Subject: [PATCH] eventdev/eth_rx: fix invalid memory access
Date: Wed, 5 Apr 2023 15:09:59 +0530	[thread overview]
Message-ID: <20230405093959.2052-1-pbhagavatula@marvell.com> (raw)

From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Rx adapter internal service structures are only initialized
when non-internal port is added to the adapter.
Check if Rx adapter service is initialized to determine if
runtime set/get parameters are supported.

Fixes: 3716f52186af ("eventdev/eth_rx: support runtime set/get parameters")

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 app/test/test_event_eth_rx_adapter.c    |  2 ++
 lib/eventdev/rte_event_eth_rx_adapter.c | 25 ++++++-------------------
 2 files changed, 8 insertions(+), 19 deletions(-)

diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
index cfe6052d7e..b1775e6af1 100644
--- a/app/test/test_event_eth_rx_adapter.c
+++ b/app/test/test_event_eth_rx_adapter.c
@@ -1230,6 +1230,8 @@ adapter_get_set_params(void)
 	/* Case 1: Get the default value of mbufs processed by Rx adapter */
 	err = rte_event_eth_rx_adapter_runtime_params_get(TEST_INST_ID,
 							  &out_params);
+	if (err == -ENOTSUP)
+		return TEST_SKIPPED;
 	TEST_ASSERT(err == 0, "Expected 0 got %d", err);
 
 	/* Case 2: Set max_nb_rx = 32 (=BATCH_SEIZE) */
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index c1cd124002..b8bab719f5 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -3466,30 +3466,17 @@ rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id,
 static int
 rxa_caps_check(struct event_eth_rx_adapter *rxa)
 {
-	uint16_t eth_dev_id;
-	uint32_t caps = 0;
-	int ret;
+	struct eth_device_info *dev_info;
+	int i;
 
 	if (!rxa->nb_queues)
 		return -EINVAL;
 
-	/* The eth_dev used is always of same type.
-	 * Hence eth_dev_id is taken from first entry of poll array.
-	 */
-	eth_dev_id = rxa->eth_rx_poll[0].eth_dev_id;
-	ret = rte_event_eth_rx_adapter_caps_get(rxa->eventdev_id,
-						eth_dev_id,
-						&caps);
-	if (ret) {
-		RTE_EDEV_LOG_ERR("Failed to get adapter caps edev %" PRIu8
-			"eth port %" PRIu16, rxa->eventdev_id, eth_dev_id);
-		return ret;
-	}
-
-	if (caps & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT)
-		return -ENOTSUP;
+	/* Check if there is atleast one non-internal ethernet port. */
+	if (rxa->service_inited)
+		return 0;
 
-	return 0;
+	return -ENOTSUP;
 }
 
 int
-- 
2.25.1


             reply	other threads:[~2023-04-05  9:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-05  9:39 pbhagavatula [this message]
2023-04-05  9:43 ` [PATCH v2] " pbhagavatula
2023-04-06  7:36   ` Naga Harish K, S V
2023-04-06  8:12     ` Pavan Nikhilesh Bhagavatula
2023-04-07  6:47   ` [PATCH v3] " pbhagavatula
2023-04-17  6:30     ` Naga Harish K, S V
2023-05-02 14:45       ` Jerin Jacob

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=20230405093959.2052-1-pbhagavatula@marvell.com \
    --to=pbhagavatula@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=s.v.naga.harish.k@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).