[dpdk-dev] [PATCH] example/ipv4_multicast: fix app hanging when using clone

Ananyev, Konstantin konstantin.ananyev at intel.com
Tue Nov 13 10:47:48 CET 2018



> 
> 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 at 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;
> >  }
> 
> 



More information about the dev mailing list