From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 22EAB41C35; Wed, 8 Feb 2023 02:07:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0C93A427E9; Wed, 8 Feb 2023 02:07:02 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id CD37240DDB for ; Wed, 8 Feb 2023 02:07:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675818421; x=1707354421; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=Kf3PJzMrA9KbxPKmNjlHbXOgcTSBnhFVQKy/Mouvsr4=; b=OyRgV7iC85tHVYLzSB94lOehMt53XgN/y5vGg2d9GNnytAfDl3ByYGL4 7tSQ7kz03u/rIE7udhfewoqxOSjmn6S+OpjXHM4xN+bISaCQs9XU/5sNn t0QLANTtzZdMl/DMRHheO8SbeNTVDQKkLRFnMYcEyL4V7mcXXBC5j4L1F MaxaVclkjQeGjXR71Unwe04JjvWfQYJbVwGeTN6oMY+YMuAm5thxJKvFw myCO3jAI/Lyyh9wFm+HfIEz1g8tRCNrIJxiw4VZB7rc2wkwrgiRp9aFpG kNxsN03MGYpDy1eNmKiaJq4JnR1BBj6uDY6RMv5YOwrG6H+qrP/Fnq/ia Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10614"; a="331804955" X-IronPort-AV: E=Sophos;i="5.97,279,1669104000"; d="scan'208";a="331804955" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Feb 2023 17:06:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10614"; a="644660474" X-IronPort-AV: E=Sophos;i="5.97,279,1669104000"; d="scan'208";a="644660474" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga006.jf.intel.com with ESMTP; 07 Feb 2023 17:06:01 -0800 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Tue, 7 Feb 2023 17:06:00 -0800 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Tue, 7 Feb 2023 17:06:00 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Tue, 7 Feb 2023 17:06:00 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.104) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Tue, 7 Feb 2023 17:06:00 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q3dJTxfNEvJt7Ki0T5m+QYnU2Be9YJXsHS20v1eCNeYPQo3V4X9I7jFYe5i/OsMvNkUnBmqZiWSgC9n2rvHYAcqemk8LdCpDwYYofvP4i99FdTCuKKWdtVG/epgJXmhZa7xTp4o73sYw1FWwIol8i9Ye39LnRyq3HnUZEXcLLapMktIm0GIi87itoZ4QxcOzVPoT7S0NbGEvI1pq1fq7rOFDmSoztJrd3E1dUXn6LOwF0CGtDEtj5a/YV6IQmtDg8KzSbULBtpf+XIlbq8Y/6Lt29+Q8ragEZ+Q3OYdbuajYCskLzfnrHAN1RLYoHxBc/agdsIXU6j1jl9hbqRajcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Lacd50+yG0G8nW3FZaAxZfVufQTMUMW2TAF+ji/pTyg=; b=f4wRFs7PPu26OtqFmQDPltaHVTmT57dmP+tiy69OyP2mpV+8CKhKN3da2N4yJ3oQHGFaXoeWGylvhDxy9wbHr7W6U0rL6eVsVMsP4MMbah1Tn9eXDeCvo9w74PQJixDUQ9KIZJR0W/4BYjtDyGqp9xdISx0ZGFtyUBLyfKr/M59PIDHNNqlRknrV0pQai35QipzD8wCS+tY9UroKAm4DsmraLc17e0saL5A2AwNFoYLF0Qte/ncqkIQzzmlpOj88mb3EJKGbhrickOsL/UkHOe0hf/8g7Zym1Hu55LVpqtVIF+2eTkwUbMqq6u62Adpbl3Mop/SEgpAFAB+la/nvXw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from SN6PR11MB3504.namprd11.prod.outlook.com (2603:10b6:805:d0::17) by BN9PR11MB5371.namprd11.prod.outlook.com (2603:10b6:408:11c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.36; Wed, 8 Feb 2023 01:05:58 +0000 Received: from SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::c8f8:a3e1:5b23:a9c3]) by SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::c8f8:a3e1:5b23:a9c3%5]) with mapi id 15.20.6064.032; Wed, 8 Feb 2023 01:05:58 +0000 From: "Xia, Chenbo" To: Maxime Coquelin , "dev@dpdk.org" , "david.marchand@redhat.com" , "eperezma@redhat.com" , "stephen@networkplumber.org" Subject: RE: [PATCH v2 10/21] net/virtio: alloc Rx SW ring only if vectorized path Thread-Topic: [PATCH v2 10/21] net/virtio: alloc Rx SW ring only if vectorized path Thread-Index: AQHZOweRQYT8CpJ8IEq3ZMNftVRQW67EPOBQ Date: Wed, 8 Feb 2023 01:05:58 +0000 Message-ID: References: <20230207151747.245808-1-maxime.coquelin@redhat.com> <20230207151747.245808-11-maxime.coquelin@redhat.com> In-Reply-To: <20230207151747.245808-11-maxime.coquelin@redhat.com> Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SN6PR11MB3504:EE_|BN9PR11MB5371:EE_ x-ms-office365-filtering-correlation-id: 7b766384-df96-401a-8ad4-08db0970a367 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: d9EIU90579GWuIfL5503V9GEzovdCEbllZY4gzlst/eiGOTxbjKQRRI2my19vzMDS0EqIU+A3n4GKB88p1bJaUQRaCeXftcyKnAqbqqGN6KZNGDnfY8JahiMhgy4MTopbn4zHLaadAaDUMy/b/YjR9eZr/ilNS8VGu/EqM1ANlho5KbYtJWYnZmfO95alAKXExUuxZ3Ys9LXF9x/ClDVBNhFeMc/VPIBkgd8h63h95WPxDd/tRQ/q/SsxqdQfTDoUoyp2tRJmlQeca/GHNB4cfV4Aule0G+QOBJWl0hKyM3caLmsuWGgxAywXTGWBcd2SgzVkAXppVuqJdQvrIOEG5bJe35EjSQ+5MeZQBlf5WhHqheKACu8QMW+Ui32Dw0CSGwYeipfJQVf/TNgVMBTP78YxldcgG8zyXjZtVoOlEi3+N+/+Tvw5Sl/btPGl5necuoKdAPPjcjqv9+JzPYzLjKd89Lk5gyU0NNs/846cMe/5t+Tzke5qVLYOuWOzYW2bwHWR7Ghm7fcs/T7Wy0eqn82Li73K5spRqZyUhZKws96IgfRLgyLPHRzORDII6icd17pNgWpwXeZWotSfuGs+fofpPj3LjbyYW/L2pMPHMbZ4mIPV3n1gO0VK/9HfXoZQu5Hm6fbMPfzaDCZI66jkqm/RpRhzrki57SfC/CP62CvKVzZMUSStwm4DRjLW7lxG8FpTL/FfPQImRFYf+5zvg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR11MB3504.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(39860400002)(396003)(376002)(346002)(136003)(366004)(451199018)(2906002)(5660300002)(30864003)(52536014)(8936002)(41300700001)(33656002)(38070700005)(122000001)(38100700002)(86362001)(82960400001)(55016003)(186003)(7696005)(478600001)(66446008)(66556008)(64756008)(66946007)(71200400001)(76116006)(66476007)(316002)(83380400001)(110136005)(8676002)(6506007)(53546011)(9686003)(26005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?tMdJysm/zvS6ZSymfA1bKtSaqQ7j3G0nL70+/ZhOSGxAGJaD2IYhzvMDct6c?= =?us-ascii?Q?AvnWGe7QCnZ85YY0k0xzOl93XhPtlY5eqZvuCx7M8sOl6WS9Nqb5vmSGmvqZ?= =?us-ascii?Q?u2sezFuJDw8NKV+S1Eo8798vf+eC4pveq2GRsTCA4Nli5yo5jiikXGSllnk5?= =?us-ascii?Q?XXO9oVzy0cmSmqbfUHf8i7NSRh5ChDbmE2lc0JoeltZdAjDedUWpz8vZGXsR?= =?us-ascii?Q?jO0F18XBTqJS55w4eApnPvE6vHMfOlaiZB0LIu1rRA8xvPgpJioMFMYQA9ut?= =?us-ascii?Q?hmueq9TOjRs64f+DzexoxtXGZgAw9ugw3izc9NguMRWerNP4sTIC9UO+jfRK?= =?us-ascii?Q?Xgrwdac+HQnFCX4XVFmF1VIBb5vQpQy8u5TP0EQTuv3v5myuLlmCeCsZ2wbq?= =?us-ascii?Q?Ar6sOfKx91UxnzBwlqd4ipoYg3kxkkOn3KSda89cGWKIGq9a8JAJc5NVey/M?= =?us-ascii?Q?O0Xw1SRJUEoURJJGWMlPoR5uc9QjusxyCVHFpWeMko7SOZIgRFoKNw4c4Blc?= =?us-ascii?Q?IHTlC4qT6hMsaG+fgpTbb2AiZW+l+2dmFWN8GLMdCecYTAsnR3ud5LMofwIw?= =?us-ascii?Q?6zRCIHqiCnsmgdIhDByDubQ+pTPkte6Ubi2zlCJ2kYaDiEl9CLTEDXXe1Bzp?= =?us-ascii?Q?anInDf2HAQHZ6IB5NrMXmPYnJ+RxcDTnTVicMfA3TF4t7Boqpb41dFDzPvwH?= =?us-ascii?Q?CJvNRChM4az/fzrRlWppMG5IAaXoTCjy1bsbrczymyEUp8XcOoVAwehlj9hr?= =?us-ascii?Q?lg88OKQmYAEJUJ278nDvfogsIOgt3Le3w634fqR/cDSJJL29NTZGfMhLvkZ8?= =?us-ascii?Q?JhZmFgYioYvKzklR0ZMDaz5HfjUB5C3Nd5efkVeJXlpcuHiubuQKUQPp4B8T?= =?us-ascii?Q?6gFSNhN1TYFQb9yz2bI1dM58t8JA29y6xR8iKPyih1ZmMD46smnS6yoXDLlv?= =?us-ascii?Q?7vzzbBxhh9DO7Zn7YG4oCBknm/6jkqYMzbDo5rvZui7lXnVzkqKhDyxO+bVz?= =?us-ascii?Q?F9PToK4DrvMh6i51ITZYrIApMiafcXzeKIZHqdosA1aKPvoOCBZrDe0mQHVr?= =?us-ascii?Q?B//x2Imsim7vY8LfUD+0agyGz19lI8dnOrwCkcgtOcnsS4FtsfX5EWX9b1xW?= =?us-ascii?Q?Sv5Io1BcU/U2Bj8/p5tKrV0I7Ap3gf8JsHIbzyWUxPX4pAtmFdnhMIEmNeMZ?= =?us-ascii?Q?Sztz8eLGEHBUENUSDt69zk0LdOE4KpR69LENTtT/9jgiHnXdvxbFBp5+4XhX?= =?us-ascii?Q?Vo34eezQZMLNyxV5YQ/s7rYsvwVl1X3a2siL/EV4YH4qSSMnt8FHuO33vuNd?= =?us-ascii?Q?FPBG1n7aed4KPT5hWTw8zy/xOp9v4aYvhLgwuuO9ipp9rbYcwzv6puS7ww+A?= =?us-ascii?Q?dZEF10MfXKMl1Sess7haZnIgCUc34QLj7fbpcyfBY9W2K8lTO3Lurnxho6MC?= =?us-ascii?Q?NQrxjH5n4MPk/JIXwPOSjhy/ov9gPBs/RL4UzqNWhkQKTI2xK+2EhhTGhRxE?= =?us-ascii?Q?kN8FcwnDQCmt/XkdBrRr90m5EactjSVOS1012dLB6/KV09O67CfX5hPAscXh?= =?us-ascii?Q?SvUc1gytu5YM+4wDZI+bPXvapCvxlSJ+kmMpvYRt?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB3504.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b766384-df96-401a-8ad4-08db0970a367 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Feb 2023 01:05:58.5047 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: sErwrA/8fJSqiN7CBUWFxyMghPXYqdUxt0Yr+W5sXV/i3crKoz87MyU+dFlHwEu7+3QRQNv74YQKJH89qlrOkQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR11MB5371 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > -----Original Message----- > From: Maxime Coquelin > Sent: Tuesday, February 7, 2023 11:18 PM > To: dev@dpdk.org; Xia, Chenbo ; > david.marchand@redhat.com; eperezma@redhat.com; stephen@networkplumber.or= g > Cc: Maxime Coquelin > Subject: [PATCH v2 10/21] net/virtio: alloc Rx SW ring only if vectorized > path >=20 > This patch only allocates the SW ring when vectorized > datapath is used. It also moves the SW ring and fake mbuf > in the virtnet_rx struct since this is Rx-only. >=20 > Signed-off-by: Maxime Coquelin > --- > drivers/net/virtio/virtio_ethdev.c | 88 ++++++++++++------- > drivers/net/virtio/virtio_rxtx.c | 8 +- > drivers/net/virtio/virtio_rxtx.h | 4 +- > drivers/net/virtio/virtio_rxtx_simple.h | 2 +- > .../net/virtio/virtio_rxtx_simple_altivec.c | 4 +- > drivers/net/virtio/virtio_rxtx_simple_neon.c | 4 +- > drivers/net/virtio/virtio_rxtx_simple_sse.c | 4 +- > drivers/net/virtio/virtqueue.c | 6 +- > drivers/net/virtio/virtqueue.h | 1 - > 9 files changed, 72 insertions(+), 49 deletions(-) >=20 > diff --git a/drivers/net/virtio/virtio_ethdev.c > b/drivers/net/virtio/virtio_ethdev.c > index f839a24d12..14c5dc9059 100644 > --- a/drivers/net/virtio/virtio_ethdev.c > +++ b/drivers/net/virtio/virtio_ethdev.c > @@ -339,6 +339,47 @@ virtio_free_queue_headers(struct virtqueue *vq) > *hdr_mem =3D 0; > } >=20 > +static int > +virtio_rxq_sw_ring_alloc(struct virtqueue *vq, int numa_node) > +{ > + void *sw_ring; > + struct rte_mbuf *mbuf; > + size_t size; > + > + /* SW ring is only used with vectorized datapath */ > + if (!vq->hw->use_vec_rx) > + return 0; > + > + size =3D (RTE_PMD_VIRTIO_RX_MAX_BURST + vq->vq_nentries) * sizeof(vq- > >rxq.sw_ring[0]); > + > + sw_ring =3D rte_zmalloc_socket("sw_ring", size, RTE_CACHE_LINE_SIZE, > numa_node); > + if (!sw_ring) { > + PMD_INIT_LOG(ERR, "can not allocate RX soft ring"); > + return -ENOMEM; > + } > + > + mbuf =3D rte_zmalloc_socket("sw_ring", sizeof(*mbuf), > RTE_CACHE_LINE_SIZE, numa_node); > + if (!mbuf) { > + PMD_INIT_LOG(ERR, "can not allocate fake mbuf"); > + rte_free(sw_ring); > + return -ENOMEM; > + } > + > + vq->rxq.sw_ring =3D sw_ring; > + vq->rxq.fake_mbuf =3D mbuf; > + > + return 0; > +} > + > +static void > +virtio_rxq_sw_ring_free(struct virtqueue *vq) > +{ > + rte_free(vq->rxq.fake_mbuf); > + vq->rxq.fake_mbuf =3D NULL; > + rte_free(vq->rxq.sw_ring); > + vq->rxq.sw_ring =3D NULL; > +} > + > static int > virtio_init_queue(struct rte_eth_dev *dev, uint16_t queue_idx) > { > @@ -346,14 +387,11 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t > queue_idx) > const struct rte_memzone *mz =3D NULL; > unsigned int vq_size, size; > struct virtio_hw *hw =3D dev->data->dev_private; > - struct virtnet_rx *rxvq =3D NULL; > struct virtnet_ctl *cvq =3D NULL; > struct virtqueue *vq; > - void *sw_ring =3D NULL; > int queue_type =3D virtio_get_queue_type(hw, queue_idx); > int ret; > int numa_node =3D dev->device->numa_node; > - struct rte_mbuf *fake_mbuf =3D NULL; >=20 > PMD_INIT_LOG(INFO, "setting up queue: %u on NUMA node %d", > queue_idx, numa_node); > @@ -441,28 +479,9 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t > queue_idx) > } >=20 > if (queue_type =3D=3D VTNET_RQ) { > - size_t sz_sw =3D (RTE_PMD_VIRTIO_RX_MAX_BURST + vq_size) * > - sizeof(vq->sw_ring[0]); > - > - sw_ring =3D rte_zmalloc_socket("sw_ring", sz_sw, > - RTE_CACHE_LINE_SIZE, numa_node); > - if (!sw_ring) { > - PMD_INIT_LOG(ERR, "can not allocate RX soft ring"); > - ret =3D -ENOMEM; > + ret =3D virtio_rxq_sw_ring_alloc(vq, numa_node); > + if (ret) > goto free_hdr_mz; > - } > - > - fake_mbuf =3D rte_zmalloc_socket("sw_ring", sizeof(*fake_mbuf), > - RTE_CACHE_LINE_SIZE, numa_node); > - if (!fake_mbuf) { > - PMD_INIT_LOG(ERR, "can not allocate fake mbuf"); > - ret =3D -ENOMEM; > - goto free_sw_ring; > - } > - > - vq->sw_ring =3D sw_ring; > - rxvq =3D &vq->rxq; > - rxvq->fake_mbuf =3D fake_mbuf; > } else if (queue_type =3D=3D VTNET_TQ) { > virtqueue_txq_indirect_headers_init(vq); > } else if (queue_type =3D=3D VTNET_CQ) { > @@ -486,9 +505,8 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t > queue_idx) >=20 > clean_vq: > hw->cvq =3D NULL; > - rte_free(fake_mbuf); > -free_sw_ring: > - rte_free(sw_ring); > + if (queue_type =3D=3D VTNET_RQ) > + virtio_rxq_sw_ring_free(vq); > free_hdr_mz: > virtio_free_queue_headers(vq); > free_mz: > @@ -519,7 +537,7 @@ virtio_free_queues(struct virtio_hw *hw) > queue_type =3D virtio_get_queue_type(hw, i); > if (queue_type =3D=3D VTNET_RQ) { > rte_free(vq->rxq.fake_mbuf); > - rte_free(vq->sw_ring); > + rte_free(vq->rxq.sw_ring); > } >=20 > virtio_free_queue_headers(vq); > @@ -2214,6 +2232,11 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) >=20 > rte_spinlock_init(&hw->state_lock); >=20 > + if (vectorized) { > + hw->use_vec_rx =3D 1; > + hw->use_vec_tx =3D 1; > + } > + > /* reset device and negotiate default features */ > ret =3D virtio_init_device(eth_dev, VIRTIO_PMD_DEFAULT_GUEST_FEATURES); > if (ret < 0) > @@ -2221,12 +2244,11 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) >=20 > if (vectorized) { > if (!virtio_with_packed_queue(hw)) { > - hw->use_vec_rx =3D 1; > + hw->use_vec_tx =3D 0; > } else { > -#if defined(CC_AVX512_SUPPORT) || defined(RTE_ARCH_ARM) > - hw->use_vec_rx =3D 1; > - hw->use_vec_tx =3D 1; > -#else > +#if !defined(CC_AVX512_SUPPORT) && !defined(RTE_ARCH_ARM) > + hw->use_vec_rx =3D 0; > + hw->use_vec_tx =3D 0; > PMD_DRV_LOG(INFO, > "building environment do not support packed ring > vectorized"); > #endif > diff --git a/drivers/net/virtio/virtio_rxtx.c > b/drivers/net/virtio/virtio_rxtx.c > index 4f69b97f41..2d0afd3302 100644 > --- a/drivers/net/virtio/virtio_rxtx.c > +++ b/drivers/net/virtio/virtio_rxtx.c > @@ -737,9 +737,11 @@ virtio_dev_rx_queue_setup_finish(struct rte_eth_dev > *dev, uint16_t queue_idx) > virtio_rxq_vec_setup(rxvq); > } >=20 > - memset(rxvq->fake_mbuf, 0, sizeof(*rxvq->fake_mbuf)); > - for (desc_idx =3D 0; desc_idx < RTE_PMD_VIRTIO_RX_MAX_BURST; > desc_idx++) > - vq->sw_ring[vq->vq_nentries + desc_idx] =3D rxvq->fake_mbuf; > + if (hw->use_vec_rx) { > + memset(rxvq->fake_mbuf, 0, sizeof(*rxvq->fake_mbuf)); > + for (desc_idx =3D 0; desc_idx < RTE_PMD_VIRTIO_RX_MAX_BURST; > desc_idx++) > + vq->rxq.sw_ring[vq->vq_nentries + desc_idx] =3D rxvq- > >fake_mbuf; > + } >=20 > if (hw->use_vec_rx && !virtio_with_packed_queue(hw)) { > while (vq->vq_free_cnt >=3D RTE_VIRTIO_VPMD_RX_REARM_THRESH) { > diff --git a/drivers/net/virtio/virtio_rxtx.h > b/drivers/net/virtio/virtio_rxtx.h > index 57af630110..afc4b74534 100644 > --- a/drivers/net/virtio/virtio_rxtx.h > +++ b/drivers/net/virtio/virtio_rxtx.h > @@ -18,8 +18,8 @@ struct virtnet_stats { > }; >=20 > struct virtnet_rx { > - /* dummy mbuf, for wraparound when processing RX ring. */ > - struct rte_mbuf *fake_mbuf; > + struct rte_mbuf **sw_ring; /**< RX software ring. */ > + struct rte_mbuf *fake_mbuf; /**< dummy mbuf, for wraparound when > processing RX ring. */ > uint64_t mbuf_initializer; /**< value to init mbufs. */ > struct rte_mempool *mpool; /**< mempool for mbuf allocation */ >=20 > diff --git a/drivers/net/virtio/virtio_rxtx_simple.h > b/drivers/net/virtio/virtio_rxtx_simple.h > index 8e235f4dbc..79196ed86e 100644 > --- a/drivers/net/virtio/virtio_rxtx_simple.h > +++ b/drivers/net/virtio/virtio_rxtx_simple.h > @@ -26,7 +26,7 @@ virtio_rxq_rearm_vec(struct virtnet_rx *rxvq) > struct virtqueue *vq =3D virtnet_rxq_to_vq(rxvq); >=20 > desc_idx =3D vq->vq_avail_idx & (vq->vq_nentries - 1); > - sw_ring =3D &vq->sw_ring[desc_idx]; > + sw_ring =3D &vq->rxq.sw_ring[desc_idx]; > start_dp =3D &vq->vq_split.ring.desc[desc_idx]; >=20 > ret =3D rte_mempool_get_bulk(rxvq->mpool, (void **)sw_ring, > diff --git a/drivers/net/virtio/virtio_rxtx_simple_altivec.c > b/drivers/net/virtio/virtio_rxtx_simple_altivec.c > index e7f0ed6068..542ec3d952 100644 > --- a/drivers/net/virtio/virtio_rxtx_simple_altivec.c > +++ b/drivers/net/virtio/virtio_rxtx_simple_altivec.c > @@ -103,8 +103,8 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf > **rx_pkts, >=20 > desc_idx =3D (uint16_t)(vq->vq_used_cons_idx & (vq->vq_nentries - 1)); > rused =3D &vq->vq_split.ring.used->ring[desc_idx]; > - sw_ring =3D &vq->sw_ring[desc_idx]; > - sw_ring_end =3D &vq->sw_ring[vq->vq_nentries]; > + sw_ring =3D &vq->rxq.sw_ring[desc_idx]; > + sw_ring_end =3D &vq->rxq.sw_ring[vq->vq_nentries]; >=20 > rte_prefetch0(rused); >=20 > diff --git a/drivers/net/virtio/virtio_rxtx_simple_neon.c > b/drivers/net/virtio/virtio_rxtx_simple_neon.c > index 7fd92d1b0c..7139b31d78 100644 > --- a/drivers/net/virtio/virtio_rxtx_simple_neon.c > +++ b/drivers/net/virtio/virtio_rxtx_simple_neon.c > @@ -101,8 +101,8 @@ virtio_recv_pkts_vec(void *rx_queue, >=20 > desc_idx =3D (uint16_t)(vq->vq_used_cons_idx & (vq->vq_nentries - 1)); > rused =3D &vq->vq_split.ring.used->ring[desc_idx]; > - sw_ring =3D &vq->sw_ring[desc_idx]; > - sw_ring_end =3D &vq->sw_ring[vq->vq_nentries]; > + sw_ring =3D &vq->rxq.sw_ring[desc_idx]; > + sw_ring_end =3D &vq->rxq.sw_ring[vq->vq_nentries]; >=20 > rte_prefetch_non_temporal(rused); >=20 > diff --git a/drivers/net/virtio/virtio_rxtx_simple_sse.c > b/drivers/net/virtio/virtio_rxtx_simple_sse.c > index 7577f5e86d..6a18741b6d 100644 > --- a/drivers/net/virtio/virtio_rxtx_simple_sse.c > +++ b/drivers/net/virtio/virtio_rxtx_simple_sse.c > @@ -101,8 +101,8 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf > **rx_pkts, >=20 > desc_idx =3D (uint16_t)(vq->vq_used_cons_idx & (vq->vq_nentries - 1)); > rused =3D &vq->vq_split.ring.used->ring[desc_idx]; > - sw_ring =3D &vq->sw_ring[desc_idx]; > - sw_ring_end =3D &vq->sw_ring[vq->vq_nentries]; > + sw_ring =3D &vq->rxq.sw_ring[desc_idx]; > + sw_ring_end =3D &vq->rxq.sw_ring[vq->vq_nentries]; >=20 > rte_prefetch0(rused); >=20 > diff --git a/drivers/net/virtio/virtqueue.c > b/drivers/net/virtio/virtqueue.c > index fb651a4ca3..7a84796513 100644 > --- a/drivers/net/virtio/virtqueue.c > +++ b/drivers/net/virtio/virtqueue.c > @@ -38,9 +38,9 @@ virtqueue_detach_unused(struct virtqueue *vq) > continue; > if (start > end && (idx >=3D start || idx < end)) > continue; > - cookie =3D vq->sw_ring[idx]; > + cookie =3D vq->rxq.sw_ring[idx]; > if (cookie !=3D NULL) { > - vq->sw_ring[idx] =3D NULL; > + vq->rxq.sw_ring[idx] =3D NULL; > return cookie; > } > } else { > @@ -100,7 +100,7 @@ virtqueue_rxvq_flush_split(struct virtqueue *vq) > uep =3D &vq->vq_split.ring.used->ring[used_idx]; > if (hw->use_vec_rx) { > desc_idx =3D used_idx; > - rte_pktmbuf_free(vq->sw_ring[desc_idx]); > + rte_pktmbuf_free(vq->rxq.sw_ring[desc_idx]); > vq->vq_free_cnt++; > } else if (hw->use_inorder_rx) { > desc_idx =3D (uint16_t)uep->id; > diff --git a/drivers/net/virtio/virtqueue.h > b/drivers/net/virtio/virtqueue.h > index d453c3ec26..d7f8ee79bb 100644 > --- a/drivers/net/virtio/virtqueue.h > +++ b/drivers/net/virtio/virtqueue.h > @@ -206,7 +206,6 @@ struct virtqueue { > * or virtual address for virtio_user. */ >=20 > uint16_t *notify_addr; > - struct rte_mbuf **sw_ring; /**< RX software ring. */ > struct vq_desc_extra vq_descx[]; > }; >=20 > -- > 2.39.1 Reviewed-by: Chenbo Xia