DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] example/ipv4_multicast: fix app hanging when using clone
@ 2018-11-12 20:46 Herakliusz Lipiec
  2018-11-12 22:44 ` Ananyev, Konstantin
                   ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: Herakliusz Lipiec @ 2018-11-12 20:46 UTC (permalink / raw)
  To: dev; +Cc: konstantin.ananyev, Herakliusz Lipiec

This example was dropping packets when using clone (ip 224.0.0.103).
The problem was that mbufs were not freed. This was caused by coping
ol_flags from cloned mbuf to header mbufs.

Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
---
 examples/ipv4_multicast/main.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c
index 4073a4907..428ca4694 100644
--- a/examples/ipv4_multicast/main.c
+++ b/examples/ipv4_multicast/main.c
@@ -266,8 +266,6 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone)
 	hdr->tx_offload = pkt->tx_offload;
 	hdr->hash = pkt->hash;
 
-	hdr->ol_flags = pkt->ol_flags;
-
 	__rte_mbuf_sanity_check(hdr, 1);
 	return hdr;
 }
-- 
2.17.1

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

* Re: [dpdk-dev] [PATCH] example/ipv4_multicast: fix app hanging when using clone
  2018-11-12 20:46 [dpdk-dev] [PATCH] example/ipv4_multicast: fix app hanging when using clone Herakliusz Lipiec
@ 2018-11-12 22:44 ` Ananyev, Konstantin
  2018-11-13  9:25 ` Thomas Monjalon
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 20+ messages in thread
From: Ananyev, Konstantin @ 2018-11-12 22:44 UTC (permalink / raw)
  To: Lipiec, Herakliusz, dev



> -----Original Message-----
> From: Lipiec, Herakliusz
> Sent: Monday, November 12, 2018 8:47 PM
> To: dev@dpdk.org
> Cc: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Lipiec, Herakliusz <herakliusz.lipiec@intel.com>
> Subject: [PATCH] example/ipv4_multicast: fix app hanging when using clone
> 
> This example was dropping packets when using clone (ip 224.0.0.103).
> The problem was that mbufs were not freed. This was caused by coping
> ol_flags from cloned mbuf to header mbufs.
> 
> Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
> ---
>  examples/ipv4_multicast/main.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c
> index 4073a4907..428ca4694 100644
> --- a/examples/ipv4_multicast/main.c
> +++ b/examples/ipv4_multicast/main.c
> @@ -266,8 +266,6 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone)
>  	hdr->tx_offload = pkt->tx_offload;
>  	hdr->hash = pkt->hash;
> 
> -	hdr->ol_flags = pkt->ol_flags;
> -
>  	__rte_mbuf_sanity_check(hdr, 1);
>  	return hdr;
>  }
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 2.17.1

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

* Re: [dpdk-dev] [PATCH] example/ipv4_multicast: fix app hanging when using clone
  2018-11-12 20:46 [dpdk-dev] [PATCH] example/ipv4_multicast: fix app hanging when using clone Herakliusz Lipiec
  2018-11-12 22:44 ` Ananyev, Konstantin
@ 2018-11-13  9:25 ` Thomas Monjalon
  2018-11-13  9:47   ` Ananyev, Konstantin
  2018-11-13 10:21 ` Burakov, Anatoly
  2018-11-13 11:49 ` [dpdk-dev] [PATCH v2] " Herakliusz Lipiec
  3 siblings, 1 reply; 20+ messages in thread
From: Thomas Monjalon @ 2018-11-13  9:25 UTC (permalink / raw)
  To: Herakliusz Lipiec; +Cc: dev, konstantin.ananyev

Hi,

12/11/2018 21:46, Herakliusz Lipiec:
> This example was dropping packets when using clone (ip 224.0.0.103).

What is this IP?
What is clone?

> The problem was that mbufs were not freed. This was caused by coping
> ol_flags from cloned mbuf to header mbufs.

Mbuf is not freed because of ol_flags?
I feel this description should be improved.

> Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
[...]
> --- a/examples/ipv4_multicast/main.c
> +++ b/examples/ipv4_multicast/main.c
> @@ -266,8 +266,6 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone)
>  	hdr->tx_offload = pkt->tx_offload;
>  	hdr->hash = pkt->hash;
>  
> -	hdr->ol_flags = pkt->ol_flags;
> -
>  	__rte_mbuf_sanity_check(hdr, 1);
>  	return hdr;
>  }

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

* Re: [dpdk-dev] [PATCH] example/ipv4_multicast: fix app hanging when using clone
  2018-11-13  9:25 ` Thomas Monjalon
@ 2018-11-13  9:47   ` Ananyev, Konstantin
  0 siblings, 0 replies; 20+ messages in thread
From: Ananyev, Konstantin @ 2018-11-13  9:47 UTC (permalink / raw)
  To: Thomas Monjalon, Lipiec, Herakliusz; +Cc: dev



> 
> Hi,
> 
> 12/11/2018 21:46, Herakliusz Lipiec:
> > This example was dropping packets when using clone (ip 224.0.0.103).

The problem is that ipv4_multicast app:
1. invokes rte_pktmbuf_clone() for the packet 
(that creates a new mbuf with  IND_ATTACHED_MBUF set in ol_flags).
2. creates new mbuf containing  L2 header and chains it with cloned at step 1 mbuf.
3. copy ol_flags from cloned mbuf to new header mbuf.

So after step 3 L2 header mbuf also has IND_ATTACHED_MBUF set in ol_flags.
That makes pktmbuf_free() wrongly assume that this is an indirect mbuf,
which causes   all sorts of problems: incorrect behavior, silent memory corruption, etc.
The easiest way to reproduce the problem:
- run ipv4_multicast, using two ports:
   ipv4_multicast -l 0,1 - -p 0x3
send  8K+ packets to one of the ports with dest ip address: 224.0.0.103
ipv4_multicast will stop forward any packets.

In fact, there is no reason to copy ol_flags from the cloned packet.
So the fix is just to remove that code.
Konstantin

> 
> What is this IP?
> What is clone?
> 
> > The problem was that mbufs were not freed. This was caused by coping
> > ol_flags from cloned mbuf to header mbufs.
> 
> Mbuf is not freed because of ol_flags?
> I feel this description should be improved.
> 
> > Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
> [...]
> > --- a/examples/ipv4_multicast/main.c
> > +++ b/examples/ipv4_multicast/main.c
> > @@ -266,8 +266,6 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone)
> >  	hdr->tx_offload = pkt->tx_offload;
> >  	hdr->hash = pkt->hash;
> >
> > -	hdr->ol_flags = pkt->ol_flags;
> > -
> >  	__rte_mbuf_sanity_check(hdr, 1);
> >  	return hdr;
> >  }
> 
> 

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

* Re: [dpdk-dev] [PATCH] example/ipv4_multicast: fix app hanging when using clone
  2018-11-12 20:46 [dpdk-dev] [PATCH] example/ipv4_multicast: fix app hanging when using clone Herakliusz Lipiec
  2018-11-12 22:44 ` Ananyev, Konstantin
  2018-11-13  9:25 ` Thomas Monjalon
@ 2018-11-13 10:21 ` Burakov, Anatoly
  2018-11-13 10:28   ` Ananyev, Konstantin
  2018-11-13 11:49 ` [dpdk-dev] [PATCH v2] " Herakliusz Lipiec
  3 siblings, 1 reply; 20+ messages in thread
From: Burakov, Anatoly @ 2018-11-13 10:21 UTC (permalink / raw)
  To: Herakliusz Lipiec, dev; +Cc: konstantin.ananyev

On 12-Nov-18 8:46 PM, Herakliusz Lipiec wrote:
> This example was dropping packets when using clone (ip 224.0.0.103).
> The problem was that mbufs were not freed. This was caused by coping
> ol_flags from cloned mbuf to header mbufs.
> 
> Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
> ---

I agree with Thomas, needs clearer description. Suggest using some of 
the wording provided by Konstantin in later replies. Also, needs a 
Fixes: tag and a CC: stable, because it appears that this bug has been 
around for a few releases.

-- 
Thanks,
Anatoly

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

* Re: [dpdk-dev] [PATCH] example/ipv4_multicast: fix app hanging when using clone
  2018-11-13 10:21 ` Burakov, Anatoly
@ 2018-11-13 10:28   ` Ananyev, Konstantin
  0 siblings, 0 replies; 20+ messages in thread
From: Ananyev, Konstantin @ 2018-11-13 10:28 UTC (permalink / raw)
  To: Burakov, Anatoly, Lipiec, Herakliusz, dev



> > ---
> 
> I agree with Thomas, needs clearer description. Suggest using some of
> the wording provided by Konstantin in later replies. Also, needs a
> Fixes: tag and a CC: stable, because it appears that this bug has been
> around for a few releases.

Good point, I forgot about 'fixes' and 'stable'.
Thanks
Konstantin


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

* [dpdk-dev] [PATCH v2] example/ipv4_multicast: fix app hanging when using clone
  2018-11-12 20:46 [dpdk-dev] [PATCH] example/ipv4_multicast: fix app hanging when using clone Herakliusz Lipiec
                   ` (2 preceding siblings ...)
  2018-11-13 10:21 ` Burakov, Anatoly
@ 2018-11-13 11:49 ` Herakliusz Lipiec
  2018-11-13 11:51   ` Ananyev, Konstantin
  2018-11-14  2:28   ` [dpdk-dev] " Wang, Dong1
  3 siblings, 2 replies; 20+ messages in thread
From: Herakliusz Lipiec @ 2018-11-13 11:49 UTC (permalink / raw)
  To: dev
  Cc: konstantin.ananyev, dong1.wang, thomas, anatoly.burakov,
	Herakliusz Lipiec, stable

The ipv4_multicast sample application was dropping packets
when using mbuf clone. When creating an L2 header and copying
metadata from the source packet, the ol_flags were also copied
along with all the other metadata. Because the cloned packet
had IND_ATTACHED_MBUF flag set in its ol_flags,
this caused the packets to never be freed when using rte_pktmbuf_free.
Since copying ol_flags from the cloned packet is
not necessary in the first place, just don't do it.

Fixes: af75078fece3 ("first public release")
CC: stable@dpdk.org

Reported-by: Wang Dong <dong1.wang@intel.com>
Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
---
 doc/guides/sample_app_ug/ipv4_multicast.rst | 1 -
 examples/ipv4_multicast/main.c              | 2 --
 2 files changed, 3 deletions(-)

diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst b/doc/guides/sample_app_ug/ipv4_multicast.rst
index ce1474ec7..f6efa7f6f 100644
--- a/doc/guides/sample_app_ug/ipv4_multicast.rst
+++ b/doc/guides/sample_app_ug/ipv4_multicast.rst
@@ -319,7 +319,6 @@ It is the mcast_out_pkt() function that performs the packet duplication (either
         hdr->pkt.in_port = pkt->pkt.in_port;
         hdr->pkt.vlan_macip = pkt->pkt.vlan_macip;
         hdr->pkt.hash = pkt->pkt.hash;
-        hdr->ol_flags = pkt->ol_flags;
         rte_mbuf_sanity_check(hdr, RTE_MBUF_PKT, 1);
 
         return hdr;
diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c
index 4073a4907..428ca4694 100644
--- a/examples/ipv4_multicast/main.c
+++ b/examples/ipv4_multicast/main.c
@@ -266,8 +266,6 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone)
 	hdr->tx_offload = pkt->tx_offload;
 	hdr->hash = pkt->hash;
 
-	hdr->ol_flags = pkt->ol_flags;
-
 	__rte_mbuf_sanity_check(hdr, 1);
 	return hdr;
 }
-- 
2.17.1

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

* Re: [dpdk-dev] [PATCH v2] example/ipv4_multicast: fix app hanging when using clone
  2018-11-13 11:49 ` [dpdk-dev] [PATCH v2] " Herakliusz Lipiec
@ 2018-11-13 11:51   ` Ananyev, Konstantin
  2018-11-14 11:33     ` Wang, Dong1
  2018-11-14  2:28   ` [dpdk-dev] " Wang, Dong1
  1 sibling, 1 reply; 20+ messages in thread
From: Ananyev, Konstantin @ 2018-11-13 11:51 UTC (permalink / raw)
  To: Lipiec, Herakliusz, dev; +Cc: Wang, Dong1, thomas, Burakov, Anatoly, stable


> -----Original Message-----
> From: Lipiec, Herakliusz
> Sent: Tuesday, November 13, 2018 11:49 AM
> To: dev@dpdk.org
> Cc: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Wang, Dong1 <dong1.wang@intel.com>; thomas@monjalon.net; Burakov,
> Anatoly <anatoly.burakov@intel.com>; Lipiec, Herakliusz <herakliusz.lipiec@intel.com>; stable@dpdk.org
> Subject: [PATCH v2] example/ipv4_multicast: fix app hanging when using clone
> 
> The ipv4_multicast sample application was dropping packets
> when using mbuf clone. When creating an L2 header and copying
> metadata from the source packet, the ol_flags were also copied
> along with all the other metadata. Because the cloned packet
> had IND_ATTACHED_MBUF flag set in its ol_flags,
> this caused the packets to never be freed when using rte_pktmbuf_free.
> Since copying ol_flags from the cloned packet is
> not necessary in the first place, just don't do it.
> 
> Fixes: af75078fece3 ("first public release")
> CC: stable@dpdk.org
> 
> Reported-by: Wang Dong <dong1.wang@intel.com>
> Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
> ---

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

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

* Re: [dpdk-dev] [PATCH v2] example/ipv4_multicast: fix app hanging when using clone
  2018-11-13 11:49 ` [dpdk-dev] [PATCH v2] " Herakliusz Lipiec
  2018-11-13 11:51   ` Ananyev, Konstantin
@ 2018-11-14  2:28   ` Wang, Dong1
  2018-11-14  9:02     ` Ananyev, Konstantin
  1 sibling, 1 reply; 20+ messages in thread
From: Wang, Dong1 @ 2018-11-14  2:28 UTC (permalink / raw)
  To: Lipiec, Herakliusz, dev
  Cc: Ananyev, Konstantin, thomas, Burakov, Anatoly, stable

Hi Herakliusz,

Since pkt->ol_flags might set some other bits except IND_ATTACHED_MBUF, how about set its value to original pkt->ol_flags?

Regards,
Dong

-----Original Message-----
From: Lipiec, Herakliusz 
Sent: Tuesday, November 13, 2018 19:49
To: dev@dpdk.org
Cc: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Wang, Dong1 <dong1.wang@intel.com>; thomas@monjalon.net; Burakov, Anatoly <anatoly.burakov@intel.com>; Lipiec, Herakliusz <herakliusz.lipiec@intel.com>; stable@dpdk.org
Subject: [PATCH v2] example/ipv4_multicast: fix app hanging when using clone

The ipv4_multicast sample application was dropping packets when using mbuf clone. When creating an L2 header and copying metadata from the source packet, the ol_flags were also copied along with all the other metadata. Because the cloned packet had IND_ATTACHED_MBUF flag set in its ol_flags, this caused the packets to never be freed when using rte_pktmbuf_free.
Since copying ol_flags from the cloned packet is not necessary in the first place, just don't do it.

Fixes: af75078fece3 ("first public release")
CC: stable@dpdk.org

Reported-by: Wang Dong <dong1.wang@intel.com>
Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
---
 doc/guides/sample_app_ug/ipv4_multicast.rst | 1 -
 examples/ipv4_multicast/main.c              | 2 --
 2 files changed, 3 deletions(-)

diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst b/doc/guides/sample_app_ug/ipv4_multicast.rst
index ce1474ec7..f6efa7f6f 100644
--- a/doc/guides/sample_app_ug/ipv4_multicast.rst
+++ b/doc/guides/sample_app_ug/ipv4_multicast.rst
@@ -319,7 +319,6 @@ It is the mcast_out_pkt() function that performs the packet duplication (either
         hdr->pkt.in_port = pkt->pkt.in_port;
         hdr->pkt.vlan_macip = pkt->pkt.vlan_macip;
         hdr->pkt.hash = pkt->pkt.hash;
-        hdr->ol_flags = pkt->ol_flags;
         rte_mbuf_sanity_check(hdr, RTE_MBUF_PKT, 1);
 
         return hdr;
diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index 4073a4907..428ca4694 100644
--- a/examples/ipv4_multicast/main.c
+++ b/examples/ipv4_multicast/main.c
@@ -266,8 +266,6 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone)
 	hdr->tx_offload = pkt->tx_offload;
 	hdr->hash = pkt->hash;
 
-	hdr->ol_flags = pkt->ol_flags;
-
 	__rte_mbuf_sanity_check(hdr, 1);
 	return hdr;
 }
--
2.17.1

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

* Re: [dpdk-dev] [PATCH v2] example/ipv4_multicast: fix app hanging when using clone
  2018-11-14  2:28   ` [dpdk-dev] " Wang, Dong1
@ 2018-11-14  9:02     ` Ananyev, Konstantin
  2018-11-14 10:09       ` Wang, Dong1
  0 siblings, 1 reply; 20+ messages in thread
From: Ananyev, Konstantin @ 2018-11-14  9:02 UTC (permalink / raw)
  To: Wang, Dong1, Lipiec, Herakliusz, dev; +Cc: thomas, Burakov, Anatoly, stable

Hi Dong,

> Hi Herakliusz,
> 
> Since pkt->ol_flags might set some other bits except IND_ATTACHED_MBUF, how about set its value to original pkt->ol_flag

It could be done, but not sure what is the point?
Which flags you think we need to copy from cloned mbuf (segment #2) to new header?
Konstantin

> 
> Regards,
> Dong
> 
> -----Original Message-----
> From: Lipiec, Herakliusz
> Sent: Tuesday, November 13, 2018 19:49
> To: dev@dpdk.org
> Cc: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Wang, Dong1 <dong1.wang@intel.com>; thomas@monjalon.net; Burakov,
> Anatoly <anatoly.burakov@intel.com>; Lipiec, Herakliusz <herakliusz.lipiec@intel.com>; stable@dpdk.org
> Subject: [PATCH v2] example/ipv4_multicast: fix app hanging when using clone
> 
> The ipv4_multicast sample application was dropping packets when using mbuf clone. When creating an L2 header and copying metadata
> from the source packet, the ol_flags were also copied along with all the other metadata. Because the cloned packet had
> IND_ATTACHED_MBUF flag set in its ol_flags, this caused the packets to never be freed when using rte_pktmbuf_free.
> Since copying ol_flags from the cloned packet is not necessary in the first place, just don't do it.
> 
> Fixes: af75078fece3 ("first public release")
> CC: stable@dpdk.org
> 
> Reported-by: Wang Dong <dong1.wang@intel.com>
> Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
> ---
>  doc/guides/sample_app_ug/ipv4_multicast.rst | 1 -
>  examples/ipv4_multicast/main.c              | 2 --
>  2 files changed, 3 deletions(-)
> 
> diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst b/doc/guides/sample_app_ug/ipv4_multicast.rst
> index ce1474ec7..f6efa7f6f 100644
> --- a/doc/guides/sample_app_ug/ipv4_multicast.rst
> +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst
> @@ -319,7 +319,6 @@ It is the mcast_out_pkt() function that performs the packet duplication (either
>          hdr->pkt.in_port = pkt->pkt.in_port;
>          hdr->pkt.vlan_macip = pkt->pkt.vlan_macip;
>          hdr->pkt.hash = pkt->pkt.hash;
> -        hdr->ol_flags = pkt->ol_flags;
>          rte_mbuf_sanity_check(hdr, RTE_MBUF_PKT, 1);
> 
>          return hdr;
> diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index 4073a4907..428ca4694 100644
> --- a/examples/ipv4_multicast/main.c
> +++ b/examples/ipv4_multicast/main.c
> @@ -266,8 +266,6 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone)
>  	hdr->tx_offload = pkt->tx_offload;
>  	hdr->hash = pkt->hash;
> 
> -	hdr->ol_flags = pkt->ol_flags;
> -
>  	__rte_mbuf_sanity_check(hdr, 1);
>  	return hdr;
>  }
> --
> 2.17.1

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

* Re: [dpdk-dev] [PATCH v2] example/ipv4_multicast: fix app hanging when using clone
  2018-11-14  9:02     ` Ananyev, Konstantin
@ 2018-11-14 10:09       ` Wang, Dong1
  2018-11-14 10:17         ` Ananyev, Konstantin
  2018-11-14 10:21         ` Lipiec, Herakliusz
  0 siblings, 2 replies; 20+ messages in thread
From: Wang, Dong1 @ 2018-11-14 10:09 UTC (permalink / raw)
  To: Ananyev, Konstantin, Lipiec, Herakliusz, dev
  Cc: thomas, Burakov, Anatoly, stable

Hi Konstantin,

In this example, no flags be set by user, so no need to copy flags from original  mbuf.
I'm thinking about some DPDK developers may create their own application based on this example,  they add some flags before packet be cloned.

Regards,
Dong

-----Original Message-----
From: Ananyev, Konstantin 
Sent: Wednesday, November 14, 2018 17:03
To: Wang, Dong1 <dong1.wang@intel.com>; Lipiec, Herakliusz <herakliusz.lipiec@intel.com>; dev@dpdk.org
Cc: thomas@monjalon.net; Burakov, Anatoly <anatoly.burakov@intel.com>; stable@dpdk.org
Subject: RE: [PATCH v2] example/ipv4_multicast: fix app hanging when using clone

Hi Dong,

> Hi Herakliusz,
> 
> Since pkt->ol_flags might set some other bits except 
> IND_ATTACHED_MBUF, how about set its value to original pkt->ol_flag

It could be done, but not sure what is the point?
Which flags you think we need to copy from cloned mbuf (segment #2) to new header?
Konstantin

> 
> Regards,
> Dong
> 
> -----Original Message-----
> From: Lipiec, Herakliusz
> Sent: Tuesday, November 13, 2018 19:49
> To: dev@dpdk.org
> Cc: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Wang, Dong1 
> <dong1.wang@intel.com>; thomas@monjalon.net; Burakov, Anatoly 
> <anatoly.burakov@intel.com>; Lipiec, Herakliusz 
> <herakliusz.lipiec@intel.com>; stable@dpdk.org
> Subject: [PATCH v2] example/ipv4_multicast: fix app hanging when using 
> clone
> 
> The ipv4_multicast sample application was dropping packets when using 
> mbuf clone. When creating an L2 header and copying metadata from the 
> source packet, the ol_flags were also copied along with all the other metadata. Because the cloned packet had IND_ATTACHED_MBUF flag set in its ol_flags, this caused the packets to never be freed when using rte_pktmbuf_free.
> Since copying ol_flags from the cloned packet is not necessary in the first place, just don't do it.
> 
> Fixes: af75078fece3 ("first public release")
> CC: stable@dpdk.org
> 
> Reported-by: Wang Dong <dong1.wang@intel.com>
> Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
> ---
>  doc/guides/sample_app_ug/ipv4_multicast.rst | 1 -
>  examples/ipv4_multicast/main.c              | 2 --
>  2 files changed, 3 deletions(-)
> 
> diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst 
> b/doc/guides/sample_app_ug/ipv4_multicast.rst
> index ce1474ec7..f6efa7f6f 100644
> --- a/doc/guides/sample_app_ug/ipv4_multicast.rst
> +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst
> @@ -319,7 +319,6 @@ It is the mcast_out_pkt() function that performs the packet duplication (either
>          hdr->pkt.in_port = pkt->pkt.in_port;
>          hdr->pkt.vlan_macip = pkt->pkt.vlan_macip;
>          hdr->pkt.hash = pkt->pkt.hash;
> -        hdr->ol_flags = pkt->ol_flags;
>          rte_mbuf_sanity_check(hdr, RTE_MBUF_PKT, 1);
> 
>          return hdr;
> diff --git a/examples/ipv4_multicast/main.c 
> b/examples/ipv4_multicast/main.c index 4073a4907..428ca4694 100644
> --- a/examples/ipv4_multicast/main.c
> +++ b/examples/ipv4_multicast/main.c
> @@ -266,8 +266,6 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone)
>  	hdr->tx_offload = pkt->tx_offload;
>  	hdr->hash = pkt->hash;
> 
> -	hdr->ol_flags = pkt->ol_flags;
> -
>  	__rte_mbuf_sanity_check(hdr, 1);
>  	return hdr;
>  }
> --
> 2.17.1

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

* Re: [dpdk-dev] [PATCH v2] example/ipv4_multicast: fix app hanging when using clone
  2018-11-14 10:09       ` Wang, Dong1
@ 2018-11-14 10:17         ` Ananyev, Konstantin
  2018-11-14 11:06           ` Wang, Dong1
  2018-11-14 10:21         ` Lipiec, Herakliusz
  1 sibling, 1 reply; 20+ messages in thread
From: Ananyev, Konstantin @ 2018-11-14 10:17 UTC (permalink / raw)
  To: Wang, Dong1, Lipiec, Herakliusz, dev; +Cc: thomas, Burakov, Anatoly, stable


> 
> Hi Konstantin,
> 
> In this example, no flags be set by user, so no need to copy flags from original  mbuf.

Then why to bother?

> I'm thinking about some DPDK developers may create their own application based on this example,  they add some flags before packet be
> cloned.

Hmm you receive a packet change l2 header and transmit it.
What flags you might need to copy from original header 
considering that only RX flags would be set at present moment?
If you let say want to insert vlan tag (or so), then you'll have to set new TX flags. 
Again, for timestamp you'll need to copy the timestamp value too,
which we don't support in that example. 
Konstantin

> 
> Regards,
> Dong
> 
> -----Original Message-----
> From: Ananyev, Konstantin
> Sent: Wednesday, November 14, 2018 17:03
> To: Wang, Dong1 <dong1.wang@intel.com>; Lipiec, Herakliusz <herakliusz.lipiec@intel.com>; dev@dpdk.org
> Cc: thomas@monjalon.net; Burakov, Anatoly <anatoly.burakov@intel.com>; stable@dpdk.org
> Subject: RE: [PATCH v2] example/ipv4_multicast: fix app hanging when using clone
> 
> Hi Dong,
> 
> > Hi Herakliusz,
> >
> > Since pkt->ol_flags might set some other bits except
> > IND_ATTACHED_MBUF, how about set its value to original pkt->ol_flag
> 
> It could be done, but not sure what is the point?
> Which flags you think we need to copy from cloned mbuf (segment #2) to new header?
> Konstantin
> 
> >
> > Regards,
> > Dong
> >
> > -----Original Message-----
> > From: Lipiec, Herakliusz
> > Sent: Tuesday, November 13, 2018 19:49
> > To: dev@dpdk.org
> > Cc: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Wang, Dong1
> > <dong1.wang@intel.com>; thomas@monjalon.net; Burakov, Anatoly
> > <anatoly.burakov@intel.com>; Lipiec, Herakliusz
> > <herakliusz.lipiec@intel.com>; stable@dpdk.org
> > Subject: [PATCH v2] example/ipv4_multicast: fix app hanging when using
> > clone
> >
> > The ipv4_multicast sample application was dropping packets when using
> > mbuf clone. When creating an L2 header and copying metadata from the
> > source packet, the ol_flags were also copied along with all the other metadata. Because the cloned packet had IND_ATTACHED_MBUF
> flag set in its ol_flags, this caused the packets to never be freed when using rte_pktmbuf_free.
> > Since copying ol_flags from the cloned packet is not necessary in the first place, just don't do it.
> >
> > Fixes: af75078fece3 ("first public release")
> > CC: stable@dpdk.org
> >
> > Reported-by: Wang Dong <dong1.wang@intel.com>
> > Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
> > ---
> >  doc/guides/sample_app_ug/ipv4_multicast.rst | 1 -
> >  examples/ipv4_multicast/main.c              | 2 --
> >  2 files changed, 3 deletions(-)
> >
> > diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst
> > b/doc/guides/sample_app_ug/ipv4_multicast.rst
> > index ce1474ec7..f6efa7f6f 100644
> > --- a/doc/guides/sample_app_ug/ipv4_multicast.rst
> > +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst
> > @@ -319,7 +319,6 @@ It is the mcast_out_pkt() function that performs the packet duplication (either
> >          hdr->pkt.in_port = pkt->pkt.in_port;
> >          hdr->pkt.vlan_macip = pkt->pkt.vlan_macip;
> >          hdr->pkt.hash = pkt->pkt.hash;
> > -        hdr->ol_flags = pkt->ol_flags;
> >          rte_mbuf_sanity_check(hdr, RTE_MBUF_PKT, 1);
> >
> >          return hdr;
> > diff --git a/examples/ipv4_multicast/main.c
> > b/examples/ipv4_multicast/main.c index 4073a4907..428ca4694 100644
> > --- a/examples/ipv4_multicast/main.c
> > +++ b/examples/ipv4_multicast/main.c
> > @@ -266,8 +266,6 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone)
> >  	hdr->tx_offload = pkt->tx_offload;
> >  	hdr->hash = pkt->hash;
> >
> > -	hdr->ol_flags = pkt->ol_flags;
> > -
> >  	__rte_mbuf_sanity_check(hdr, 1);
> >  	return hdr;
> >  }
> > --
> > 2.17.1

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

* Re: [dpdk-dev] [PATCH v2] example/ipv4_multicast: fix app hanging when using clone
  2018-11-14 10:09       ` Wang, Dong1
  2018-11-14 10:17         ` Ananyev, Konstantin
@ 2018-11-14 10:21         ` Lipiec, Herakliusz
  1 sibling, 0 replies; 20+ messages in thread
From: Lipiec, Herakliusz @ 2018-11-14 10:21 UTC (permalink / raw)
  To: Wang, Dong1, Ananyev, Konstantin, dev; +Cc: thomas, Burakov, Anatoly, stable

Hi Dong,
I think that if a developer is to manipulate ol_flags, then its onto that developer to take care of copying ol_flags .
Regards Herakliusz

> -----Original Message-----
> From: Wang, Dong1
> Sent: Wednesday, November 14, 2018 10:09 AM
> To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Lipiec, Herakliusz
> <herakliusz.lipiec@intel.com>; dev@dpdk.org
> Cc: thomas@monjalon.net; Burakov, Anatoly <anatoly.burakov@intel.com>;
> stable@dpdk.org
> Subject: RE: [PATCH v2] example/ipv4_multicast: fix app hanging when using
> clone
> 
> Hi Konstantin,
> 
> In this example, no flags be set by user, so no need to copy flags from original
> mbuf.
> I'm thinking about some DPDK developers may create their own application
> based on this example,  they add some flags before packet be cloned.
> 
> Regards,
> Dong
> 
> -----Original Message-----
> From: Ananyev, Konstantin
> Sent: Wednesday, November 14, 2018 17:03
> To: Wang, Dong1 <dong1.wang@intel.com>; Lipiec, Herakliusz
> <herakliusz.lipiec@intel.com>; dev@dpdk.org
> Cc: thomas@monjalon.net; Burakov, Anatoly <anatoly.burakov@intel.com>;
> stable@dpdk.org
> Subject: RE: [PATCH v2] example/ipv4_multicast: fix app hanging when using
> clone
> 
> Hi Dong,
> 
> > Hi Herakliusz,
> >
> > Since pkt->ol_flags might set some other bits except
> > IND_ATTACHED_MBUF, how about set its value to original pkt->ol_flag
> 
> It could be done, but not sure what is the point?
> Which flags you think we need to copy from cloned mbuf (segment #2) to
> new header?
> Konstantin
> 
> >
> > Regards,
> > Dong
> >
> > -----Original Message-----
> > From: Lipiec, Herakliusz
> > Sent: Tuesday, November 13, 2018 19:49
> > To: dev@dpdk.org
> > Cc: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Wang, Dong1
> > <dong1.wang@intel.com>; thomas@monjalon.net; Burakov, Anatoly
> > <anatoly.burakov@intel.com>; Lipiec, Herakliusz
> > <herakliusz.lipiec@intel.com>; stable@dpdk.org
> > Subject: [PATCH v2] example/ipv4_multicast: fix app hanging when using
> > clone
> >
> > The ipv4_multicast sample application was dropping packets when using
> > mbuf clone. When creating an L2 header and copying metadata from the
> > source packet, the ol_flags were also copied along with all the other
> metadata. Because the cloned packet had IND_ATTACHED_MBUF flag set in
> its ol_flags, this caused the packets to never be freed when using
> rte_pktmbuf_free.
> > Since copying ol_flags from the cloned packet is not necessary in the first
> place, just don't do it.
> >
> > Fixes: af75078fece3 ("first public release")
> > CC: stable@dpdk.org
> >
> > Reported-by: Wang Dong <dong1.wang@intel.com>
> > Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
> > ---
> >  doc/guides/sample_app_ug/ipv4_multicast.rst | 1 -
> >  examples/ipv4_multicast/main.c              | 2 --
> >  2 files changed, 3 deletions(-)
> >
> > diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst
> > b/doc/guides/sample_app_ug/ipv4_multicast.rst
> > index ce1474ec7..f6efa7f6f 100644
> > --- a/doc/guides/sample_app_ug/ipv4_multicast.rst
> > +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst
> > @@ -319,7 +319,6 @@ It is the mcast_out_pkt() function that performs the
> packet duplication (either
> >          hdr->pkt.in_port = pkt->pkt.in_port;
> >          hdr->pkt.vlan_macip = pkt->pkt.vlan_macip;
> >          hdr->pkt.hash = pkt->pkt.hash;
> > -        hdr->ol_flags = pkt->ol_flags;
> >          rte_mbuf_sanity_check(hdr, RTE_MBUF_PKT, 1);
> >
> >          return hdr;
> > diff --git a/examples/ipv4_multicast/main.c
> > b/examples/ipv4_multicast/main.c index 4073a4907..428ca4694 100644
> > --- a/examples/ipv4_multicast/main.c
> > +++ b/examples/ipv4_multicast/main.c
> > @@ -266,8 +266,6 @@ mcast_out_pkt(struct rte_mbuf *pkt, int
> use_clone)
> >  	hdr->tx_offload = pkt->tx_offload;
> >  	hdr->hash = pkt->hash;
> >
> > -	hdr->ol_flags = pkt->ol_flags;
> > -
> >  	__rte_mbuf_sanity_check(hdr, 1);
> >  	return hdr;
> >  }
> > --
> > 2.17.1

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

* Re: [dpdk-dev] [PATCH v2] example/ipv4_multicast: fix app hanging when using clone
  2018-11-14 10:17         ` Ananyev, Konstantin
@ 2018-11-14 11:06           ` Wang, Dong1
  2018-11-14 11:19             ` Ananyev, Konstantin
  0 siblings, 1 reply; 20+ messages in thread
From: Wang, Dong1 @ 2018-11-14 11:06 UTC (permalink / raw)
  To: Ananyev, Konstantin, Lipiec, Herakliusz, dev
  Cc: thomas, Burakov, Anatoly, stable

Hi Konstantin & Herakliusz,

In mcast_out_pkt(), new header added and to be the first segment. Driver will check first segment's ol_flags when sending mbuf. So why new first segment didn't inherit old one's ol_flags? This function already copied other mbuf fields from old one.

Since this is an example and reference code, hope developer can reuse it smoothly. If they didn't notice ol_flags not be copied because ol_flags is not changed in this example, they may take some time to debug their application.

This is a tiny change to the patch, I hope it cloud be done.

Thanks,
Dong

-----Original Message-----
From: Ananyev, Konstantin 
Sent: Wednesday, November 14, 2018 18:18
To: Wang, Dong1 <dong1.wang@intel.com>; Lipiec, Herakliusz <herakliusz.lipiec@intel.com>; dev@dpdk.org
Cc: thomas@monjalon.net; Burakov, Anatoly <anatoly.burakov@intel.com>; stable@dpdk.org
Subject: RE: [PATCH v2] example/ipv4_multicast: fix app hanging when using clone


> 
> Hi Konstantin,
> 
> In this example, no flags be set by user, so no need to copy flags from original  mbuf.

Then why to bother?

> I'm thinking about some DPDK developers may create their own 
> application based on this example,  they add some flags before packet be cloned.

Hmm you receive a packet change l2 header and transmit it.
What flags you might need to copy from original header considering that only RX flags would be set at present moment?
If you let say want to insert vlan tag (or so), then you'll have to set new TX flags. 
Again, for timestamp you'll need to copy the timestamp value too, which we don't support in that example. 
Konstantin

> 
> Regards,
> Dong
> 
> -----Original Message-----
> From: Ananyev, Konstantin
> Sent: Wednesday, November 14, 2018 17:03
> To: Wang, Dong1 <dong1.wang@intel.com>; Lipiec, Herakliusz 
> <herakliusz.lipiec@intel.com>; dev@dpdk.org
> Cc: thomas@monjalon.net; Burakov, Anatoly <anatoly.burakov@intel.com>; 
> stable@dpdk.org
> Subject: RE: [PATCH v2] example/ipv4_multicast: fix app hanging when 
> using clone
> 
> Hi Dong,
> 
> > Hi Herakliusz,
> >
> > Since pkt->ol_flags might set some other bits except 
> > IND_ATTACHED_MBUF, how about set its value to original pkt->ol_flag
> 
> It could be done, but not sure what is the point?
> Which flags you think we need to copy from cloned mbuf (segment #2) to new header?
> Konstantin
> 
> >
> > Regards,
> > Dong
> >
> > -----Original Message-----
> > From: Lipiec, Herakliusz
> > Sent: Tuesday, November 13, 2018 19:49
> > To: dev@dpdk.org
> > Cc: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Wang, Dong1 
> > <dong1.wang@intel.com>; thomas@monjalon.net; Burakov, Anatoly 
> > <anatoly.burakov@intel.com>; Lipiec, Herakliusz 
> > <herakliusz.lipiec@intel.com>; stable@dpdk.org
> > Subject: [PATCH v2] example/ipv4_multicast: fix app hanging when 
> > using clone
> >
> > The ipv4_multicast sample application was dropping packets when 
> > using mbuf clone. When creating an L2 header and copying metadata 
> > from the source packet, the ol_flags were also copied along with all 
> > the other metadata. Because the cloned packet had IND_ATTACHED_MBUF
> flag set in its ol_flags, this caused the packets to never be freed when using rte_pktmbuf_free.
> > Since copying ol_flags from the cloned packet is not necessary in the first place, just don't do it.
> >
> > Fixes: af75078fece3 ("first public release")
> > CC: stable@dpdk.org
> >
> > Reported-by: Wang Dong <dong1.wang@intel.com>
> > Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
> > ---
> >  doc/guides/sample_app_ug/ipv4_multicast.rst | 1 -
> >  examples/ipv4_multicast/main.c              | 2 --
> >  2 files changed, 3 deletions(-)
> >
> > diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst
> > b/doc/guides/sample_app_ug/ipv4_multicast.rst
> > index ce1474ec7..f6efa7f6f 100644
> > --- a/doc/guides/sample_app_ug/ipv4_multicast.rst
> > +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst
> > @@ -319,7 +319,6 @@ It is the mcast_out_pkt() function that performs the packet duplication (either
> >          hdr->pkt.in_port = pkt->pkt.in_port;
> >          hdr->pkt.vlan_macip = pkt->pkt.vlan_macip;
> >          hdr->pkt.hash = pkt->pkt.hash;
> > -        hdr->ol_flags = pkt->ol_flags;
> >          rte_mbuf_sanity_check(hdr, RTE_MBUF_PKT, 1);
> >
> >          return hdr;
> > diff --git a/examples/ipv4_multicast/main.c 
> > b/examples/ipv4_multicast/main.c index 4073a4907..428ca4694 100644
> > --- a/examples/ipv4_multicast/main.c
> > +++ b/examples/ipv4_multicast/main.c
> > @@ -266,8 +266,6 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone)
> >  	hdr->tx_offload = pkt->tx_offload;
> >  	hdr->hash = pkt->hash;
> >
> > -	hdr->ol_flags = pkt->ol_flags;
> > -
> >  	__rte_mbuf_sanity_check(hdr, 1);
> >  	return hdr;
> >  }
> > --
> > 2.17.1

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

* Re: [dpdk-dev] [PATCH v2] example/ipv4_multicast: fix app hanging when using clone
  2018-11-14 11:06           ` Wang, Dong1
@ 2018-11-14 11:19             ` Ananyev, Konstantin
  2018-11-14 11:32               ` Wang, Dong1
  2018-11-20  5:40               ` Zhao1, Wei
  0 siblings, 2 replies; 20+ messages in thread
From: Ananyev, Konstantin @ 2018-11-14 11:19 UTC (permalink / raw)
  To: Wang, Dong1, Lipiec, Herakliusz, dev; +Cc: thomas, Burakov, Anatoly, stable



> -----Original Message-----
> From: Wang, Dong1
> Sent: Wednesday, November 14, 2018 11:06 AM
> To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Lipiec, Herakliusz <herakliusz.lipiec@intel.com>; dev@dpdk.org
> Cc: thomas@monjalon.net; Burakov, Anatoly <anatoly.burakov@intel.com>; stable@dpdk.org
> Subject: RE: [PATCH v2] example/ipv4_multicast: fix app hanging when using clone
> 
> Hi Konstantin & Herakliusz,
> 
> In mcast_out_pkt(), new header added and to be the first segment. Driver will check first segment's ol_flags when sending mbuf.

It will check for *TX* flags.
TX flags are not set in cloned mbuf (only RX ones).

> So why new first segment didn't inherit old one's ol_flags? 

Because they are RX flags and they don't' really belong to new packet
we are going to send.
Also, as that bug shows it is error prone.

> This function already copied other mbuf fields from old one.

And from my perspective it is not needed and better be removed.
Though it is a subject of different patch probably.

> 
> Since this is an example and reference code, hope developer can reuse it smoothly. If they didn't notice ol_flags not be copied because
> ol_flags is not changed in this example, they may take some time to debug their application.

For that scenario it is not needed.
Surely when user linking two packets manually (as we are doing here) it is his responsibility to update the mbuf fileds properly.
I think this is obvious thing and probably already mentioned in the docs.
Konstantin

> 
> This is a tiny change to the patch, I hope it cloud be done.
> 
> Thanks,
> Dong
> 
> -----Original Message-----
> From: Ananyev, Konstantin
> Sent: Wednesday, November 14, 2018 18:18
> To: Wang, Dong1 <dong1.wang@intel.com>; Lipiec, Herakliusz <herakliusz.lipiec@intel.com>; dev@dpdk.org
> Cc: thomas@monjalon.net; Burakov, Anatoly <anatoly.burakov@intel.com>; stable@dpdk.org
> Subject: RE: [PATCH v2] example/ipv4_multicast: fix app hanging when using clone
> 
> 
> >
> > Hi Konstantin,
> >
> > In this example, no flags be set by user, so no need to copy flags from original  mbuf.
> 
> Then why to bother?
> 
> > I'm thinking about some DPDK developers may create their own
> > application based on this example,  they add some flags before packet be cloned.
> 
> Hmm you receive a packet change l2 header and transmit it.
> What flags you might need to copy from original header considering that only RX flags would be set at present moment?
> If you let say want to insert vlan tag (or so), then you'll have to set new TX flags.
> Again, for timestamp you'll need to copy the timestamp value too, which we don't support in that example.
> Konstantin
> 
> >
> > Regards,
> > Dong
> >
> > -----Original Message-----
> > From: Ananyev, Konstantin
> > Sent: Wednesday, November 14, 2018 17:03
> > To: Wang, Dong1 <dong1.wang@intel.com>; Lipiec, Herakliusz
> > <herakliusz.lipiec@intel.com>; dev@dpdk.org
> > Cc: thomas@monjalon.net; Burakov, Anatoly <anatoly.burakov@intel.com>;
> > stable@dpdk.org
> > Subject: RE: [PATCH v2] example/ipv4_multicast: fix app hanging when
> > using clone
> >
> > Hi Dong,
> >
> > > Hi Herakliusz,
> > >
> > > Since pkt->ol_flags might set some other bits except
> > > IND_ATTACHED_MBUF, how about set its value to original pkt->ol_flag
> >
> > It could be done, but not sure what is the point?
> > Which flags you think we need to copy from cloned mbuf (segment #2) to new header?
> > Konstantin
> >
> > >
> > > Regards,
> > > Dong
> > >
> > > -----Original Message-----
> > > From: Lipiec, Herakliusz
> > > Sent: Tuesday, November 13, 2018 19:49
> > > To: dev@dpdk.org
> > > Cc: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Wang, Dong1
> > > <dong1.wang@intel.com>; thomas@monjalon.net; Burakov, Anatoly
> > > <anatoly.burakov@intel.com>; Lipiec, Herakliusz
> > > <herakliusz.lipiec@intel.com>; stable@dpdk.org
> > > Subject: [PATCH v2] example/ipv4_multicast: fix app hanging when
> > > using clone
> > >
> > > The ipv4_multicast sample application was dropping packets when
> > > using mbuf clone. When creating an L2 header and copying metadata
> > > from the source packet, the ol_flags were also copied along with all
> > > the other metadata. Because the cloned packet had IND_ATTACHED_MBUF
> > flag set in its ol_flags, this caused the packets to never be freed when using rte_pktmbuf_free.
> > > Since copying ol_flags from the cloned packet is not necessary in the first place, just don't do it.
> > >
> > > Fixes: af75078fece3 ("first public release")
> > > CC: stable@dpdk.org
> > >
> > > Reported-by: Wang Dong <dong1.wang@intel.com>
> > > Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
> > > ---
> > >  doc/guides/sample_app_ug/ipv4_multicast.rst | 1 -
> > >  examples/ipv4_multicast/main.c              | 2 --
> > >  2 files changed, 3 deletions(-)
> > >
> > > diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst
> > > b/doc/guides/sample_app_ug/ipv4_multicast.rst
> > > index ce1474ec7..f6efa7f6f 100644
> > > --- a/doc/guides/sample_app_ug/ipv4_multicast.rst
> > > +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst
> > > @@ -319,7 +319,6 @@ It is the mcast_out_pkt() function that performs the packet duplication (either
> > >          hdr->pkt.in_port = pkt->pkt.in_port;
> > >          hdr->pkt.vlan_macip = pkt->pkt.vlan_macip;
> > >          hdr->pkt.hash = pkt->pkt.hash;
> > > -        hdr->ol_flags = pkt->ol_flags;
> > >          rte_mbuf_sanity_check(hdr, RTE_MBUF_PKT, 1);
> > >
> > >          return hdr;
> > > diff --git a/examples/ipv4_multicast/main.c
> > > b/examples/ipv4_multicast/main.c index 4073a4907..428ca4694 100644
> > > --- a/examples/ipv4_multicast/main.c
> > > +++ b/examples/ipv4_multicast/main.c
> > > @@ -266,8 +266,6 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone)
> > >  	hdr->tx_offload = pkt->tx_offload;
> > >  	hdr->hash = pkt->hash;
> > >
> > > -	hdr->ol_flags = pkt->ol_flags;
> > > -
> > >  	__rte_mbuf_sanity_check(hdr, 1);
> > >  	return hdr;
> > >  }
> > > --
> > > 2.17.1

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

* Re: [dpdk-dev] [PATCH v2] example/ipv4_multicast: fix app hanging when using clone
  2018-11-14 11:19             ` Ananyev, Konstantin
@ 2018-11-14 11:32               ` Wang, Dong1
  2018-11-20  5:40               ` Zhao1, Wei
  1 sibling, 0 replies; 20+ messages in thread
From: Wang, Dong1 @ 2018-11-14 11:32 UTC (permalink / raw)
  To: Ananyev, Konstantin, Lipiec, Herakliusz, dev
  Cc: thomas, Burakov, Anatoly, stable

OK, understand now.

Thanks,
Dong

-----Original Message-----
From: Ananyev, Konstantin 
Sent: Wednesday, November 14, 2018 19:19
To: Wang, Dong1 <dong1.wang@intel.com>; Lipiec, Herakliusz <herakliusz.lipiec@intel.com>; dev@dpdk.org
Cc: thomas@monjalon.net; Burakov, Anatoly <anatoly.burakov@intel.com>; stable@dpdk.org
Subject: RE: [PATCH v2] example/ipv4_multicast: fix app hanging when using clone



> -----Original Message-----
> From: Wang, Dong1
> Sent: Wednesday, November 14, 2018 11:06 AM
> To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Lipiec, 
> Herakliusz <herakliusz.lipiec@intel.com>; dev@dpdk.org
> Cc: thomas@monjalon.net; Burakov, Anatoly <anatoly.burakov@intel.com>; 
> stable@dpdk.org
> Subject: RE: [PATCH v2] example/ipv4_multicast: fix app hanging when 
> using clone
> 
> Hi Konstantin & Herakliusz,
> 
> In mcast_out_pkt(), new header added and to be the first segment. Driver will check first segment's ol_flags when sending mbuf.

It will check for *TX* flags.
TX flags are not set in cloned mbuf (only RX ones).

> So why new first segment didn't inherit old one's ol_flags? 

Because they are RX flags and they don't' really belong to new packet we are going to send.
Also, as that bug shows it is error prone.

> This function already copied other mbuf fields from old one.

And from my perspective it is not needed and better be removed.
Though it is a subject of different patch probably.

> 
> Since this is an example and reference code, hope developer can reuse 
> it smoothly. If they didn't notice ol_flags not be copied because ol_flags is not changed in this example, they may take some time to debug their application.

For that scenario it is not needed.
Surely when user linking two packets manually (as we are doing here) it is his responsibility to update the mbuf fileds properly.
I think this is obvious thing and probably already mentioned in the docs.
Konstantin

> 
> This is a tiny change to the patch, I hope it cloud be done.
> 
> Thanks,
> Dong
> 
> -----Original Message-----
> From: Ananyev, Konstantin
> Sent: Wednesday, November 14, 2018 18:18
> To: Wang, Dong1 <dong1.wang@intel.com>; Lipiec, Herakliusz 
> <herakliusz.lipiec@intel.com>; dev@dpdk.org
> Cc: thomas@monjalon.net; Burakov, Anatoly <anatoly.burakov@intel.com>; 
> stable@dpdk.org
> Subject: RE: [PATCH v2] example/ipv4_multicast: fix app hanging when 
> using clone
> 
> 
> >
> > Hi Konstantin,
> >
> > In this example, no flags be set by user, so no need to copy flags from original  mbuf.
> 
> Then why to bother?
> 
> > I'm thinking about some DPDK developers may create their own 
> > application based on this example,  they add some flags before packet be cloned.
> 
> Hmm you receive a packet change l2 header and transmit it.
> What flags you might need to copy from original header considering that only RX flags would be set at present moment?
> If you let say want to insert vlan tag (or so), then you'll have to set new TX flags.
> Again, for timestamp you'll need to copy the timestamp value too, which we don't support in that example.
> Konstantin
> 
> >
> > Regards,
> > Dong
> >
> > -----Original Message-----
> > From: Ananyev, Konstantin
> > Sent: Wednesday, November 14, 2018 17:03
> > To: Wang, Dong1 <dong1.wang@intel.com>; Lipiec, Herakliusz 
> > <herakliusz.lipiec@intel.com>; dev@dpdk.org
> > Cc: thomas@monjalon.net; Burakov, Anatoly 
> > <anatoly.burakov@intel.com>; stable@dpdk.org
> > Subject: RE: [PATCH v2] example/ipv4_multicast: fix app hanging when 
> > using clone
> >
> > Hi Dong,
> >
> > > Hi Herakliusz,
> > >
> > > Since pkt->ol_flags might set some other bits except 
> > > IND_ATTACHED_MBUF, how about set its value to original 
> > > pkt->ol_flag
> >
> > It could be done, but not sure what is the point?
> > Which flags you think we need to copy from cloned mbuf (segment #2) to new header?
> > Konstantin
> >
> > >
> > > Regards,
> > > Dong
> > >
> > > -----Original Message-----
> > > From: Lipiec, Herakliusz
> > > Sent: Tuesday, November 13, 2018 19:49
> > > To: dev@dpdk.org
> > > Cc: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Wang, 
> > > Dong1 <dong1.wang@intel.com>; thomas@monjalon.net; Burakov, 
> > > Anatoly <anatoly.burakov@intel.com>; Lipiec, Herakliusz 
> > > <herakliusz.lipiec@intel.com>; stable@dpdk.org
> > > Subject: [PATCH v2] example/ipv4_multicast: fix app hanging when 
> > > using clone
> > >
> > > The ipv4_multicast sample application was dropping packets when 
> > > using mbuf clone. When creating an L2 header and copying metadata 
> > > from the source packet, the ol_flags were also copied along with 
> > > all the other metadata. Because the cloned packet had 
> > > IND_ATTACHED_MBUF
> > flag set in its ol_flags, this caused the packets to never be freed when using rte_pktmbuf_free.
> > > Since copying ol_flags from the cloned packet is not necessary in the first place, just don't do it.
> > >
> > > Fixes: af75078fece3 ("first public release")
> > > CC: stable@dpdk.org
> > >
> > > Reported-by: Wang Dong <dong1.wang@intel.com>
> > > Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
> > > ---
> > >  doc/guides/sample_app_ug/ipv4_multicast.rst | 1 -
> > >  examples/ipv4_multicast/main.c              | 2 --
> > >  2 files changed, 3 deletions(-)
> > >
> > > diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst
> > > b/doc/guides/sample_app_ug/ipv4_multicast.rst
> > > index ce1474ec7..f6efa7f6f 100644
> > > --- a/doc/guides/sample_app_ug/ipv4_multicast.rst
> > > +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst
> > > @@ -319,7 +319,6 @@ It is the mcast_out_pkt() function that performs the packet duplication (either
> > >          hdr->pkt.in_port = pkt->pkt.in_port;
> > >          hdr->pkt.vlan_macip = pkt->pkt.vlan_macip;
> > >          hdr->pkt.hash = pkt->pkt.hash;
> > > -        hdr->ol_flags = pkt->ol_flags;
> > >          rte_mbuf_sanity_check(hdr, RTE_MBUF_PKT, 1);
> > >
> > >          return hdr;
> > > diff --git a/examples/ipv4_multicast/main.c 
> > > b/examples/ipv4_multicast/main.c index 4073a4907..428ca4694 100644
> > > --- a/examples/ipv4_multicast/main.c
> > > +++ b/examples/ipv4_multicast/main.c
> > > @@ -266,8 +266,6 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone)
> > >  	hdr->tx_offload = pkt->tx_offload;
> > >  	hdr->hash = pkt->hash;
> > >
> > > -	hdr->ol_flags = pkt->ol_flags;
> > > -
> > >  	__rte_mbuf_sanity_check(hdr, 1);
> > >  	return hdr;
> > >  }
> > > --
> > > 2.17.1

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

* Re: [dpdk-dev] [PATCH v2] example/ipv4_multicast: fix app hanging when using clone
  2018-11-13 11:51   ` Ananyev, Konstantin
@ 2018-11-14 11:33     ` Wang, Dong1
  2018-11-18 21:56       ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
  0 siblings, 1 reply; 20+ messages in thread
From: Wang, Dong1 @ 2018-11-14 11:33 UTC (permalink / raw)
  To: Ananyev, Konstantin, Lipiec, Herakliusz, dev
  Cc: thomas, Burakov, Anatoly, stable

Acked-by: Wang Dong <dong1.wang@intel.com>

-----Original Message-----
From: Ananyev, Konstantin 
Sent: Tuesday, November 13, 2018 19:52
To: Lipiec, Herakliusz <herakliusz.lipiec@intel.com>; dev@dpdk.org
Cc: Wang, Dong1 <dong1.wang@intel.com>; thomas@monjalon.net; Burakov, Anatoly <anatoly.burakov@intel.com>; stable@dpdk.org
Subject: RE: [PATCH v2] example/ipv4_multicast: fix app hanging when using clone


> -----Original Message-----
> From: Lipiec, Herakliusz
> Sent: Tuesday, November 13, 2018 11:49 AM
> To: dev@dpdk.org
> Cc: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Wang, Dong1 
> <dong1.wang@intel.com>; thomas@monjalon.net; Burakov, Anatoly 
> <anatoly.burakov@intel.com>; Lipiec, Herakliusz 
> <herakliusz.lipiec@intel.com>; stable@dpdk.org
> Subject: [PATCH v2] example/ipv4_multicast: fix app hanging when using 
> clone
> 
> The ipv4_multicast sample application was dropping packets when using 
> mbuf clone. When creating an L2 header and copying metadata from the 
> source packet, the ol_flags were also copied along with all the other 
> metadata. Because the cloned packet had IND_ATTACHED_MBUF flag set in 
> its ol_flags, this caused the packets to never be freed when using 
> rte_pktmbuf_free.
> Since copying ol_flags from the cloned packet is not necessary in the 
> first place, just don't do it.
> 
> Fixes: af75078fece3 ("first public release")
> CC: stable@dpdk.org
> 
> Reported-by: Wang Dong <dong1.wang@intel.com>
> Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
> ---

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

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

* Re: [dpdk-dev] [dpdk-stable] [PATCH v2] example/ipv4_multicast: fix app hanging when using clone
  2018-11-14 11:33     ` Wang, Dong1
@ 2018-11-18 21:56       ` Thomas Monjalon
  0 siblings, 0 replies; 20+ messages in thread
From: Thomas Monjalon @ 2018-11-18 21:56 UTC (permalink / raw)
  To: Lipiec, Herakliusz
  Cc: stable, Wang, Dong1, Ananyev, Konstantin, dev, Burakov, Anatoly

> > The ipv4_multicast sample application was dropping packets when using 
> > mbuf clone. When creating an L2 header and copying metadata from the 
> > source packet, the ol_flags were also copied along with all the other 
> > metadata. Because the cloned packet had IND_ATTACHED_MBUF flag set in 
> > its ol_flags, this caused the packets to never be freed when using 
> > rte_pktmbuf_free.
> > Since copying ol_flags from the cloned packet is not necessary in the 
> > first place, just don't do it.
> > 
> > Fixes: af75078fece3 ("first public release")
> > CC: stable@dpdk.org
> > 
> > Reported-by: Wang Dong <dong1.wang@intel.com>
> > Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
> 
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> Acked-by: Wang Dong <dong1.wang@intel.com>

Applied, thanks

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

* Re: [dpdk-dev] [PATCH v2] example/ipv4_multicast: fix app hanging when using clone
  2018-11-14 11:19             ` Ananyev, Konstantin
  2018-11-14 11:32               ` Wang, Dong1
@ 2018-11-20  5:40               ` Zhao1, Wei
  2018-11-20  9:52                 ` Ananyev, Konstantin
  1 sibling, 1 reply; 20+ messages in thread
From: Zhao1, Wei @ 2018-11-20  5:40 UTC (permalink / raw)
  To: Ananyev, Konstantin, Wang, Dong1, Lipiec, Herakliusz, dev
  Cc: thomas, Burakov, Anatoly, stable

Hi, Konstantin

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ananyev,
> Konstantin
> Sent: Wednesday, November 14, 2018 7:19 PM
> To: Wang, Dong1 <dong1.wang@intel.com>; Lipiec, Herakliusz
> <herakliusz.lipiec@intel.com>; dev@dpdk.org
> Cc: thomas@monjalon.net; Burakov, Anatoly <anatoly.burakov@intel.com>;
> stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2] example/ipv4_multicast: fix app hanging
> when using clone
> 
> 
> 
> > -----Original Message-----
> > From: Wang, Dong1
> > Sent: Wednesday, November 14, 2018 11:06 AM
> > To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Lipiec,
> > Herakliusz <herakliusz.lipiec@intel.com>; dev@dpdk.org
> > Cc: thomas@monjalon.net; Burakov, Anatoly
> <anatoly.burakov@intel.com>;
> > stable@dpdk.org
> > Subject: RE: [PATCH v2] example/ipv4_multicast: fix app hanging when
> > using clone
> >
> > Hi Konstantin & Herakliusz,
> >
> > In mcast_out_pkt(), new header added and to be the first segment. Driver
> will check first segment's ol_flags when sending mbuf.
> 
> It will check for *TX* flags.
> TX flags are not set in cloned mbuf (only RX ones).
> 
> > So why new first segment didn't inherit old one's ol_flags?
> 
> Because they are RX flags and they don't' really belong to new packet we are
> going to send.
> Also, as that bug shows it is error prone.
> 
> > This function already copied other mbuf fields from old one.
> 
> And from my perspective it is not needed and better be removed.
> Though it is a subject of different patch probably.

In the code , function mcast_out_pkt() has the following code,

	/* copy metadata from source packet*/
	hdr->port = pkt->port;
	hdr->vlan_tci = pkt->vlan_tci;
	hdr->vlan_tci_outer = pkt->vlan_tci_outer;
	hdr->tx_offload = pkt->tx_offload;
	hdr->hash = pkt->hash;

all these are useless , is that right?
I will commit a patch to delete them later.



> 
> >
> > Since this is an example and reference code, hope developer can reuse
> > it smoothly. If they didn't notice ol_flags not be copied because ol_flags is
> not changed in this example, they may take some time to debug their
> application.
> 
> For that scenario it is not needed.
> Surely when user linking two packets manually (as we are doing here) it is his
> responsibility to update the mbuf fileds properly.
> I think this is obvious thing and probably already mentioned in the docs.
> Konstantin
> 
> >
> > This is a tiny change to the patch, I hope it cloud be done.
> >
> > Thanks,
> > Dong
> >
> > -----Original Message-----
> > From: Ananyev, Konstantin
> > Sent: Wednesday, November 14, 2018 18:18
> > To: Wang, Dong1 <dong1.wang@intel.com>; Lipiec, Herakliusz
> > <herakliusz.lipiec@intel.com>; dev@dpdk.org
> > Cc: thomas@monjalon.net; Burakov, Anatoly
> <anatoly.burakov@intel.com>;
> > stable@dpdk.org
> > Subject: RE: [PATCH v2] example/ipv4_multicast: fix app hanging when
> > using clone
> >
> >
> > >
> > > Hi Konstantin,
> > >
> > > In this example, no flags be set by user, so no need to copy flags from
> original  mbuf.
> >
> > Then why to bother?
> >
> > > I'm thinking about some DPDK developers may create their own
> > > application based on this example,  they add some flags before packet be
> cloned.
> >
> > Hmm you receive a packet change l2 header and transmit it.
> > What flags you might need to copy from original header considering that
> only RX flags would be set at present moment?
> > If you let say want to insert vlan tag (or so), then you'll have to set new TX
> flags.
> > Again, for timestamp you'll need to copy the timestamp value too, which
> we don't support in that example.
> > Konstantin
> >
> > >
> > > Regards,
> > > Dong
> > >
> > > -----Original Message-----
> > > From: Ananyev, Konstantin
> > > Sent: Wednesday, November 14, 2018 17:03
> > > To: Wang, Dong1 <dong1.wang@intel.com>; Lipiec, Herakliusz
> > > <herakliusz.lipiec@intel.com>; dev@dpdk.org
> > > Cc: thomas@monjalon.net; Burakov, Anatoly
> > > <anatoly.burakov@intel.com>; stable@dpdk.org
> > > Subject: RE: [PATCH v2] example/ipv4_multicast: fix app hanging when
> > > using clone
> > >
> > > Hi Dong,
> > >
> > > > Hi Herakliusz,
> > > >
> > > > Since pkt->ol_flags might set some other bits except
> > > > IND_ATTACHED_MBUF, how about set its value to original
> > > > pkt->ol_flag
> > >
> > > It could be done, but not sure what is the point?
> > > Which flags you think we need to copy from cloned mbuf (segment #2) to
> new header?
> > > Konstantin
> > >
> > > >
> > > > Regards,
> > > > Dong
> > > >
> > > > -----Original Message-----
> > > > From: Lipiec, Herakliusz
> > > > Sent: Tuesday, November 13, 2018 19:49
> > > > To: dev@dpdk.org
> > > > Cc: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Wang,
> > > > Dong1 <dong1.wang@intel.com>; thomas@monjalon.net; Burakov,
> > > > Anatoly <anatoly.burakov@intel.com>; Lipiec, Herakliusz
> > > > <herakliusz.lipiec@intel.com>; stable@dpdk.org
> > > > Subject: [PATCH v2] example/ipv4_multicast: fix app hanging when
> > > > using clone
> > > >
> > > > The ipv4_multicast sample application was dropping packets when
> > > > using mbuf clone. When creating an L2 header and copying metadata
> > > > from the source packet, the ol_flags were also copied along with
> > > > all the other metadata. Because the cloned packet had
> > > > IND_ATTACHED_MBUF
> > > flag set in its ol_flags, this caused the packets to never be freed when
> using rte_pktmbuf_free.
> > > > Since copying ol_flags from the cloned packet is not necessary in the
> first place, just don't do it.
> > > >
> > > > Fixes: af75078fece3 ("first public release")
> > > > CC: stable@dpdk.org
> > > >
> > > > Reported-by: Wang Dong <dong1.wang@intel.com>
> > > > Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
> > > > ---
> > > >  doc/guides/sample_app_ug/ipv4_multicast.rst | 1 -
> > > >  examples/ipv4_multicast/main.c              | 2 --
> > > >  2 files changed, 3 deletions(-)
> > > >
> > > > diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst
> > > > b/doc/guides/sample_app_ug/ipv4_multicast.rst
> > > > index ce1474ec7..f6efa7f6f 100644
> > > > --- a/doc/guides/sample_app_ug/ipv4_multicast.rst
> > > > +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst
> > > > @@ -319,7 +319,6 @@ It is the mcast_out_pkt() function that performs
> the packet duplication (either
> > > >          hdr->pkt.in_port = pkt->pkt.in_port;
> > > >          hdr->pkt.vlan_macip = pkt->pkt.vlan_macip;
> > > >          hdr->pkt.hash = pkt->pkt.hash;
> > > > -        hdr->ol_flags = pkt->ol_flags;
> > > >          rte_mbuf_sanity_check(hdr, RTE_MBUF_PKT, 1);
> > > >
> > > >          return hdr;
> > > > diff --git a/examples/ipv4_multicast/main.c
> > > > b/examples/ipv4_multicast/main.c index 4073a4907..428ca4694 100644
> > > > --- a/examples/ipv4_multicast/main.c
> > > > +++ b/examples/ipv4_multicast/main.c
> > > > @@ -266,8 +266,6 @@ mcast_out_pkt(struct rte_mbuf *pkt, int
> use_clone)
> > > >  	hdr->tx_offload = pkt->tx_offload;
> > > >  	hdr->hash = pkt->hash;
> > > >
> > > > -	hdr->ol_flags = pkt->ol_flags;
> > > > -
> > > >  	__rte_mbuf_sanity_check(hdr, 1);
> > > >  	return hdr;
> > > >  }
> > > > --
> > > > 2.17.1

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

* Re: [dpdk-dev] [PATCH v2] example/ipv4_multicast: fix app hanging when using clone
  2018-11-20  5:40               ` Zhao1, Wei
@ 2018-11-20  9:52                 ` Ananyev, Konstantin
  0 siblings, 0 replies; 20+ messages in thread
From: Ananyev, Konstantin @ 2018-11-20  9:52 UTC (permalink / raw)
  To: Zhao1, Wei, Wang, Dong1, Lipiec, Herakliusz, dev
  Cc: thomas, Burakov, Anatoly, stable

Hi Wei,

> -----Original Message-----
> From: Zhao1, Wei
> Sent: Tuesday, November 20, 2018 5:40 AM
> To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Wang, Dong1 <dong1.wang@intel.com>; Lipiec, Herakliusz
> <herakliusz.lipiec@intel.com>; dev@dpdk.org
> Cc: thomas@monjalon.net; Burakov, Anatoly <anatoly.burakov@intel.com>; stable@dpdk.org
> Subject: RE: [PATCH v2] example/ipv4_multicast: fix app hanging when using clone
> 
> Hi, Konstantin
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ananyev,
> > Konstantin
> > Sent: Wednesday, November 14, 2018 7:19 PM
> > To: Wang, Dong1 <dong1.wang@intel.com>; Lipiec, Herakliusz
> > <herakliusz.lipiec@intel.com>; dev@dpdk.org
> > Cc: thomas@monjalon.net; Burakov, Anatoly <anatoly.burakov@intel.com>;
> > stable@dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH v2] example/ipv4_multicast: fix app hanging
> > when using clone
> >
> >
> >
> > > -----Original Message-----
> > > From: Wang, Dong1
> > > Sent: Wednesday, November 14, 2018 11:06 AM
> > > To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Lipiec,
> > > Herakliusz <herakliusz.lipiec@intel.com>; dev@dpdk.org
> > > Cc: thomas@monjalon.net; Burakov, Anatoly
> > <anatoly.burakov@intel.com>;
> > > stable@dpdk.org
> > > Subject: RE: [PATCH v2] example/ipv4_multicast: fix app hanging when
> > > using clone
> > >
> > > Hi Konstantin & Herakliusz,
> > >
> > > In mcast_out_pkt(), new header added and to be the first segment. Driver
> > will check first segment's ol_flags when sending mbuf.
> >
> > It will check for *TX* flags.
> > TX flags are not set in cloned mbuf (only RX ones).
> >
> > > So why new first segment didn't inherit old one's ol_flags?
> >
> > Because they are RX flags and they don't' really belong to new packet we are
> > going to send.
> > Also, as that bug shows it is error prone.
> >
> > > This function already copied other mbuf fields from old one.
> >
> > And from my perspective it is not needed and better be removed.
> > Though it is a subject of different patch probably.
> 
> In the code , function mcast_out_pkt() has the following code,
> 
> 	/* copy metadata from source packet*/
> 	hdr->port = pkt->port;
> 	hdr->vlan_tci = pkt->vlan_tci;
> 	hdr->vlan_tci_outer = pkt->vlan_tci_outer;
> 	hdr->tx_offload = pkt->tx_offload;
> 	hdr->hash = pkt->hash;
> 
> all these are useless , is that right?

Yes, I think  so.

> I will commit a patch to delete them later.

Sounds good to me.
Konstantin

> 
> 
> 
> >
> > >
> > > Since this is an example and reference code, hope developer can reuse
> > > it smoothly. If they didn't notice ol_flags not be copied because ol_flags is
> > not changed in this example, they may take some time to debug their
> > application.
> >
> > For that scenario it is not needed.
> > Surely when user linking two packets manually (as we are doing here) it is his
> > responsibility to update the mbuf fileds properly.
> > I think this is obvious thing and probably already mentioned in the docs.
> > Konstantin
> >
> > >
> > > This is a tiny change to the patch, I hope it cloud be done.
> > >
> > > Thanks,
> > > Dong
> > >
> > > -----Original Message-----
> > > From: Ananyev, Konstantin
> > > Sent: Wednesday, November 14, 2018 18:18
> > > To: Wang, Dong1 <dong1.wang@intel.com>; Lipiec, Herakliusz
> > > <herakliusz.lipiec@intel.com>; dev@dpdk.org
> > > Cc: thomas@monjalon.net; Burakov, Anatoly
> > <anatoly.burakov@intel.com>;
> > > stable@dpdk.org
> > > Subject: RE: [PATCH v2] example/ipv4_multicast: fix app hanging when
> > > using clone
> > >
> > >
> > > >
> > > > Hi Konstantin,
> > > >
> > > > In this example, no flags be set by user, so no need to copy flags from
> > original  mbuf.
> > >
> > > Then why to bother?
> > >
> > > > I'm thinking about some DPDK developers may create their own
> > > > application based on this example,  they add some flags before packet be
> > cloned.
> > >
> > > Hmm you receive a packet change l2 header and transmit it.
> > > What flags you might need to copy from original header considering that
> > only RX flags would be set at present moment?
> > > If you let say want to insert vlan tag (or so), then you'll have to set new TX
> > flags.
> > > Again, for timestamp you'll need to copy the timestamp value too, which
> > we don't support in that example.
> > > Konstantin
> > >
> > > >
> > > > Regards,
> > > > Dong
> > > >
> > > > -----Original Message-----
> > > > From: Ananyev, Konstantin
> > > > Sent: Wednesday, November 14, 2018 17:03
> > > > To: Wang, Dong1 <dong1.wang@intel.com>; Lipiec, Herakliusz
> > > > <herakliusz.lipiec@intel.com>; dev@dpdk.org
> > > > Cc: thomas@monjalon.net; Burakov, Anatoly
> > > > <anatoly.burakov@intel.com>; stable@dpdk.org
> > > > Subject: RE: [PATCH v2] example/ipv4_multicast: fix app hanging when
> > > > using clone
> > > >
> > > > Hi Dong,
> > > >
> > > > > Hi Herakliusz,
> > > > >
> > > > > Since pkt->ol_flags might set some other bits except
> > > > > IND_ATTACHED_MBUF, how about set its value to original
> > > > > pkt->ol_flag
> > > >
> > > > It could be done, but not sure what is the point?
> > > > Which flags you think we need to copy from cloned mbuf (segment #2) to
> > new header?
> > > > Konstantin
> > > >
> > > > >
> > > > > Regards,
> > > > > Dong
> > > > >
> > > > > -----Original Message-----
> > > > > From: Lipiec, Herakliusz
> > > > > Sent: Tuesday, November 13, 2018 19:49
> > > > > To: dev@dpdk.org
> > > > > Cc: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Wang,
> > > > > Dong1 <dong1.wang@intel.com>; thomas@monjalon.net; Burakov,
> > > > > Anatoly <anatoly.burakov@intel.com>; Lipiec, Herakliusz
> > > > > <herakliusz.lipiec@intel.com>; stable@dpdk.org
> > > > > Subject: [PATCH v2] example/ipv4_multicast: fix app hanging when
> > > > > using clone
> > > > >
> > > > > The ipv4_multicast sample application was dropping packets when
> > > > > using mbuf clone. When creating an L2 header and copying metadata
> > > > > from the source packet, the ol_flags were also copied along with
> > > > > all the other metadata. Because the cloned packet had
> > > > > IND_ATTACHED_MBUF
> > > > flag set in its ol_flags, this caused the packets to never be freed when
> > using rte_pktmbuf_free.
> > > > > Since copying ol_flags from the cloned packet is not necessary in the
> > first place, just don't do it.
> > > > >
> > > > > Fixes: af75078fece3 ("first public release")
> > > > > CC: stable@dpdk.org
> > > > >
> > > > > Reported-by: Wang Dong <dong1.wang@intel.com>
> > > > > Signed-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>
> > > > > ---
> > > > >  doc/guides/sample_app_ug/ipv4_multicast.rst | 1 -
> > > > >  examples/ipv4_multicast/main.c              | 2 --
> > > > >  2 files changed, 3 deletions(-)
> > > > >
> > > > > diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst
> > > > > b/doc/guides/sample_app_ug/ipv4_multicast.rst
> > > > > index ce1474ec7..f6efa7f6f 100644
> > > > > --- a/doc/guides/sample_app_ug/ipv4_multicast.rst
> > > > > +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst
> > > > > @@ -319,7 +319,6 @@ It is the mcast_out_pkt() function that performs
> > the packet duplication (either
> > > > >          hdr->pkt.in_port = pkt->pkt.in_port;
> > > > >          hdr->pkt.vlan_macip = pkt->pkt.vlan_macip;
> > > > >          hdr->pkt.hash = pkt->pkt.hash;
> > > > > -        hdr->ol_flags = pkt->ol_flags;
> > > > >          rte_mbuf_sanity_check(hdr, RTE_MBUF_PKT, 1);
> > > > >
> > > > >          return hdr;
> > > > > diff --git a/examples/ipv4_multicast/main.c
> > > > > b/examples/ipv4_multicast/main.c index 4073a4907..428ca4694 100644
> > > > > --- a/examples/ipv4_multicast/main.c
> > > > > +++ b/examples/ipv4_multicast/main.c
> > > > > @@ -266,8 +266,6 @@ mcast_out_pkt(struct rte_mbuf *pkt, int
> > use_clone)
> > > > >  	hdr->tx_offload = pkt->tx_offload;
> > > > >  	hdr->hash = pkt->hash;
> > > > >
> > > > > -	hdr->ol_flags = pkt->ol_flags;
> > > > > -
> > > > >  	__rte_mbuf_sanity_check(hdr, 1);
> > > > >  	return hdr;
> > > > >  }
> > > > > --
> > > > > 2.17.1

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

end of thread, other threads:[~2018-11-20  9:52 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-12 20:46 [dpdk-dev] [PATCH] example/ipv4_multicast: fix app hanging when using clone Herakliusz Lipiec
2018-11-12 22:44 ` Ananyev, Konstantin
2018-11-13  9:25 ` Thomas Monjalon
2018-11-13  9:47   ` Ananyev, Konstantin
2018-11-13 10:21 ` Burakov, Anatoly
2018-11-13 10:28   ` Ananyev, Konstantin
2018-11-13 11:49 ` [dpdk-dev] [PATCH v2] " Herakliusz Lipiec
2018-11-13 11:51   ` Ananyev, Konstantin
2018-11-14 11:33     ` Wang, Dong1
2018-11-18 21:56       ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2018-11-14  2:28   ` [dpdk-dev] " Wang, Dong1
2018-11-14  9:02     ` Ananyev, Konstantin
2018-11-14 10:09       ` Wang, Dong1
2018-11-14 10:17         ` Ananyev, Konstantin
2018-11-14 11:06           ` Wang, Dong1
2018-11-14 11:19             ` Ananyev, Konstantin
2018-11-14 11:32               ` Wang, Dong1
2018-11-20  5:40               ` Zhao1, Wei
2018-11-20  9:52                 ` Ananyev, Konstantin
2018-11-14 10:21         ` Lipiec, Herakliusz

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