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 3295758DA for ; Wed, 15 Oct 2014 05:06:24 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 14 Oct 2014 20:14:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,721,1406617200"; d="scan'208";a="614637252" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga002.fm.intel.com with ESMTP; 14 Oct 2014 20:14:02 -0700 Received: from fmsmsx101.amr.corp.intel.com (10.18.124.199) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.195.1; Tue, 14 Oct 2014 20:14:02 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx101.amr.corp.intel.com (10.18.124.199) with Microsoft SMTP Server (TLS) id 14.3.195.1; Tue, 14 Oct 2014 20:14:02 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.192]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.203]) with mapi id 14.03.0195.001; Wed, 15 Oct 2014 11:14:00 +0800 From: "Ouyang, Changchun" To: "Xie, Huawei" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v4] virtio: Fix vring entry number issue Thread-Index: AQHP58jw01WKlMMIkE+6cB82tbH/npwvQYSAgAE6w2A= Date: Wed, 15 Oct 2014 03:14:00 +0000 Message-ID: References: <1413299561-31263-1-git-send-email-changchun.ouyang@intel.com> <1413302634-848-1-git-send-email-changchun.ouyang@intel.com> In-Reply-To: Accept-Language: zh-CN, 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="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v4] virtio: Fix vring entry number issue 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: Wed, 15 Oct 2014 03:06:26 -0000 Hi Huawei, I have v5 patch for this comment. Thanks, Changchun > -----Original Message----- > From: Xie, Huawei > Sent: Wednesday, October 15, 2014 12:26 AM > To: Ouyang, Changchun; dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH v4] virtio: Fix vring entry number issue >=20 >=20 >=20 > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ouyang > Changchun > > Sent: Tuesday, October 14, 2014 9:04 AM > > To: dev@dpdk.org > > Subject: [dpdk-dev] [PATCH v4] virtio: Fix vring entry number issue > > > > Fix one issue in virtio TX: it needs one more vring descriptor to hol= d the > virtio > > header when transmitting packets, it is used later to determine wheth= er > to free > > more entries from used vring. > > It fixes failing to transmit any packet with 1 segment in the > > circumstance of only > > 1 descriptor in the vring free list. > > > > Signed-off-by: Changchun Ouyang > > Reviewed-by: Olivier Matz > > --- > > -V4 change: > > Relocate those changelog and annotation here. > > > > -V3 change: > > Resolve compilation issue due to mbuf re-structure. > > > > -V2 change: > > Refine description, 'vring descriptor' is more accurate than 'vring e= ntry'; > > Accordingly update test condition (it needs one more descriptor for > > virtio > > header) to > > put packets to transmit queue. > > > > -V1 change: > > Fix the vring descriptor issue in virtio TX, it needs one more vring > > descriptor to hold the > > virtio header. > > > > lib/librte_pmd_virtio/virtio_rxtx.c | 10 ++++++++-- > > 1 file changed, 8 insertions(+), 2 deletions(-) > > > > diff --git a/lib/librte_pmd_virtio/virtio_rxtx.c > > b/lib/librte_pmd_virtio/virtio_rxtx.c > > index 0b10108..ac44c65 100644 > > --- a/lib/librte_pmd_virtio/virtio_rxtx.c > > +++ b/lib/librte_pmd_virtio/virtio_rxtx.c > > @@ -699,7 +699,8 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf > > **tx_pkts, uint16_t nb_pkts) > > num =3D (uint16_t)(likely(nb_used < VIRTIO_MBUF_BURST_SZ) ? > nb_used : > > VIRTIO_MBUF_BURST_SZ); > > > > while (nb_tx < nb_pkts) { > > - int need =3D tx_pkts[nb_tx]->pkt.nb_segs - txvq->vq_free_cnt; > > + /* Need one more descriptor for virtio header. */ > > + int need =3D tx_pkts[nb_tx]->nb_segs - txvq->vq_free_cnt + 1; > > int deq_cnt =3D RTE_MIN(need, (int)num); > > > > num -=3D (deq_cnt > 0) ? deq_cnt : 0; @@ -708,7 +709,12 @@ > > virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t > > nb_pkts) > > deq_cnt--; > > } > > > > - if (tx_pkts[nb_tx]->pkt.nb_segs <=3D txvq->vq_free_cnt) { > > + need =3D (int)tx_pkts[nb_tx]->nb_segs - txvq->vq_free_cnt + > 1; > > + /* > > + * Zero or negative value indicates it has enough free > > + * decriptors to transmit. > > + */ > > + if (need <=3D 0) { > Could we put a branch hint to favor the fast path? > > txm =3D tx_pkts[nb_tx]; > > /* Enqueue Packet buffers */ > > error =3D virtqueue_enqueue_xmit(txvq, txm); > > -- > > 1.8.4.2