From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id A0F4D2E8F for ; Thu, 29 May 2014 15:33:06 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 29 May 2014 06:28:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.98,934,1392192000"; d="scan'208";a="519667461" Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by orsmga001.jf.intel.com with ESMTP; 29 May 2014 06:32:41 -0700 Received: from irsmsx153.ger.corp.intel.com (163.33.192.75) by IRSMSX103.ger.corp.intel.com (163.33.3.157) with Microsoft SMTP Server (TLS) id 14.3.123.3; Thu, 29 May 2014 14:32:40 +0100 Received: from irsmsx101.ger.corp.intel.com ([169.254.1.245]) by IRSMSX153.ger.corp.intel.com ([169.254.9.252]) with mapi id 14.03.0123.003; Thu, 29 May 2014 14:32:40 +0100 From: "Doherty, Declan" To: "Shaw, Jeffrey B" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 1/4] Link Bonding Library Thread-Index: AQHPeoP4jUHHTy5RJEe2201JZIjqu5tWJUEAgAFkbwA= Date: Thu, 29 May 2014 13:32:38 +0000 Message-ID: <345C63BAECC1AD42A2EC8C63AFFC3ADC13D34335@IRSMSX101.ger.corp.intel.com> References: <4d8e6bc2665fbaac641f0577714d7be9b0415d3c.1401287412.git.declan.doherty@intel.com> <4032A54B6BB5F04B8C08B6CFF08C59285543C357@FMSMSX103.amr.corp.intel.com> In-Reply-To: <4032A54B6BB5F04B8C08B6CFF08C59285543C357@FMSMSX103.amr.corp.intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH 1/4] Link Bonding Library X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 May 2014 13:33:07 -0000 > -----Original Message----- > From: Shaw, Jeffrey B > Sent: Wednesday, May 28, 2014 5:55 PM > To: Doherty, Declan; dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH 1/4] Link Bonding Library > = > Hi Declan, > I'm worried about one thing in "bond_ethdev_tx_broadcast()" related to > freeing of the broadcasted packets. > = > > +static uint16_t > > +bond_ethdev_tx_broadcast(void *queue, struct rte_mbuf **bufs, > > +uint16_t nb_pkts) { > > + struct bond_dev_private *internals; > > + struct bond_tx_queue *bd_tx_q; > > + > > + uint8_t num_of_slaves; > > + uint8_t slaves[RTE_MAX_ETHPORTS]; > > + > > + uint16_t num_tx_total =3D 0; > > + > > + int i; > > + > > + bd_tx_q =3D (struct bond_tx_queue *)queue; > > + internals =3D bd_tx_q->dev_private; > > + > > + /* Copy slave list to protect against slave up/down changes during tx > > + * bursting */ > > + num_of_slaves =3D internals->active_slave_count; > > + memcpy(slaves, internals->active_slaves, > > + sizeof(internals->active_slaves[0]) * num_of_slaves); > > + > > + if (num_of_slaves < 1) > > + return 0; > > + > > + > > + for (i =3D 0; i < num_of_slaves; i++) { > > + num_tx_total +=3D rte_eth_tx_burst(slaves[i], bd_tx_q- > >queue_id, > > + bufs, nb_pkts); > > + } > > + > > + return num_tx_total; > > +} > > + > = > Transmitting the same buffers on all slaves will cause problems when the = PMD > frees the mbufs for previously transmitted packets. > So if you broadcast 1 packet on 4 slaves, each of the 4 slaves will (even= tually) > have to free the same mbuf. Without updating the refcnt, you will end up > incorrectly freeing the same mbuf 3 extra times. > = > Your test application does not catch this case since the max packets that= are > tested is 320, which is less than the size of the Tx descriptor rings (51= 2). Try > testing with more packets and you should see some latent segmentation > faults. You should also see this with testpmd, if you try broadcasting e= nough > packets. > = > = > Thanks, > Jeff Hey Jeff, I'm not sure why I didn't see this in testing using on the test-p= md app, but it's obvious that this will cause issues. I'll add code to incr= ement the refcnt in each mbuf by (num_of_slaves -1) in the bond_ethdev_tx_b= roadcast() function and also add a unit test to validate this in the next v= ersion of the patch. Thanks, Declan -------------------------------------------------------------- Intel Shannon Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 Business address: Dromore House, East Park, Shannon, Co. Clare This e-mail and any attachments may contain confidential material for the s= ole use of the intended recipient(s). Any review or distribution by others = is strictly prohibited. If you are not the intended recipient, please conta= ct the sender and delete all copies.