From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Ananyev, Konstantin" Subject: Re: [PATCH] example/ipv4_multicast: fix app hanging when using clone Date: Tue, 13 Nov 2018 09:47:48 +0000 Message-ID: <2601191342CEEE43887BDE71AB977258010CE49B5D@IRSMSX106.ger.corp.intel.com> References: <20181112204650.7175-1-herakliusz.lipiec@intel.com> <4835654.xzScbSBJzk@xps> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" To: Thomas Monjalon , "Lipiec, Herakliusz" Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id A133A2B83 for ; Tue, 13 Nov 2018 10:47:51 +0100 (CET) In-Reply-To: <4835654.xzScbSBJzk@xps> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" >=20 > Hi, >=20 > 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=20 (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 cor= ruption, 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 >=20 > What is this IP? > What is clone? >=20 > > The problem was that mbufs were not freed. This was caused by coping > > ol_flags from cloned mbuf to header mbufs. >=20 > Mbuf is not freed because of ol_flags? > I feel this description should be improved. >=20 > > Signed-off-by: Herakliusz Lipiec > [...] > > --- 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 =3D pkt->tx_offload; > > hdr->hash =3D pkt->hash; > > > > - hdr->ol_flags =3D pkt->ol_flags; > > - > > __rte_mbuf_sanity_check(hdr, 1); > > return hdr; > > } >=20 >=20