From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 95EDF9E5 for ; Thu, 29 Oct 2015 09:37:52 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 29 Oct 2015 01:37:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,213,1444719600"; d="scan'208";a="674149288" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga003.jf.intel.com with ESMTP; 29 Oct 2015 01:37:51 -0700 Received: from fmsmsx120.amr.corp.intel.com (10.18.124.208) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 29 Oct 2015 01:37:50 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx120.amr.corp.intel.com (10.18.124.208) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 29 Oct 2015 01:37:50 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.253]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.194]) with mapi id 14.03.0248.002; Thu, 29 Oct 2015 16:37:48 +0800 From: "Chen, Jing D" To: "Liang, Cunming" , "dev@dpdk.org" Thread-Topic: [PATCH v3 04/16] fm10k: add func to re-allocate mbuf for RX ring Thread-Index: AQHREJx7680eaMM7gUWaoG2lTNJ/+Z6AaiMAgAGFNkD//60VAIAAjF/w Date: Thu, 29 Oct 2015 08:37:47 +0000 Message-ID: <4341B239C0EFF9468EE453F9E9F4604D02AE66C7@shsmsx102.ccr.corp.intel.com> References: <1445507104-22563-2-git-send-email-jing.d.chen@intel.com> <1445939209-12783-1-git-send-email-jing.d.chen@intel.com> <1445939209-12783-5-git-send-email-jing.d.chen@intel.com> <5630D48A.9000809@intel.com> <4341B239C0EFF9468EE453F9E9F4604D02AE60F4@shsmsx102.ccr.corp.intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v3 04/16] fm10k: add func to re-allocate mbuf for RX ring 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 Oct 2015 08:37:53 -0000 Hi, Steve, Best Regards, Mark > -----Original Message----- > From: Liang, Cunming > Sent: Thursday, October 29, 2015 4:15 PM > To: Chen, Jing D; dev@dpdk.org > Cc: Tao, Zhe; He, Shaopeng; Ananyev, Konstantin; Richardson, Bruce > Subject: RE: [PATCH v3 04/16] fm10k: add func to re-allocate mbuf for RX = ring >=20 > Hi Mark=1B$B!$=1B(B >=20 >=20 > > -----Original Message----- > > From: Chen, Jing D > > Sent: Thursday, October 29, 2015 1:24 PM > > To: Liang, Cunming; dev@dpdk.org > > Cc: Tao, Zhe; He, Shaopeng; Ananyev, Konstantin; Richardson, Bruce > > Subject: RE: [PATCH v3 04/16] fm10k: add func to re-allocate mbuf for R= X > ring > > > > Hi, Steve, > > > > Best Regards, > > Mark > > > > > > > -----Original Message----- > > > From: Liang, Cunming > > > Sent: Wednesday, October 28, 2015 9:59 PM > > > To: Chen, Jing D; dev@dpdk.org > > > Cc: Tao, Zhe; He, Shaopeng; Ananyev, Konstantin; Richardson, Bruce > > > Subject: Re: [PATCH v3 04/16] fm10k: add func to re-allocate mbuf for= RX > ring > > > > > > Hi Mark, > > > > > > On 10/27/2015 5:46 PM, Chen Jing D(Mark) wrote: > > > > From: "Chen Jing D(Mark)" > > > > > > > > Add function fm10k_rxq_rearm to re-allocate mbuf for used desc > > > > in RX HW ring. > > > > > > > > Signed-off-by: Chen Jing D(Mark) > > > > --- > > > > drivers/net/fm10k/fm10k.h | 9 ++++ > > > > drivers/net/fm10k/fm10k_ethdev.c | 3 + > > > > drivers/net/fm10k/fm10k_rxtx_vec.c | 90 > > > ++++++++++++++++++++++++++++++++++++ > > > > 3 files changed, 102 insertions(+), 0 deletions(-) > > > [...] > > > > +static inline void > > > > +fm10k_rxq_rearm(struct fm10k_rx_queue *rxq) > > > > +{ > > > > + int i; > > > > + uint16_t rx_id; > > > > + volatile union fm10k_rx_desc *rxdp; > > > > + struct rte_mbuf **mb_alloc =3D &rxq->sw_ring[rxq->rxrearm_start]; > > > > + struct rte_mbuf *mb0, *mb1; > > > > + __m128i head_off =3D _mm_set_epi64x( > > > > + RTE_PKTMBUF_HEADROOM + > > > FM10K_RX_DATABUF_ALIGN - 1, > > > > + RTE_PKTMBUF_HEADROOM + > > > FM10K_RX_DATABUF_ALIGN - 1); > > > > + __m128i dma_addr0, dma_addr1; > > > > + /* Rx buffer need to be aligned with 512 byte */ > > > > + const __m128i hba_msk =3D _mm_set_epi64x(0, > > > > + UINT64_MAX - FM10K_RX_DATABUF_ALIGN > > > + 1); > > > > + > > > > + rxdp =3D rxq->hw_ring + rxq->rxrearm_start; > > > > + > > > > + /* Pull 'n' more MBUFs into the software ring */ > > > > + if (rte_mempool_get_bulk(rxq->mp, > > > > + (void *)mb_alloc, > > > > + RTE_FM10K_RXQ_REARM_THRESH) < 0) { > > > Here's one potential issue when the failure happens. As tail won't > > > update, the head will equal to tail in the end. HW won't write back > > > anyway, however the SW recv_raw_pkts_vec only check DD bit, the old > > > 'dirty' descriptor(DD bit is not clean) will be taken and continue mo= ve > > > forward to check the next which even beyond the tail. I'm sorry didn'= t > > > catch it on the first time. /Steve > > > > I have a different view on this. In case mbuf allocation always failed = and tail > > equaled to head, > > then HW will stop to send new packet to HW ring, as you pointed out. Th= en, > > when > > Mbuf can be allocated, this function will refill HW ring and update tai= l. > We can't guarantee it successful to recover and allocates new mbuf before > the polling SW already move beyond the un-rearmed dirty entry. > So, HW Thanks! I got you. I'll change accordingly. > > will > > resume to fill packet to HW ring. Receive functions will continue to wo= rk. > The point is HW is pending on that moment, but polling receive function > won't wait, it just read next DD, but the value is 1 which hasn't cleared= . > > Anything I missed? > > > > > > + rte_eth_devices[rxq->port_id].data->rx_mbuf_alloc_failed > > > +=3D > > > > + RTE_FM10K_RXQ_REARM_THRESH; > > > > + return; > > > > + } > > > > + > > > > +