DPDK patches and discussions
 help / color / Atom feed
* [dpdk-dev] [PATCH] examples/tep_term: fix return value check
@ 2020-02-10  3:07 Xiaoyun Li
  2020-02-10  3:36 ` Ye Xiaolong
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Xiaoyun Li @ 2020-02-10  3:07 UTC (permalink / raw)
  To: xiaolong.ye, marko.kovacevic; +Cc: dev, Xiaoyun Li, stable

Added return value check for 'rte_eth_dev_info_get()'.

Coverity issue: 349922
Fixes: 2bb43bd4350a ("examples/tep_term: add TSO offload configuration")
Cc: stable@dpdk.org

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
---
 examples/tep_termination/vxlan_setup.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c
index eca119a72..bd469f5f4 100644
--- a/examples/tep_termination/vxlan_setup.c
+++ b/examples/tep_termination/vxlan_setup.c
@@ -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");
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH] examples/tep_term: fix return value check
  2020-02-10  3:07 [dpdk-dev] [PATCH] examples/tep_term: fix return value check Xiaoyun Li
@ 2020-02-10  3:36 ` Ye Xiaolong
  2020-02-10  5:04   ` Li, Xiaoyun
  2020-02-10  7:04 ` [dpdk-dev] [PATCH v2] " Xiaoyun Li
  2020-02-17  1:41 ` [dpdk-dev] [PATCH v3] examples/tep_term: remove redundant info get Xiaoyun Li
  2 siblings, 1 reply; 9+ messages in thread
From: Ye Xiaolong @ 2020-02-10  3:36 UTC (permalink / raw)
  To: Xiaoyun Li; +Cc: marko.kovacevic, dev, stable

On 02/10, Xiaoyun Li wrote:
>Added return value check for 'rte_eth_dev_info_get()'.
>
>Coverity issue: 349922
>Fixes: 2bb43bd4350a ("examples/tep_term: add TSO offload configuration")
>Cc: stable@dpdk.org
>
>Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
>---
> examples/tep_termination/vxlan_setup.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
>diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c
>index eca119a72..bd469f5f4 100644
>--- a/examples/tep_termination/vxlan_setup.c
>+++ b/examples/tep_termination/vxlan_setup.c
>@@ -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

> 		if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO) == 0)
> 			RTE_LOG(WARNING, PORT,
> 				"hardware TSO offload is not supported\n");
>-- 
>2.17.1
>

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

* Re: [dpdk-dev] [PATCH] examples/tep_term: fix return value check
  2020-02-10  3:36 ` Ye Xiaolong
@ 2020-02-10  5:04   ` Li, Xiaoyun
  2020-02-10  6:51     ` Ye Xiaolong
  0 siblings, 1 reply; 9+ messages in thread
From: Li, Xiaoyun @ 2020-02-10  5:04 UTC (permalink / raw)
  To: Ye, Xiaolong; +Cc: Kovacevic, Marko, dev, stable

Hi

> -----Original Message-----
> From: Ye, Xiaolong
> Sent: Monday, February 10, 2020 11:37
> To: Li, Xiaoyun <xiaoyun.li@intel.com>
> Cc: Kovacevic, Marko <marko.kovacevic@intel.com>; dev@dpdk.org;
> stable@dpdk.org
> Subject: Re: [PATCH] examples/tep_term: fix return value check
> 
> On 02/10, Xiaoyun Li wrote:
> >Added return value check for 'rte_eth_dev_info_get()'.
> >
> >Coverity issue: 349922
> >Fixes: 2bb43bd4350a ("examples/tep_term: add TSO offload configuration")
> >Cc: stable@dpdk.org
> >
> >Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
> >---
> > examples/tep_termination/vxlan_setup.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> >diff --git a/examples/tep_termination/vxlan_setup.c
> b/examples/tep_termination/vxlan_setup.c
> >index eca119a72..bd469f5f4 100644
> >--- a/examples/tep_termination/vxlan_setup.c
> >+++ b/examples/tep_termination/vxlan_setup.c
> >@@ -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?

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.
> 
> Thanks,
> Xiaolong
> 
> > 		if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO)
> == 0)
> > 			RTE_LOG(WARNING, PORT,
> > 				"hardware TSO offload is not supported\n");
> >--
> >2.17.1
> >

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

* Re: [dpdk-dev] [PATCH] examples/tep_term: fix return value check
  2020-02-10  5:04   ` Li, Xiaoyun
@ 2020-02-10  6:51     ` Ye Xiaolong
  0 siblings, 0 replies; 9+ messages in thread
From: Ye Xiaolong @ 2020-02-10  6:51 UTC (permalink / raw)
  To: Li, Xiaoyun; +Cc: Kovacevic, Marko, dev, stable

On 02/10, Li, Xiaoyun wrote:
>Hi
>
>> -----Original Message-----
>> From: Ye, Xiaolong
>> Sent: Monday, February 10, 2020 11:37
>> To: Li, Xiaoyun <xiaoyun.li@intel.com>
>> Cc: Kovacevic, Marko <marko.kovacevic@intel.com>; dev@dpdk.org;
>> stable@dpdk.org
>> Subject: Re: [PATCH] examples/tep_term: fix return value check
>> 
>> On 02/10, Xiaoyun Li wrote:
>> >Added return value check for 'rte_eth_dev_info_get()'.
>> >
>> >Coverity issue: 349922
>> >Fixes: 2bb43bd4350a ("examples/tep_term: add TSO offload configuration")
>> >Cc: stable@dpdk.org
>> >
>> >Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
>> >---
>> > examples/tep_termination/vxlan_setup.c | 4 +++-
>> > 1 file changed, 3 insertions(+), 1 deletion(-)
>> >
>> >diff --git a/examples/tep_termination/vxlan_setup.c
>> b/examples/tep_termination/vxlan_setup.c
>> >index eca119a72..bd469f5f4 100644
>> >--- a/examples/tep_termination/vxlan_setup.c
>> >+++ b/examples/tep_termination/vxlan_setup.c
>> >@@ -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?
>
>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

>> 
>> Thanks,
>> Xiaolong
>> 
>> > 		if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO)
>> == 0)
>> > 			RTE_LOG(WARNING, PORT,
>> > 				"hardware TSO offload is not supported\n");
>> >--
>> >2.17.1
>> >

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

* Re: [dpdk-dev] [PATCH v2] examples/tep_term: fix return value check
  2020-02-10  7:04 ` [dpdk-dev] [PATCH v2] " Xiaoyun Li
@ 2020-02-10  7:04   ` Ye Xiaolong
  2020-02-13 14:57   ` David Marchand
  1 sibling, 0 replies; 9+ messages in thread
From: Ye Xiaolong @ 2020-02-10  7:04 UTC (permalink / raw)
  To: Xiaoyun Li; +Cc: marko.kovacevic, dev, stable

On 02/10, Xiaoyun Li wrote:
>Added return value check for 'rte_eth_dev_info_get()'.
>
>Coverity issue: 349922
>Fixes: 2bb43bd4350a ("examples/tep_term: add TSO offload configuration")
>Cc: stable@dpdk.org
>
>Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
>---
> examples/tep_termination/vxlan_setup.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
>diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c
>index eca119a72..f8385b690 100644
>--- a/examples/tep_termination/vxlan_setup.c
>+++ b/examples/tep_termination/vxlan_setup.c
>@@ -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");
>-- 
>2.17.1
>

Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>

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

* [dpdk-dev] [PATCH v2] examples/tep_term: fix return value check
  2020-02-10  3:07 [dpdk-dev] [PATCH] examples/tep_term: fix return value check Xiaoyun Li
  2020-02-10  3:36 ` Ye Xiaolong
@ 2020-02-10  7:04 ` " Xiaoyun Li
  2020-02-10  7:04   ` Ye Xiaolong
  2020-02-13 14:57   ` David Marchand
  2020-02-17  1:41 ` [dpdk-dev] [PATCH v3] examples/tep_term: remove redundant info get Xiaoyun Li
  2 siblings, 2 replies; 9+ messages in thread
From: Xiaoyun Li @ 2020-02-10  7:04 UTC (permalink / raw)
  To: xiaolong.ye, marko.kovacevic; +Cc: dev, Xiaoyun Li, stable

Added return value check for 'rte_eth_dev_info_get()'.

Coverity issue: 349922
Fixes: 2bb43bd4350a ("examples/tep_term: add TSO offload configuration")
Cc: stable@dpdk.org

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
---
 examples/tep_termination/vxlan_setup.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c
index eca119a72..f8385b690 100644
--- a/examples/tep_termination/vxlan_setup.c
+++ b/examples/tep_termination/vxlan_setup.c
@@ -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");
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH v2] examples/tep_term: fix return value check
  2020-02-10  7:04 ` [dpdk-dev] [PATCH v2] " Xiaoyun Li
  2020-02-10  7:04   ` Ye Xiaolong
@ 2020-02-13 14:57   ` David Marchand
  2020-02-17  1:49     ` Li, Xiaoyun
  1 sibling, 1 reply; 9+ messages in thread
From: David Marchand @ 2020-02-13 14:57 UTC (permalink / raw)
  To: Xiaoyun Li; +Cc: Xiaolong Ye, Kovacevic, Marko, dev, dpdk stable

On Mon, Feb 10, 2020 at 8:05 AM Xiaoyun Li <xiaoyun.li@intel.com> wrote:
>
> 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.


> Cc: stable@dpdk.org
>
> Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
> ---
>  examples/tep_termination/vxlan_setup.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c
> index eca119a72..f8385b690 100644
> --- a/examples/tep_termination/vxlan_setup.c
> +++ b/examples/tep_termination/vxlan_setup.c
> @@ -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


-- 
David Marchand


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

* [dpdk-dev] [PATCH v3] examples/tep_term: remove redundant info get
  2020-02-10  3:07 [dpdk-dev] [PATCH] examples/tep_term: fix return value check Xiaoyun Li
  2020-02-10  3:36 ` Ye Xiaolong
  2020-02-10  7:04 ` [dpdk-dev] [PATCH v2] " Xiaoyun Li
@ 2020-02-17  1:41 ` Xiaoyun Li
  2 siblings, 0 replies; 9+ messages in thread
From: Xiaoyun Li @ 2020-02-17  1:41 UTC (permalink / raw)
  To: xiaolong.ye, david.marchand; +Cc: dev, Xiaoyun Li, stable

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")
Cc: stable@dpdk.org

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
---
 examples/tep_termination/vxlan_setup.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c
index eca119a72..4b44ccc14 100644
--- a/examples/tep_termination/vxlan_setup.c
+++ b/examples/tep_termination/vxlan_setup.c
@@ -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");
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH v2] examples/tep_term: fix return value check
  2020-02-13 14:57   ` David Marchand
@ 2020-02-17  1:49     ` Li, Xiaoyun
  0 siblings, 0 replies; 9+ messages in thread
From: Li, Xiaoyun @ 2020-02-17  1:49 UTC (permalink / raw)
  To: David Marchand; +Cc: Ye, Xiaolong, Kovacevic, Marko, dev, dpdk stable

Hi

> -----Original Message-----
> From: David Marchand [mailto:david.marchand@redhat.com]
> Sent: Thursday, February 13, 2020 22:57
> To: Li, Xiaoyun <xiaoyun.li@intel.com>
> Cc: Ye, Xiaolong <xiaolong.ye@intel.com>; Kovacevic, Marko
> <marko.kovacevic@intel.com>; dev <dev@dpdk.org>; dpdk stable
> <stable@dpdk.org>
> Subject: Re: [dpdk-dev] [PATCH v2] examples/tep_term: fix return value check
> 
> On Mon, Feb 10, 2020 at 8:05 AM Xiaoyun Li <xiaoyun.li@intel.com> wrote:
> >
> > 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.
> 
> 
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
> > ---
> >  examples/tep_termination/vxlan_setup.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/examples/tep_termination/vxlan_setup.c
> > b/examples/tep_termination/vxlan_setup.c
> > index eca119a72..f8385b690 100644
> > --- a/examples/tep_termination/vxlan_setup.c
> > +++ b/examples/tep_termination/vxlan_setup.c
> > @@ -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

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.
> 
> 
> --
> David Marchand


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

end of thread, back to index

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-10  3:07 [dpdk-dev] [PATCH] examples/tep_term: fix return value check Xiaoyun Li
2020-02-10  3:36 ` Ye Xiaolong
2020-02-10  5:04   ` Li, Xiaoyun
2020-02-10  6:51     ` Ye Xiaolong
2020-02-10  7:04 ` [dpdk-dev] [PATCH v2] " Xiaoyun Li
2020-02-10  7:04   ` Ye Xiaolong
2020-02-13 14:57   ` David Marchand
2020-02-17  1:49     ` Li, Xiaoyun
2020-02-17  1:41 ` [dpdk-dev] [PATCH v3] examples/tep_term: remove redundant info get Xiaoyun Li

DPDK patches and discussions

Archives are clonable:
	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


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


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