examples/tep_term: fix return value check
PATCH 1/1 examples/tep_term: fix return value check
Added return value check for 'rte_eth_dev_info_get()'.
Coverity issue: 349922
--- examples/tep_termination/vxlan_setup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
examples/tep_termination/vxlan_setup.c +3 -1
@@ -195,7 +195,9 @@ vxlan_port_init(uint16_t port, struct rte_mempool *mbuf_pool)if (tso_segsz !=0 ) {struct rte_eth_dev_info dev_info; -rte_eth_dev_info_get (port, &dev_info); + retval =rte_eth_dev_info_get (port, &dev_info); +if (retval !=0 ) +return -retval;if ((dev_info.tx_offload_capa &DEV_TX_OFFLOAD_TCP_TSO ) ==0 )RTE_LOG (WARNING ,PORT ,"hardware TSO offload is not supported\n" );
Signature · 1 line
2.17.1
Quoted 16 lines · Xiaoyun Li
Added return value check for '
rte_eth_dev_info_get()'.Coverity issue: 349922
Fixes 2bb43bd4350a ("examples/tep_term: add TSO offload configuration")Signed-off-by Xiaoyun Li <[email protected]>---
examples/tep_termination/vxlan_setup.c| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)examples/tep_termination/vxlan_setup.c +0
-0
examples/tep_termination/vxlan_setup.c vxlan_port_init(uint16_t port, struct rte_mempool *mbuf_pool) · line 200
Quoted 7 lines
examples/tep_termination/vxlan_setup.c +3
-1@@ -195,7 +195,9 @@ vxlan_port_init(uint16_t port, struct rte_mempool *mbuf_pool)if (tso_segsz !=0 ) {struct rte_eth_dev_info dev_info; -rte_eth_dev_info_get (port, &dev_info); + retval =rte_eth_dev_info_get (port, &dev_info); +if (retval !=0 ) +return -retval;
why return -retval not retval?
Thanks,
Xiaolong
Quoted 6 lines
examples/tep_termination/vxlan_setup.c +0
-0if ((dev_info.tx_offload_capa &DEV_TX_OFFLOAD_TCP_TSO ) ==0 )RTE_LOG (WARNING ,PORT ,"hardware TSO offload is not supported\n" );Signature · 1 line
2.17.1
Hi
Quoted 28 lines
-----Original Message-----
From: Ye, Xiaolong
Sent: Monday, February 10, 2020 11:37
To: Li, Xiaoyun <[email protected]>
Cc: Kovacevic, Marko <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH] examples/tep_term: fix return value checkQuoted 6 lines · Xiaoyun Li
Added return value check for '
rte_eth_dev_info_get()'.Coverity issue: 349922
Fixes 2bb43bd4350a ("examples/tep_term: add TSO offload configuration")Review
Quoted 6 lines
Signed-off-by Xiaoyun Li <[email protected]>---
examples/tep_termination/vxlan_setup.c| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/examples/tep_termination/vxlan_setup.cexamples/tep_termination/vxlan_setup.c vxlan_port_init(uint16_t port, struct rte_mempool
Quoted 4 lines
index
eca119a72..bd469f5f4100644examples/tep_termination/vxlan_setup.c +0
-0@@ -195,7 +195,9 @@ vxlan_port_init(uint16_t port, struct rte_mempool
*mbuf_pool)Quoted 1 line
Quoted 8 lines
examples/tep_termination/vxlan_setup.c vxlan_port_init(uint16_t port, struct rte_mempool *mbuf_pool) · line 200
Quoted 6 lines
if (tso_segsz != 0) { struct rte_eth_dev_info dev_info;examples/tep_termination/vxlan_setup.c +3
-1-rte_eth_dev_info_get (port, &dev_info); + retval =rte_eth_dev_info_get (port, &dev_info); +if (retval !=0 ) +return -retval;why return -retval not retval?
The description of return value of rte_eth_dev_info_get() is like the following:
@return
* - (0) if successful. * - (-ENOTSUP) if support for dev_infos_get() does not exist for the device. * - (-ENODEV) if *port_id* invalid.
So -retval is the real err code.
But the check of this function (vxlan_port_init) is (overlay_options.port_configure(portid, mbuf_pool) != 0) So return -retval or retval are both OK.
Quoted 11 lines
Thanks,
XiaolongQuoted 1 line
if ((dev_info.tx_offload_capa &
DEV_TX_OFFLOAD_TCP_TSO)== 0)
Quoted 5 lines
RTE_LOG(WARNING, PORT, "hardware TSO offload is not supported\n");--
2.17.1
Quoted 39 lines · Xiaoyun
Hi
Quoted 28 lines
-----Original Message-----
From: Ye, Xiaolong
Sent: Monday, February 10, 2020 11:37
To: Li, Xiaoyun <[email protected]>
Cc: Kovacevic, Marko <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH] examples/tep_term: fix return value checkQuoted 6 lines · Xiaoyun Li
Added return value check for '
rte_eth_dev_info_get()'.Coverity issue: 349922
Fixes 2bb43bd4350a ("examples/tep_term: add TSO offload configuration")Review
Quoted 6 lines
Signed-off-by Xiaoyun Li <[email protected]>---
examples/tep_termination/vxlan_setup.c| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/examples/tep_termination/vxlan_setup.cexamples/tep_termination/vxlan_setup.c vxlan_port_init(uint16_t port, struct rte_mempool
Quoted 4 lines
index
eca119a72..bd469f5f4100644examples/tep_termination/vxlan_setup.c +0
-0@@ -195,7 +195,9 @@ vxlan_port_init(uint16_t port, struct rte_mempool
*mbuf_pool)Quoted 1 line
Quoted 8 lines
examples/tep_termination/vxlan_setup.c vxlan_port_init(uint16_t port, struct rte_mempool *mbuf_pool) · line 200
Quoted 6 lines
if (tso_segsz != 0) { struct rte_eth_dev_info dev_info;examples/tep_termination/vxlan_setup.c +3
-1-rte_eth_dev_info_get (port, &dev_info); + retval =rte_eth_dev_info_get (port, &dev_info); +if (retval !=0 ) +return -retval;why return -retval not retval?
Quoted 8 lines
The description of return value of
rte_eth_dev_info_get()is like the following:
@return* - (0) if successful. * - (-ENOTSUP) if support for dev_infos_get() does not exist for the device. * - (-ENODEV) if *port_id* invalid.So -retval is the real err code.
But the check of this function (vxlan_port_init) is (overlay_options.port_configure(portid, mbuf_pool)!= 0) So return -retval or retval are both OK.
Better to align with other return val checks in this function to return retval.
Thanks,
Xiaolong
Quoted 11 lines
Quoted 11 lines
Thanks,
XiaolongQuoted 1 line
if ((dev_info.tx_offload_capa &
DEV_TX_OFFLOAD_TCP_TSO)== 0)
Quoted 5 lines
RTE_LOG(WARNING, PORT, "hardware TSO offload is not supported\n");--
2.17.1
PATCH v2 1/1 examples/tep_term: fix return value check
In reply to Xiaoyun LiAdded return value check for 'rte_eth_dev_info_get()'.
Coverity issue: 349922
--- examples/tep_termination/vxlan_setup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
examples/tep_termination/vxlan_setup.c +3 -1
@@ -195,7 +195,9 @@ vxlan_port_init(uint16_t port, struct rte_mempool *mbuf_pool)if (tso_segsz !=0 ) {struct rte_eth_dev_info dev_info; -rte_eth_dev_info_get (port, &dev_info); + retval =rte_eth_dev_info_get (port, &dev_info); +if (retval !=0 ) +return retval;if ((dev_info.tx_offload_capa &DEV_TX_OFFLOAD_TCP_TSO ) ==0 )RTE_LOG (WARNING ,PORT ,"hardware TSO offload is not supported\n" );
Signature · 1 line
2.17.1
Quoted 29 lines · Xiaoyun Li
Added return value check for '
rte_eth_dev_info_get()'.Coverity issue: 349922
Fixes 2bb43bd4350a ("examples/tep_term: add TSO offload configuration")Signed-off-by Xiaoyun Li <[email protected]>---
examples/tep_termination/vxlan_setup.c| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)examples/tep_termination/vxlan_setup.c +3
-1@@ -195,7 +195,9 @@ vxlan_port_init(uint16_t port, struct rte_mempool *mbuf_pool)if (tso_segsz !=0 ) {struct rte_eth_dev_info dev_info; -rte_eth_dev_info_get (port, &dev_info); + retval =rte_eth_dev_info_get (port, &dev_info); +if (retval !=0 ) +return retval;if ((dev_info.tx_offload_capa &DEV_TX_OFFLOAD_TCP_TSO ) ==0 )RTE_LOG (WARNING ,PORT ,"hardware TSO offload is not supported\n" );Signature · 1 line
2.17.1
Quoted 5 lines · Xiaoyun Li
Added return value check for '
rte_eth_dev_info_get()'.Coverity issue: 349922
Fixes 2bb43bd4350a ("examples/tep_term: add TSO offload configuration")
rte_eth_dev_info_get() prototype changed in 19.11. Before this, it was a void.
So this Fixes: line is wrong.
Quoted 12 lines
Signed-off-by Xiaoyun Li <[email protected]>--- examples/tep_termination/vxlan_setup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)examples/tep_termination/vxlan_setup.c +0
-0
examples/tep_termination/vxlan_setup.c vxlan_port_init(uint16_t port, struct rte_mempool *mbuf_pool) · line 203
Quoted 10 lines
examples/tep_termination/vxlan_setup.c +3
-1@@ -195,7 +195,9 @@ vxlan_port_init(uint16_t port, struct rte_mempool *mbuf_pool)if (tso_segsz !=0 ) {struct rte_eth_dev_info dev_info; -rte_eth_dev_info_get (port, &dev_info); + retval =rte_eth_dev_info_get (port, &dev_info); +if (retval !=0 ) +return retval;if ((dev_info.tx_offload_capa &DEV_TX_OFFLOAD_TCP_TSO ) ==0 )RTE_LOG (WARNING ,PORT ,"hardware TSO offload is not supported\n" );
I had a look at this function, dev_info is populated for port earlier in the function, why do we need to check it again?
https://git.dpdk.org/dpdk/tree/examples/tep_termination/vxlan_setup.c?h=v20.02-rc2#n119
Signature · 1 line
David Marchand
Hi
Quoted 37 lines
-----Original Message-----
From: David Marchand [mailto:[email protected]]
Sent: Thursday, February 13, 2020 22:57
To: Li, Xiaoyun <[email protected]>
Cc: Ye, Xiaolong <[email protected]>; Kovacevic, Marko <[email protected]>; dev <[email protected]>; dpdk stable <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] examples/tep_term: fix return value checkQuoted 6 lines · Xiaoyun Li
Added return value check for '
rte_eth_dev_info_get()'.Coverity issue: 349922
Fixes 2bb43bd4350a ("examples/tep_term: add TSO offloadconfiguration")
rte_eth_dev_info_get()prototype changed in 19.11. Before this, it was a void.
So this Fixes: line is wrong.Quoted 15 lines
Signed-off-by Xiaoyun Li <[email protected]>--- examples/tep_termination/vxlan_setup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)examples/tep_termination/vxlan_setup.c +0
-0@@ -195,7 +195,9 @@ vxlan_port_init(uint16_t port, struct rte_mempool *mbuf_pool)
Quoted 15 lines
Quoted 10 lines
examples/tep_termination/vxlan_setup.c +3
-1if (tso_segsz !=0 ) {struct rte_eth_dev_info dev_info; -rte_eth_dev_info_get (port, &dev_info); + retval =rte_eth_dev_info_get (port, &dev_info); +if (retval !=0 ) +return retval;if ((dev_info.tx_offload_capa &DEV_TX_OFFLOAD_TCP_TSO ) ==0 ) RTE_LOG(WARNING, PORT,"hardware TSO offload is not
supported\n");I had a look at this function,
dev_infois populated for port earlier in the function, why do we need to check it again?
https://git.dpdk.org/dpdk/tree/examples/tep_termination/vxlan_setup.c?h=v20
.02-rc2#n119
Yes. I saw it too. And since it only uses tx_offload_capa which is fixed nic capability, I think can use dev_info directly without calling rte_eth_dev_info_get again. Will send v3 as that. Then the fix line should be the same as this patch too.
Thanks.
Quoted 4 lines
--
David Marchand
PATCH v3 1/1 examples/tep_term: remove redundant info get
In reply to Xiaoyun LiRemoved redundant function call of 'rte_eth_dev_info_get()' since it has already been called earlier.
Coverity issue: 349922
--- examples/tep_termination/vxlan_setup.c | 2 -- 1 file changed, 2 deletions(-)
examples/tep_termination/vxlan_setup.c +0 -2
@@ -194,8 +194,6 @@ vxlan_port_init(uint16_t port, struct rte_mempool *mbuf_pool) ports_eth_addr[port].addr_bytes[5]);if (tso_segsz !=0 ) { -struct rte_eth_dev_info dev_info; -rte_eth_dev_info_get (port, &dev_info);if ((dev_info.tx_offload_capa &DEV_TX_OFFLOAD_TCP_TSO ) ==0 )RTE_LOG (WARNING ,PORT ,"hardware TSO offload is not supported\n" );
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH v3] examples/tep_term: remove redundant info get
Quoted 9 lines · Xiaoyun Li
Removed redundant function call of '
rte_eth_dev_info_get()' since it has already been called earlier.Coverity issue: 349922
Fixes 2bb43bd4350a ("examples/tep_term: add TSO offload configuration")Signed-off-by Xiaoyun Li <[email protected]>
LGTM.
Xiaolong, you had reviewed it before, can you have a look? Thanks.
Signature · 1 line
David Marchand
Ye Xiaolong
Reviewed-byRe: [dpdk-dev] [PATCH v3] examples/tep_term: remove redundant info get
Quoted 9 lines · David Marchand
Quoted 8 lines · Xiaoyun Li
Removed redundant function call of '
rte_eth_dev_info_get()' since it has already been called earlier.Coverity issue: 349922
Fixes 2bb43bd4350a ("examples/tep_term: add TSO offload configuration")
Quoted 9 lines
Quoted 1 line
Signed-off-by Xiaoyun Li <[email protected]>LGTM.
Xiaolong, you had reviewed it before, can you have a look? Thanks.Signature · 1 line
David Marchand
LGTM.
Re: [dpdk-dev] [PATCH v3] examples/tep_term: remove redundant info get
In reply to Xiaoyun LiQuoted 9 lines · Xiaoyun Li
Removed redundant function call of '
rte_eth_dev_info_get()' since it has already been called earlier.Coverity issue: 349922
Fixes 2bb43bd4350a ("examples/tep_term: add TSO offload configuration")Signed-off-by Xiaoyun Li <[email protected]>
Little comment, this patch solves a coverity issue.
Upon inspection of this example code, I can see no check on device capability when sending packets.
So I suppose it is broken when user asks for TSO, but the devices do not support TSO.
Can you investigate and fix this in the next release?
Applied, thanks.
--
David Marchand