DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] examples/l3fwd: fix error checking
@ 2020-04-17  8:25 Sunil Kumar Kori
  2020-05-01 11:15 ` Pavan Nikhilesh Bhagavatula
  0 siblings, 1 reply; 3+ messages in thread
From: Sunil Kumar Kori @ 2020-04-17  8:25 UTC (permalink / raw)
  To: Jerin Jacob, Marko Kovacevic, Ori Kam, Bruce Richardson,
	Radu Nicolau, Akhil Goyal, Tomasz Kantecki, Sunil Kumar Kori,
	Pavan Nikhilesh
  Cc: dev

Patch fixes coverity issues which handle return values from AP
calling.

Coverity issue: 354227, 354232, 354238, 354239, 354240

Fixes: aaf58cb85b62 ("examples/l3fwd: add event port and queue setup")

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
---
 examples/l3fwd/l3fwd_event.c               |  6 +++++-
 examples/l3fwd/l3fwd_event_generic.c       |  9 +++++++--
 examples/l3fwd/l3fwd_event_internal_port.c | 10 ++++++++--
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/examples/l3fwd/l3fwd_event.c b/examples/l3fwd/l3fwd_event.c
index 43c47eade..4d31593a0 100644
--- a/examples/l3fwd/l3fwd_event.c
+++ b/examples/l3fwd/l3fwd_event.c
@@ -70,7 +70,11 @@ l3fwd_eth_dev_port_setup(struct rte_eth_conf *port_conf)
 		printf("Creating queues: nb_rxq=%d nb_txq=1...\n",
 		       evt_rsrc->eth_rx_queues);
 
-		rte_eth_dev_info_get(port_id, &dev_info);
+		ret = rte_eth_dev_info_get(port_id, &dev_info);
+		if (ret != 0)
+			rte_panic("Error during getting device (port %u) info:"
+				  "%s\n", port_id, strerror(-ret));
+
 		if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
 			local_port_conf.txmode.offloads |=
 						DEV_TX_OFFLOAD_MBUF_FAST_FREE;
diff --git a/examples/l3fwd/l3fwd_event_generic.c b/examples/l3fwd/l3fwd_event_generic.c
index c69c611dd..f8c98435d 100644
--- a/examples/l3fwd/l3fwd_event_generic.c
+++ b/examples/l3fwd/l3fwd_event_generic.c
@@ -101,7 +101,9 @@ l3fwd_event_port_setup_generic(void)
 		rte_panic("No space is available\n");
 
 	memset(&def_p_conf, 0, sizeof(struct rte_event_port_conf));
-	rte_event_port_default_conf_get(event_d_id, 0, &def_p_conf);
+	ret = rte_event_port_default_conf_get(event_d_id, 0, &def_p_conf);
+	if (ret < 0)
+		rte_panic("Error to get default configuration of event port\n");
 
 	if (def_p_conf.new_event_threshold < event_p_conf.new_event_threshold)
 		event_p_conf.new_event_threshold =
@@ -161,7 +163,10 @@ l3fwd_event_queue_setup_generic(uint32_t event_queue_cfg)
 	if (!evt_rsrc->evq.event_q_id)
 		rte_panic("Memory allocation failure\n");
 
-	rte_event_queue_default_conf_get(event_d_id, 0, &def_q_conf);
+	ret = rte_event_queue_default_conf_get(event_d_id, 0, &def_q_conf);
+	if (ret < 0)
+		rte_panic("Error to get default config of event queue\n");
+
 	if (def_q_conf.nb_atomic_flows < event_q_conf.nb_atomic_flows)
 		event_q_conf.nb_atomic_flows = def_q_conf.nb_atomic_flows;
 
diff --git a/examples/l3fwd/l3fwd_event_internal_port.c b/examples/l3fwd/l3fwd_event_internal_port.c
index 993e26f13..03ac581d6 100644
--- a/examples/l3fwd/l3fwd_event_internal_port.c
+++ b/examples/l3fwd/l3fwd_event_internal_port.c
@@ -99,7 +99,10 @@ l3fwd_event_port_setup_internal_port(void)
 	if (!evt_rsrc->evp.event_p_id)
 		rte_panic("Failed to allocate memory for Event Ports\n");
 
-	rte_event_port_default_conf_get(event_d_id, 0, &def_p_conf);
+	ret = rte_event_port_default_conf_get(event_d_id, 0, &def_p_conf);
+	if (ret < 0)
+		rte_panic("Error to get default configuration of event port\n");
+
 	if (def_p_conf.new_event_threshold < event_p_conf.new_event_threshold)
 		event_p_conf.new_event_threshold =
 						def_p_conf.new_event_threshold;
@@ -150,7 +153,10 @@ l3fwd_event_queue_setup_internal_port(uint32_t event_queue_cfg)
 	uint8_t event_q_id = 0;
 	int32_t ret;
 
-	rte_event_queue_default_conf_get(event_d_id, event_q_id, &def_q_conf);
+	ret = rte_event_queue_default_conf_get(event_d_id, event_q_id,
+					       &def_q_conf);
+	if (ret < 0)
+		rte_panic("Error to get default config of event queue\n");
 
 	if (def_q_conf.nb_atomic_flows < event_q_conf.nb_atomic_flows)
 		event_q_conf.nb_atomic_flows = def_q_conf.nb_atomic_flows;
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH] examples/l3fwd: fix error checking
  2020-04-17  8:25 [dpdk-dev] [PATCH] examples/l3fwd: fix error checking Sunil Kumar Kori
@ 2020-05-01 11:15 ` Pavan Nikhilesh Bhagavatula
  2020-05-01 17:43   ` Jerin Jacob
  0 siblings, 1 reply; 3+ messages in thread
From: Pavan Nikhilesh Bhagavatula @ 2020-05-01 11:15 UTC (permalink / raw)
  To: Sunil Kumar Kori, Jerin Jacob Kollanukkaran, Marko Kovacevic,
	Ori Kam, Bruce Richardson, Radu Nicolau, Akhil Goyal,
	Tomasz Kantecki, Sunil Kumar Kori
  Cc: dev

>Subject: [PATCH] examples/l3fwd: fix error checking
>
>Patch fixes coverity issues which handle return values from AP
>calling.
>
>Coverity issue: 354227, 354232, 354238, 354239, 354240
>
>Fixes: aaf58cb85b62 ("examples/l3fwd: add event port and queue
>setup")
>
>Signed-off-by: Sunil Kumar Kori <skori@marvell.com>

Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>

>---
> examples/l3fwd/l3fwd_event.c               |  6 +++++-
> examples/l3fwd/l3fwd_event_generic.c       |  9 +++++++--
> examples/l3fwd/l3fwd_event_internal_port.c | 10 ++++++++--
> 3 files changed, 20 insertions(+), 5 deletions(-)
>
>diff --git a/examples/l3fwd/l3fwd_event.c
>b/examples/l3fwd/l3fwd_event.c
>index 43c47eade..4d31593a0 100644
>--- a/examples/l3fwd/l3fwd_event.c
>+++ b/examples/l3fwd/l3fwd_event.c
>@@ -70,7 +70,11 @@ l3fwd_eth_dev_port_setup(struct rte_eth_conf
>*port_conf)
> 		printf("Creating queues: nb_rxq=%d nb_txq=1...\n",
> 		       evt_rsrc->eth_rx_queues);
>
>-		rte_eth_dev_info_get(port_id, &dev_info);
>+		ret = rte_eth_dev_info_get(port_id, &dev_info);
>+		if (ret != 0)
>+			rte_panic("Error during getting device (port %u)
>info:"
>+				  "%s\n", port_id, strerror(-ret));
>+
> 		if (dev_info.tx_offload_capa &
>DEV_TX_OFFLOAD_MBUF_FAST_FREE)
> 			local_port_conf.txmode.offloads |=
>
>	DEV_TX_OFFLOAD_MBUF_FAST_FREE;
>diff --git a/examples/l3fwd/l3fwd_event_generic.c
>b/examples/l3fwd/l3fwd_event_generic.c
>index c69c611dd..f8c98435d 100644
>--- a/examples/l3fwd/l3fwd_event_generic.c
>+++ b/examples/l3fwd/l3fwd_event_generic.c
>@@ -101,7 +101,9 @@ l3fwd_event_port_setup_generic(void)
> 		rte_panic("No space is available\n");
>
> 	memset(&def_p_conf, 0, sizeof(struct rte_event_port_conf));
>-	rte_event_port_default_conf_get(event_d_id, 0,
>&def_p_conf);
>+	ret = rte_event_port_default_conf_get(event_d_id, 0,
>&def_p_conf);
>+	if (ret < 0)
>+		rte_panic("Error to get default configuration of event
>port\n");
>
> 	if (def_p_conf.new_event_threshold <
>event_p_conf.new_event_threshold)
> 		event_p_conf.new_event_threshold =
>@@ -161,7 +163,10 @@ l3fwd_event_queue_setup_generic(uint32_t
>event_queue_cfg)
> 	if (!evt_rsrc->evq.event_q_id)
> 		rte_panic("Memory allocation failure\n");
>
>-	rte_event_queue_default_conf_get(event_d_id, 0,
>&def_q_conf);
>+	ret = rte_event_queue_default_conf_get(event_d_id, 0,
>&def_q_conf);
>+	if (ret < 0)
>+		rte_panic("Error to get default config of event
>queue\n");
>+
> 	if (def_q_conf.nb_atomic_flows <
>event_q_conf.nb_atomic_flows)
> 		event_q_conf.nb_atomic_flows =
>def_q_conf.nb_atomic_flows;
>
>diff --git a/examples/l3fwd/l3fwd_event_internal_port.c
>b/examples/l3fwd/l3fwd_event_internal_port.c
>index 993e26f13..03ac581d6 100644
>--- a/examples/l3fwd/l3fwd_event_internal_port.c
>+++ b/examples/l3fwd/l3fwd_event_internal_port.c
>@@ -99,7 +99,10 @@ l3fwd_event_port_setup_internal_port(void)
> 	if (!evt_rsrc->evp.event_p_id)
> 		rte_panic("Failed to allocate memory for Event
>Ports\n");
>
>-	rte_event_port_default_conf_get(event_d_id, 0,
>&def_p_conf);
>+	ret = rte_event_port_default_conf_get(event_d_id, 0,
>&def_p_conf);
>+	if (ret < 0)
>+		rte_panic("Error to get default configuration of event
>port\n");
>+
> 	if (def_p_conf.new_event_threshold <
>event_p_conf.new_event_threshold)
> 		event_p_conf.new_event_threshold =
>
>	def_p_conf.new_event_threshold;
>@@ -150,7 +153,10 @@
>l3fwd_event_queue_setup_internal_port(uint32_t event_queue_cfg)
> 	uint8_t event_q_id = 0;
> 	int32_t ret;
>
>-	rte_event_queue_default_conf_get(event_d_id, event_q_id,
>&def_q_conf);
>+	ret = rte_event_queue_default_conf_get(event_d_id,
>event_q_id,
>+					       &def_q_conf);
>+	if (ret < 0)
>+		rte_panic("Error to get default config of event
>queue\n");
>
> 	if (def_q_conf.nb_atomic_flows <
>event_q_conf.nb_atomic_flows)
> 		event_q_conf.nb_atomic_flows =
>def_q_conf.nb_atomic_flows;
>--
>2.17.1


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

* Re: [dpdk-dev] [PATCH] examples/l3fwd: fix error checking
  2020-05-01 11:15 ` Pavan Nikhilesh Bhagavatula
@ 2020-05-01 17:43   ` Jerin Jacob
  0 siblings, 0 replies; 3+ messages in thread
From: Jerin Jacob @ 2020-05-01 17:43 UTC (permalink / raw)
  To: Pavan Nikhilesh Bhagavatula
  Cc: Sunil Kumar Kori, Jerin Jacob Kollanukkaran, Marko Kovacevic,
	Ori Kam, Bruce Richardson, Radu Nicolau, Akhil Goyal,
	Tomasz Kantecki, dev

On Fri, May 1, 2020 at 4:45 PM Pavan Nikhilesh Bhagavatula
<pbhagavatula@marvell.com> wrote:
>
> >Subject: [PATCH] examples/l3fwd: fix error checking
> >
> >Patch fixes coverity issues which handle return values from AP
> >calling.
> >
> >Coverity issue: 354227, 354232, 354238, 354239, 354240
> >
> >Fixes: aaf58cb85b62 ("examples/l3fwd: add event port and queue
> >setup")
> >
> >Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
>
> Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>

Cc: stable@dpdk.org

Applied to dpdk-next-eventdev/master. Thanks.

>
> >---
> > examples/l3fwd/l3fwd_event.c               |  6 +++++-
> > examples/l3fwd/l3fwd_event_generic.c       |  9 +++++++--
> > examples/l3fwd/l3fwd_event_internal_port.c | 10 ++++++++--
> > 3 files changed, 20 insertions(+), 5 deletions(-)
> >
> >diff --git a/examples/l3fwd/l3fwd_event.c
> >b/examples/l3fwd/l3fwd_event.c
> >index 43c47eade..4d31593a0 100644
> >--- a/examples/l3fwd/l3fwd_event.c
> >+++ b/examples/l3fwd/l3fwd_event.c
> >@@ -70,7 +70,11 @@ l3fwd_eth_dev_port_setup(struct rte_eth_conf
> >*port_conf)
> >               printf("Creating queues: nb_rxq=%d nb_txq=1...\n",
> >                      evt_rsrc->eth_rx_queues);
> >
> >-              rte_eth_dev_info_get(port_id, &dev_info);
> >+              ret = rte_eth_dev_info_get(port_id, &dev_info);
> >+              if (ret != 0)
> >+                      rte_panic("Error during getting device (port %u)
> >info:"
> >+                                "%s\n", port_id, strerror(-ret));
> >+
> >               if (dev_info.tx_offload_capa &
> >DEV_TX_OFFLOAD_MBUF_FAST_FREE)
> >                       local_port_conf.txmode.offloads |=
> >
> >       DEV_TX_OFFLOAD_MBUF_FAST_FREE;
> >diff --git a/examples/l3fwd/l3fwd_event_generic.c
> >b/examples/l3fwd/l3fwd_event_generic.c
> >index c69c611dd..f8c98435d 100644
> >--- a/examples/l3fwd/l3fwd_event_generic.c
> >+++ b/examples/l3fwd/l3fwd_event_generic.c
> >@@ -101,7 +101,9 @@ l3fwd_event_port_setup_generic(void)
> >               rte_panic("No space is available\n");
> >
> >       memset(&def_p_conf, 0, sizeof(struct rte_event_port_conf));
> >-      rte_event_port_default_conf_get(event_d_id, 0,
> >&def_p_conf);
> >+      ret = rte_event_port_default_conf_get(event_d_id, 0,
> >&def_p_conf);
> >+      if (ret < 0)
> >+              rte_panic("Error to get default configuration of event
> >port\n");
> >
> >       if (def_p_conf.new_event_threshold <
> >event_p_conf.new_event_threshold)
> >               event_p_conf.new_event_threshold =
> >@@ -161,7 +163,10 @@ l3fwd_event_queue_setup_generic(uint32_t
> >event_queue_cfg)
> >       if (!evt_rsrc->evq.event_q_id)
> >               rte_panic("Memory allocation failure\n");
> >
> >-      rte_event_queue_default_conf_get(event_d_id, 0,
> >&def_q_conf);
> >+      ret = rte_event_queue_default_conf_get(event_d_id, 0,
> >&def_q_conf);
> >+      if (ret < 0)
> >+              rte_panic("Error to get default config of event
> >queue\n");
> >+
> >       if (def_q_conf.nb_atomic_flows <
> >event_q_conf.nb_atomic_flows)
> >               event_q_conf.nb_atomic_flows =
> >def_q_conf.nb_atomic_flows;
> >
> >diff --git a/examples/l3fwd/l3fwd_event_internal_port.c
> >b/examples/l3fwd/l3fwd_event_internal_port.c
> >index 993e26f13..03ac581d6 100644
> >--- a/examples/l3fwd/l3fwd_event_internal_port.c
> >+++ b/examples/l3fwd/l3fwd_event_internal_port.c
> >@@ -99,7 +99,10 @@ l3fwd_event_port_setup_internal_port(void)
> >       if (!evt_rsrc->evp.event_p_id)
> >               rte_panic("Failed to allocate memory for Event
> >Ports\n");
> >
> >-      rte_event_port_default_conf_get(event_d_id, 0,
> >&def_p_conf);
> >+      ret = rte_event_port_default_conf_get(event_d_id, 0,
> >&def_p_conf);
> >+      if (ret < 0)
> >+              rte_panic("Error to get default configuration of event
> >port\n");
> >+
> >       if (def_p_conf.new_event_threshold <
> >event_p_conf.new_event_threshold)
> >               event_p_conf.new_event_threshold =
> >
> >       def_p_conf.new_event_threshold;
> >@@ -150,7 +153,10 @@
> >l3fwd_event_queue_setup_internal_port(uint32_t event_queue_cfg)
> >       uint8_t event_q_id = 0;
> >       int32_t ret;
> >
> >-      rte_event_queue_default_conf_get(event_d_id, event_q_id,
> >&def_q_conf);
> >+      ret = rte_event_queue_default_conf_get(event_d_id,
> >event_q_id,
> >+                                             &def_q_conf);
> >+      if (ret < 0)
> >+              rte_panic("Error to get default config of event
> >queue\n");
> >
> >       if (def_q_conf.nb_atomic_flows <
> >event_q_conf.nb_atomic_flows)
> >               event_q_conf.nb_atomic_flows =
> >def_q_conf.nb_atomic_flows;
> >--
> >2.17.1
>

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

end of thread, other threads:[~2020-05-01 17:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-17  8:25 [dpdk-dev] [PATCH] examples/l3fwd: fix error checking Sunil Kumar Kori
2020-05-01 11:15 ` Pavan Nikhilesh Bhagavatula
2020-05-01 17:43   ` Jerin Jacob

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git