DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] examples/ipsec-secgw: remove duplicated if check
@ 2020-04-17 15:41 Ankur Dwivedi
  2020-04-17 15:41 ` [dpdk-dev] [PATCH 2/2] examples/ipsec-secgw: check return value of function Ankur Dwivedi
  2020-04-17 16:03 ` [dpdk-dev] [PATCH 1/2] examples/ipsec-secgw: remove duplicated if check Anoob Joseph
  0 siblings, 2 replies; 5+ messages in thread
From: Ankur Dwivedi @ 2020-04-17 15:41 UTC (permalink / raw)
  To: dev; +Cc: lbartosik, anoobj, Ankur Dwivedi

The two if check does the same task, so removing one.

Coverity Issue: 355669
Fixes: 9ad50c29d01d ("examples/ipsec-secgw: add app mode worker")

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
---
 examples/ipsec-secgw/ipsec_worker.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/examples/ipsec-secgw/ipsec_worker.c b/examples/ipsec-secgw/ipsec_worker.c
index 5fde667..b6c851f 100644
--- a/examples/ipsec-secgw/ipsec_worker.c
+++ b/examples/ipsec-secgw/ipsec_worker.c
@@ -112,12 +112,7 @@
 	rte_acl_classify((struct rte_acl_ctx *)sp, &nlp, &res, 1,
 			DEFAULT_MAX_CATEGORIES);
 
-	if (unlikely(res == 0)) {
-		/* No match */
-		return 0;
-	}
-
-	if (res == DISCARD)
+	if (unlikely(res == DISCARD))
 		return 0;
 	else if (res == BYPASS) {
 		*sa_idx = -1;
-- 
1.9.3


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

* [dpdk-dev] [PATCH 2/2] examples/ipsec-secgw: check return value of function
  2020-04-17 15:41 [dpdk-dev] [PATCH 1/2] examples/ipsec-secgw: remove duplicated if check Ankur Dwivedi
@ 2020-04-17 15:41 ` Ankur Dwivedi
  2020-04-17 16:05   ` Anoob Joseph
  2020-04-17 16:03 ` [dpdk-dev] [PATCH 1/2] examples/ipsec-secgw: remove duplicated if check Anoob Joseph
  1 sibling, 1 reply; 5+ messages in thread
From: Ankur Dwivedi @ 2020-04-17 15:41 UTC (permalink / raw)
  To: dev; +Cc: lbartosik, anoobj, Ankur Dwivedi

The return values of functions are checked before proceeding further.

Coverity Issues: 355670, 355671, 355672, 355673
Fixes: ec3cc53f5a66 ("examples/ipsec-secgw: support internal ports for events"

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
---
 examples/ipsec-secgw/event_helper.c | 30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/examples/ipsec-secgw/event_helper.c b/examples/ipsec-secgw/event_helper.c
index 076f1f2..865dc91 100644
--- a/examples/ipsec-secgw/event_helper.c
+++ b/examples/ipsec-secgw/event_helper.c
@@ -100,12 +100,15 @@
 eh_dev_has_rx_internal_port(uint8_t eventdev_id)
 {
 	bool flag = true;
-	int j;
+	int j, ret;
 
 	RTE_ETH_FOREACH_DEV(j) {
 		uint32_t caps = 0;
 
-		rte_event_eth_rx_adapter_caps_get(eventdev_id, j, &caps);
+		ret = rte_event_eth_rx_adapter_caps_get(eventdev_id, j, &caps);
+		if (ret < 0)
+			return false;
+
 		if (!(caps & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT))
 			flag = false;
 	}
@@ -116,12 +119,15 @@
 eh_dev_has_tx_internal_port(uint8_t eventdev_id)
 {
 	bool flag = true;
-	int j;
+	int j, ret;
 
 	RTE_ETH_FOREACH_DEV(j) {
 		uint32_t caps = 0;
 
-		rte_event_eth_tx_adapter_caps_get(eventdev_id, j, &caps);
+		ret = rte_event_eth_tx_adapter_caps_get(eventdev_id, j, &caps);
+		if (ret < 0)
+			return false;
+
 		if (!(caps & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT))
 			flag = false;
 	}
@@ -323,6 +329,7 @@
 	int nb_eth_dev;
 	int adapter_id;
 	int conn_id;
+	int ret;
 	int i;
 
 	/* Create one adapter with eth queues mapped to event queue(s) */
@@ -385,7 +392,12 @@
 		conn->ethdev_rx_qid = -1;
 
 		/* Get Rx adapter capabilities */
-		rte_event_eth_rx_adapter_caps_get(eventdev_id, i, &caps);
+		ret = rte_event_eth_rx_adapter_caps_get(eventdev_id, i, &caps);
+		if (ret < 0) {
+			EH_LOG_ERR("Failed to get event device %d eth rx adapter"
+				   " capabilities for port %d", eventdev_id, i);
+			return ret;
+		}
 		if (!(caps & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT))
 			rx_internal_port = false;
 
@@ -420,6 +432,7 @@
 	int adapter_id;
 	int nb_eth_dev;
 	int conn_id;
+	int ret;
 	int i;
 
 	/*
@@ -479,7 +492,12 @@
 		conn->ethdev_tx_qid = -1;
 
 		/* Get Tx adapter capabilities */
-		rte_event_eth_tx_adapter_caps_get(eventdev_id, i, &caps);
+		ret = rte_event_eth_tx_adapter_caps_get(eventdev_id, i, &caps);
+		if (ret < 0) {
+			EH_LOG_ERR("Failed to get event device %d eth tx adapter"
+				   " capabilities for port %d", eventdev_id, i);
+			return ret;
+		}
 		if (!(caps & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT))
 			tx_internal_port = false;
 
-- 
1.9.3


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

* Re: [dpdk-dev] [PATCH 1/2] examples/ipsec-secgw: remove duplicated if check
  2020-04-17 15:41 [dpdk-dev] [PATCH 1/2] examples/ipsec-secgw: remove duplicated if check Ankur Dwivedi
  2020-04-17 15:41 ` [dpdk-dev] [PATCH 2/2] examples/ipsec-secgw: check return value of function Ankur Dwivedi
@ 2020-04-17 16:03 ` Anoob Joseph
  2020-04-17 21:16   ` Akhil Goyal
  1 sibling, 1 reply; 5+ messages in thread
From: Anoob Joseph @ 2020-04-17 16:03 UTC (permalink / raw)
  To: Ankur Dwivedi, dev; +Cc: Lukas Bartosik [C], Ankur Dwivedi, akhil.goyal


> The two if check does the same task, so removing one.
> 
> Coverity Issue: 355669
> Fixes: 9ad50c29d01d ("examples/ipsec-secgw: add app mode worker")
> 
> Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
> ---
>  examples/ipsec-secgw/ipsec_worker.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 

Acked-by: Anoob Joseph <anoobj@marvell.com>



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

* Re: [dpdk-dev] [PATCH 2/2] examples/ipsec-secgw: check return value of function
  2020-04-17 15:41 ` [dpdk-dev] [PATCH 2/2] examples/ipsec-secgw: check return value of function Ankur Dwivedi
@ 2020-04-17 16:05   ` Anoob Joseph
  0 siblings, 0 replies; 5+ messages in thread
From: Anoob Joseph @ 2020-04-17 16:05 UTC (permalink / raw)
  To: Ankur Dwivedi, dev; +Cc: Lukas Bartosik [C], Ankur Dwivedi, akhil.goyal

> 
> The return values of functions are checked before proceeding further.
> 
> Coverity Issues: 355670, 355671, 355672, 355673
> Fixes: ec3cc53f5a66 ("examples/ipsec-secgw: support internal ports for events"
> 
> Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>


Acked-by: Anoob Joseph <anoobj@marvell.com>



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

* Re: [dpdk-dev] [PATCH 1/2] examples/ipsec-secgw: remove duplicated if check
  2020-04-17 16:03 ` [dpdk-dev] [PATCH 1/2] examples/ipsec-secgw: remove duplicated if check Anoob Joseph
@ 2020-04-17 21:16   ` Akhil Goyal
  0 siblings, 0 replies; 5+ messages in thread
From: Akhil Goyal @ 2020-04-17 21:16 UTC (permalink / raw)
  To: Anoob Joseph, Ankur Dwivedi, dev; +Cc: Lukas Bartosik [C], Ankur Dwivedi

> 
> > The two if check does the same task, so removing one.
> >
> > Coverity Issue: 355669
> > Fixes: 9ad50c29d01d ("examples/ipsec-secgw: add app mode worker")
> >
> > Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
> > ---
> >  examples/ipsec-secgw/ipsec_worker.c | 7 +------
> >  1 file changed, 1 insertion(+), 6 deletions(-)
> >
> 
> Acked-by: Anoob Joseph <anoobj@marvell.com>
> 
Series
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>

Applied to dpdk-next-crypto

Thanks.

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

end of thread, other threads:[~2020-04-17 21:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-17 15:41 [dpdk-dev] [PATCH 1/2] examples/ipsec-secgw: remove duplicated if check Ankur Dwivedi
2020-04-17 15:41 ` [dpdk-dev] [PATCH 2/2] examples/ipsec-secgw: check return value of function Ankur Dwivedi
2020-04-17 16:05   ` Anoob Joseph
2020-04-17 16:03 ` [dpdk-dev] [PATCH 1/2] examples/ipsec-secgw: remove duplicated if check Anoob Joseph
2020-04-17 21:16   ` Akhil Goyal

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