From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 34AC01B1D9; Sun, 11 Feb 2018 09:02:19 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Feb 2018 00:02:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,494,1511856000"; d="scan'208";a="29854205" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga001.fm.intel.com with ESMTP; 11 Feb 2018 00:02:18 -0800 Received: from fmsmsx102.amr.corp.intel.com (10.18.124.200) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 11 Feb 2018 00:02:18 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX102.amr.corp.intel.com (10.18.124.200) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 11 Feb 2018 00:02:17 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.124]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.130]) with mapi id 14.03.0319.002; Sun, 11 Feb 2018 16:02:15 +0800 From: "Yao, Lei A" To: Maxime Coquelin , "Bie, Tiwei" , "yliu@fridaylinux.org" , "Yigit, Ferruh" , "victork@redhat.com" , Thomas Monjalon CC: "dev@dpdk.org" , "stable@dpdk.org" , "Wang, Zhihong" , "Xu, Qian Q" Thread-Topic: [PATCH 1/2] virtio: fix resuming traffic with rx vector path Thread-Index: AQHTobIXxxlFgCM8tEeRDz5Dw0Sn8qOe104g Importance: high X-Priority: 1 Date: Sun, 11 Feb 2018 08:02:14 +0000 Message-ID: <2DBBFF226F7CF64BAFCA79B681719D953A36FC5B@shsmsx102.ccr.corp.intel.com> References: <20180209142654.29409-1-maxime.coquelin@redhat.com> <20180209142654.29409-2-maxime.coquelin@redhat.com> In-Reply-To: <20180209142654.29409-2-maxime.coquelin@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDkyMWJlZWYtZmY4MS00OTJjLTk1NTItYzViOThhMThhOTBjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6InZRa2ZwYThKdWNVQ1VEUmdzMVZJTHlVMUhoVDBjdU1YQ1V2SEcxZysxaFE9In0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action 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 1/2] virtio: fix resuming traffic with rx vector path X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 08:02:20 -0000 > -----Original Message----- > From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com] > Sent: Friday, February 9, 2018 10:27 PM > To: Bie, Tiwei ; yliu@fridaylinux.org; Yigit, Ferruh > ; victork@redhat.com > Cc: dev@dpdk.org; stable@dpdk.org; Wang, Zhihong > ; Xu, Qian Q ; Yao, Lei A > ; Maxime Coquelin > Subject: [PATCH 1/2] virtio: fix resuming traffic with rx vector path >=20 > This patch fixes traffic resuming issue seen when using > Rx vector path. >=20 > Fixes: efc83a1e7fc3 ("net/virtio: fix queue setup consistency") >=20 > Signed-off-by: Tiwei Bie > Signed-off-by: Maxime Coquelin Tested-by: Lei Yao This patch has been tested by regression test suite. It can fix the traffic= resume=20 issue with vector path. No performance drop during PVP test: Following test are also checked and passed: Vhost/virtio multi queue Virtio-user Virtio-user as exception path Vhost/virtio reconnect My server info: OS: Ubuntu 16.04 Kernel: 4.4.0-110 CPU: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz BR Lei > --- > drivers/net/virtio/virtio_rxtx.c | 34 ++++++++++++++++++---------= ------ > drivers/net/virtio/virtio_rxtx_simple.c | 2 +- > drivers/net/virtio/virtio_rxtx_simple.h | 2 +- > 3 files changed, 21 insertions(+), 17 deletions(-) >=20 > diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio= _rxtx.c > index 854af399e..505283edd 100644 > --- a/drivers/net/virtio/virtio_rxtx.c > +++ b/drivers/net/virtio/virtio_rxtx.c > @@ -30,6 +30,7 @@ > #include "virtio_pci.h" > #include "virtqueue.h" > #include "virtio_rxtx.h" > +#include "virtio_rxtx_simple.h" >=20 > #ifdef RTE_LIBRTE_VIRTIO_DEBUG_DUMP > #define VIRTIO_DUMP_PACKET(m, len) rte_pktmbuf_dump(stdout, m, len) > @@ -446,25 +447,28 @@ virtio_dev_rx_queue_setup_finish(struct > rte_eth_dev *dev, uint16_t queue_idx) > &rxvq->fake_mbuf; > } >=20 > - while (!virtqueue_full(vq)) { > - m =3D rte_mbuf_raw_alloc(rxvq->mpool); > - if (m =3D=3D NULL) > - break; > + if (hw->use_simple_rx) { > + while (vq->vq_free_cnt >=3D > RTE_VIRTIO_VPMD_RX_REARM_THRESH) { > + virtio_rxq_rearm_vec(rxvq); > + nbufs +=3D RTE_VIRTIO_VPMD_RX_REARM_THRESH; > + } > + } else { > + while (!virtqueue_full(vq)) { > + m =3D rte_mbuf_raw_alloc(rxvq->mpool); > + if (m =3D=3D NULL) > + break; >=20 > - /* Enqueue allocated buffers */ > - if (hw->use_simple_rx) > - error =3D virtqueue_enqueue_recv_refill_simple(vq, > m); > - else > + /* Enqueue allocated buffers */ > error =3D virtqueue_enqueue_recv_refill(vq, m); > - > - if (error) { > - rte_pktmbuf_free(m); > - break; > + if (error) { > + rte_pktmbuf_free(m); > + break; > + } > + nbufs++; > } > - nbufs++; > - } >=20 > - vq_update_avail_idx(vq); > + vq_update_avail_idx(vq); > + } >=20 > PMD_INIT_LOG(DEBUG, "Allocated %d bufs", nbufs); >=20 > diff --git a/drivers/net/virtio/virtio_rxtx_simple.c > b/drivers/net/virtio/virtio_rxtx_simple.c > index 7247a0822..0a79d1d5b 100644 > --- a/drivers/net/virtio/virtio_rxtx_simple.c > +++ b/drivers/net/virtio/virtio_rxtx_simple.c > @@ -77,7 +77,7 @@ virtio_xmit_pkts_simple(void *tx_queue, struct > rte_mbuf **tx_pkts, > rte_compiler_barrier(); >=20 > if (nb_used >=3D VIRTIO_TX_FREE_THRESH) > - virtio_xmit_cleanup(vq); > + virtio_xmit_cleanup_simple(vq); >=20 > nb_commit =3D nb_pkts =3D RTE_MIN((vq->vq_free_cnt >> 1), nb_pkts); > desc_idx =3D (uint16_t)(vq->vq_avail_idx & desc_idx_max); > diff --git a/drivers/net/virtio/virtio_rxtx_simple.h > b/drivers/net/virtio/virtio_rxtx_simple.h > index 2d8e6b14a..303904d64 100644 > --- a/drivers/net/virtio/virtio_rxtx_simple.h > +++ b/drivers/net/virtio/virtio_rxtx_simple.h > @@ -60,7 +60,7 @@ virtio_rxq_rearm_vec(struct virtnet_rx *rxvq) > #define VIRTIO_TX_FREE_NR 32 > /* TODO: vq->tx_free_cnt could mean num of free slots so we could avoid > shift */ > static inline void > -virtio_xmit_cleanup(struct virtqueue *vq) > +virtio_xmit_cleanup_simple(struct virtqueue *vq) > { > uint16_t i, desc_idx; > uint32_t nb_free =3D 0; > -- > 2.14.3