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 4DF4F424BD; Mon, 30 Jan 2023 08:49:16 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 25CB940EDE; Mon, 30 Jan 2023 08:49:16 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id F085640C35 for ; Mon, 30 Jan 2023 08:49:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675064954; x=1706600954; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=DkfeYGhQh4UWZir74Xug6QpzUHQ8EosCThm3ZzJmnU8=; b=ZBnvIcMndWx9GeN8vR+4Dw+YOg9srEhiNOYbPhQoU31ESHFiqPCuPLy6 qYXANfnTYRjDvoZIwFHA0LVL6BOFPfa+MlFoEKZJk/AHnXrUR01Pu01ZR LWr/bz9NMjt4r56ljpq7Uxny+5dbAI8+ACAuRJBXMkuSDKHPX+dosLlqR rI53Bd8t0K8LnCyeweatzml1soD4+XMVoLbPMGr9UGlK8fDLDbDp08QAD VdtYkq3ZDsbYV5tk0MdKVkSwFn+dY3iyDxc7zge5It6VFSNDhvZVwH5U5 jqjj8UV6pByWk5zMaHNaptuvYvHyMtA32DrRXO9Zeej+f+54zPHtyUIQ+ Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10605"; a="413717394" X-IronPort-AV: E=Sophos;i="5.97,257,1669104000"; d="scan'208";a="413717394" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jan 2023 23:49:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10605"; a="909404543" X-IronPort-AV: E=Sophos;i="5.97,257,1669104000"; d="scan'208";a="909404543" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga006.fm.intel.com with ESMTP; 29 Jan 2023 23:49:12 -0800 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) 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; Sun, 29 Jan 2023 23:49:12 -0800 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Sun, 29 Jan 2023 23:49:12 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Sun, 29 Jan 2023 23:49:12 -0800 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.46) 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; Sun, 29 Jan 2023 23:49:11 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kPUhBhNRKFckcUPjBsa7r1tM0IEHoOTo9u1ao6fihF7kIoQvqH+edlKCwRRb+sr3iS8piJSRodJsfmGvylAOXCDMtDJZkwTu7FtYDlMUTk5PMHHOEq8BjW3bnxQVO7+A0Ww2L0sCaNfBD0E3oaycMG43mhr1FFE1rOb/smxEoFer8n+YqqM6T4Bja+j1SnnmNEjIQlQjrWgPvi7xq+BJ0SaePsCwad5ci7nYrt33wbIhkL3TXx0XvJ4GS4I32HTAzYfmlhAp4soccfLbcfZH+QvDxmoAYEzrUA0IDa+WfkRcA0yBEUN2pkoVvY5Zm76J4kBhxfgai7z5ekogd6BhdQ== 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=6X2IBr1dv0FJemaS5ffii1kuDBKu8J0aK3kXgqFfdVI=; b=RHMsb8WXfgbLQbw7QGLBaR8C1GxFom9VwKDKU4uBXTdCy3iT788QKcOZX6CVM/7tLr3Cb/d0qIVRxM+I5EbbLmnr+2DJ579bFfAyLfPLqtxtoS0kglJeoN68cssRauGIfUMU9xCda54Nz/5bj1gePsUvzem13n+SewHZ95MkmMSgtvkCy6HF3B4a9Lv2mcttFQ0xx1kbmrvGelkz/AY4UjoRiKn9m7sUd40DjL0g4zHR9tRfgo2Xg7mGFscCcgXhgVtXpVQ5dzxdhUPGnE2mZ6xVIRHB8Aj16MTi3oaamf+Nb5UCp0bEGJQ3uIlBa7qdIgLZQJ5t7y/OjfYv4BWQkQ== 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 SJ0PR11MB4990.namprd11.prod.outlook.com (2603:10b6:a03:2d8::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.36; Mon, 30 Jan 2023 07:49:09 +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.6043.033; Mon, 30 Jan 2023 07:49:08 +0000 From: "Xia, Chenbo" To: "Coquelin, Maxime" , "dev@dpdk.org" , "david.marchand@redhat.com" , "eperezma@redhat.com" Subject: RE: [PATCH v1 10/21] net/virtio: alloc Rx SW ring only if vectorized path Thread-Topic: [PATCH v1 10/21] net/virtio: alloc Rx SW ring only if vectorized path Thread-Index: AQHZBNRxF7pc50/L70iSOLBh39urna629JdA Date: Mon, 30 Jan 2023 07:49:08 +0000 Message-ID: References: <20221130155639.150553-1-maxime.coquelin@redhat.com> <20221130155639.150553-11-maxime.coquelin@redhat.com> In-Reply-To: <20221130155639.150553-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_|SJ0PR11MB4990:EE_ x-ms-office365-filtering-correlation-id: 0f8b17ce-6efb-4991-fc3f-08db02967815 x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: FM/VgFRibAtUOVO9L+Gl53MN+Jr6hhHUFH0Nap6dJ68hHVgAeaFzrmzy8rJLyGFHWpv2B7EXEEcTxdhOh25OeTKCPWcKOW3DPC0XQ/7QvBA6qIH4EhIk4G+W/7d9yp+BYF/TIYmZxr2Mdn6EN0KWbvBnfY4iwo5A4o3nnbT+6YKIbHZyF4le+k2Yituw3UZLzfXpyyJyyO1zKq9EjPtgttOyQp6gZAkqBdi9dO3tAHcYzhiTINiNVcsAB8D4FBomEBWqFNc6ah4XIyzES7iyS0sq0+zDbUlkncEYbkHWjVDI9uStx0PAq1cFHD7mCN5XLzuKMtQNov1YVraekXM5kMOgdy9m1mN/QYJ495Y9Lc+IuWCQH8dSyros14zzVn7K7oTG+ICTwcjQLeYrg1Q8T99q3mCBz5xMEe8NhwMawg2mQ94FXls+a2V447qqYDokOGJ/EObS9nHSrnFQ1S0Cb38x1PRj4+QWmFwwkwdXQ9zhewVB0T34y8JJ5AjG7zR9xdwBUgougCdQWqYoktIe3r/n38XDSKf+vCBJVYQHZ2n3kuqvMw1br117Sex0gDzOk74g/c2HFUW1vSChDruIYw6ZAXMMbUneQjXywhsNVii4Aw9KazpiA4c9Zlf2wAhn9Oh66RiQGRB0A6kRJ1DJRl5PY6YAT4AG7X322zAPoNsoj8GNJ8T8bXPZ5HehsEp+dMiGBpf5FD4Uuu5xr8rv6g== 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)(136003)(39860400002)(376002)(366004)(396003)(346002)(451199018)(110136005)(316002)(66946007)(66476007)(8676002)(66556008)(66446008)(76116006)(64756008)(8936002)(52536014)(5660300002)(122000001)(38100700002)(86362001)(38070700005)(33656002)(82960400001)(41300700001)(53546011)(71200400001)(9686003)(26005)(6506007)(186003)(30864003)(55016003)(2906002)(478600001)(7696005)(83380400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?JxqIrfnfYIz9Rr1duWweHXAN2iRQ17WrjXRN25ubzkWq7L2VMT2KjYDd6lfU?= =?us-ascii?Q?QHGdT+8go705Yql00vcavKJRseiY77jRq5Pqyvzfp0oMLI954tP88IrFXaLb?= =?us-ascii?Q?EoDg9NibyN4QomEJuUw8zf/6gINmzdO5+k1ZYi78xlpzxgoIWohlc1G7L4eK?= =?us-ascii?Q?ngdzUI+RO7pReVt09mg3CmWRceVM9CZ5uDm31Dq6WLmkyS21PPUMfIp/GZeB?= =?us-ascii?Q?xLNO3M4u9NF+Yx9g+jXgjRJfit1lkYAe6Yf0BXG+V0s5w68iv5xwbItyDfv2?= =?us-ascii?Q?ufa/FrXc+Yw0FAtExEu6n45YFAQcatia1eJ8aG8CkeaVawhCdanCX0TkGgYn?= =?us-ascii?Q?FgB0LTy0Cki6eQfanmA79bCX7DEHIAEC2X/w4vTcwkYjDMkcieU1K8zT0cq2?= =?us-ascii?Q?KGDKK8zBDb53LQpmg5emeUD5w8XVh2CRVq7RgukvKOkLfBxX+ZO4ien1qgkM?= =?us-ascii?Q?LpaY5HEhSBlzx6VlKUaxhUtcCRNE3tRGRwUCriyFu55HlyurHzREQgSEX+Hz?= =?us-ascii?Q?p0UewWSfHHL/9oO16NQ+PQ7zofONSsFHcwhinsRXGS7rdHuve1OmF39mEn5K?= =?us-ascii?Q?E4e4SyzIzLoRgjSRAkltUoRhfvzMxwJCyhndbJyKJ1biTmk14ZYILo6vf3bE?= =?us-ascii?Q?vXfzGWhsr0M6T8FSlBXB9qoL92Yr1wDnzkjay6h/p1FDhogcGyLXatI+44UW?= =?us-ascii?Q?CZzPETdudn/nowc2keF3XEc8GZMOpLnIRC5Dxwl0CFMrSQVCRKeWKIwHEaDN?= =?us-ascii?Q?k/1kfFsov1p3tQZONTQAfTZ+qzsDPjbCZuAvg05be01AXYV/ltP0tOr67abZ?= =?us-ascii?Q?zR60YinnS06GAhSID9rc0hdliAEjp6nz2tJXeMClmpY5RXB6l3eZMSwdFy3i?= =?us-ascii?Q?p+R1jPQTHjSsF0DkE2aeBu+69iQRcnZEE8uJNUXdIYjuAjMCS7jY9jYL6ngj?= =?us-ascii?Q?faKZurcWC1oXxSPmnCeNp/ejTz/J5NxeWXjyYzklGuceRSbF2vs/2GKIS+31?= =?us-ascii?Q?GneBa38kmvGgmfIZ13cqP/bWgXGfwv0XOfIbWEdjd0Gyfj7tVJtErpcUrtVZ?= =?us-ascii?Q?itdNqn4a252ffrINUclLZQvQQ6Re5qM+hvIrd9sr62K+BzG+Qm7SjYheUW8o?= =?us-ascii?Q?E4jBb1uKYslPmG9yizY6stF4vYeSuPARxkBXL1IldpuXz0bm+FduHYwm8nur?= =?us-ascii?Q?1+pF6Y18KbLrHVcp09HoiKPCmp7aVSSxGv3TvhB8lM6d7W9D/X2KXzkEieIQ?= =?us-ascii?Q?SrgAxI4WSdBVnyvfrVSFHSr40dS83EOVioTJvjN/D1wxZin4gAE6F78PWGns?= =?us-ascii?Q?zi0xP3BoJz2YSdKHk5GDMG05aF16/cL4KFK7kjCmWf6Fy++8z9558rhUlp17?= =?us-ascii?Q?Dd7S6vqwpRo6R2zD0aSg86LRUOwXD9EFRZpH50lFFVh2ZJQYAyPJVBHqoUij?= =?us-ascii?Q?1zswlfcYIgaPzMrqz2tfSprJOErGMvNxKBhyCPJCAzPAgiwzjUy3ChEXl80g?= =?us-ascii?Q?SzxPk4LONenn+R+kYa3OLDGMaxQCyPXdX8huS4mYfPz+klOb/fz9z9zlbKAU?= =?us-ascii?Q?JLd55sj91iOVfhhMD8Rn97boBSLPMxiQPjFHvbdZ?= 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: 0f8b17ce-6efb-4991-fc3f-08db02967815 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Jan 2023 07:49:08.5957 (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: 45giz9i95VCGOqyTWagr9jHde9glg5LLw43i8pqPTYKJN9ilOJvS4wqMQQbEKp78QweK8Fki7fl4/lN1+Sii+g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB4990 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 Hi Maxime, > -----Original Message----- > From: Maxime Coquelin > Sent: Wednesday, November 30, 2022 11:56 PM > To: dev@dpdk.org; Xia, Chenbo ; > david.marchand@redhat.com; eperezma@redhat.com > Cc: Maxime Coquelin > Subject: [PATCH v1 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 8b17b450ec..46dd5606f6 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); > @@ -2195,6 +2213,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) > @@ -2202,12 +2225,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..7910efc153 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]; After sw_ring, there are two spaces, should be only one. > + 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..ffaa139bd6 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]; Ditto > + 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..ed608fbf2e 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]; Ditto Thanks, Chenbo > + 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.38.1