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 EF4CB424BD; Mon, 30 Jan 2023 08:53:24 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DD91A42D0C; Mon, 30 Jan 2023 08:53:24 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id BDF2240C35 for ; Mon, 30 Jan 2023 08:53:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675065196; x=1706601196; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=lglEEHfn34trvGEHhG/j/FyXO8d5XggfSkz/4M/YrGU=; b=EMPdQqCFM9GbeLWWd4rREZzS+VZ5SAz/wujCN5YSfN2zm56JjTq7vMy3 SkSyNaPUObszJK+DJOnH2Hj/tmKLGYxZUryOrpaCwuN2AHggZa+8hgGr+ PfRMBJJ2Z9sM6JTjofAo+A71V9uITBvUgs0dLKdXPpeG9Xfmj7hUsBSTW IuaLvGMbqEMRMrHwGN7ZXhpm49usXSWyV4exUa/+7gpNDzh7MkCRjGZCF 9BBIz4eBrw5XhTde+7xZ9mgwAJBoQzDQ/IMH9ArNN6uKj0a/ZYu6I8Scb vl/XQGMlL+QKR/5hKTXrgFz1YQDPcYtgdW7o8U6aN+GtOk7BR5ALpzGRT Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10605"; a="413718129" X-IronPort-AV: E=Sophos;i="5.97,257,1669104000"; d="scan'208";a="413718129" 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:52:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10605"; a="909405934" X-IronPort-AV: E=Sophos;i="5.97,257,1669104000"; d="scan'208";a="909405934" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga006.fm.intel.com with ESMTP; 29 Jan 2023 23:52:51 -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; Sun, 29 Jan 2023 23:52:49 -0800 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) 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; Sun, 29 Jan 2023 23:52:48 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx602.amr.corp.intel.com (10.18.126.82) 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:52:48 -0800 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.41) 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:52:48 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nvtgmmkYiwmidzMbMq2pJlTlmbB4b6dcdxg0dh3ALwZruuVCiPQfSyj1yhmAQFkunbIrwWBU5lmiFVgZEIJVyVZK1x4goCVThuepRLl0ZCpA0YLjbu7fNGjkKMob5E6kSln+0qudfJLoY3ARDWtD59qfNW9qKwfb/3WV9EMYszE9cmgwBNOahAKhAJQ/qaT7yC9y1/UOn+6XThkpGLuAj+2YyHcs5TwzeCE4xYoDDLDmc5Ov/5TFuTctIdSRHRBFoD24mV8WQeOW0RynR6XB2xcl16F5m/UNK5kEHU1XeGfqD1OblKyR4Tq58H9Et/O0qdsbRnH5b/Il95U/jFj68Q== 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=G7M29U6cfGxzA26zVYjzAxzvDCpT1LYzp6dX9eUWz6Y=; b=Tohyk81q728RzwHNa3pogfudjSH5pHOW2BioNOCvR60oVvnqUpBfCMYQOntxiXIetkfxfFbcYwpfQvoEgwWgsivYkE+JhcNIRF+F9zNQhPjEDKWGrt6qvhIJeQKj5JDTZOD1YNZHMw3od5xco6B99wnjfttGCgHoyS1OwY9BnY/WcSBGDplwtt6i9njQx5t7rUpzDSXylV6E+orIw2tc3scjAVH4f9S2tWHuM2T/FbUD5BtisD6wokOA8LnWoFhciqRTpfbb+dLxBb9Cafl4GB3fel7hdB5/0Ei4bz6tCa3aMH7SnjP/Q5qMUquOthJ5+XLqJma5dcEAEErJFqJxtA== 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:52:40 +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:52:40 +0000 From: "Xia, Chenbo" To: "Coquelin, Maxime" , "dev@dpdk.org" , "david.marchand@redhat.com" , "eperezma@redhat.com" Subject: RE: [PATCH v1 09/21] net/virtio: refactor indirect desc headers init Thread-Topic: [PATCH v1 09/21] net/virtio: refactor indirect desc headers init Thread-Index: AQHZBNRxwGM8eE3/WUG0HZGFBzV716629fTA Date: Mon, 30 Jan 2023 07:52:40 +0000 Message-ID: References: <20221130155639.150553-1-maxime.coquelin@redhat.com> <20221130155639.150553-10-maxime.coquelin@redhat.com> In-Reply-To: <20221130155639.150553-10-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: 6579e110-b34c-4eb0-cea0-08db0296f67e 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: T//EJcweIssL9A3bL5DNajzMyn3ghaZzD+wbXVW3fUICZvIT+ikNTi8BQw8rlQtbEf8jq2zpbPIcNS6F7hSvGpZ6laBrmzeu4V+zy/nwnulxMup6cWsK+h6lEhaKeKBmwCeS6f/0IWsWeFnLr5fLJaPzk0Or3nWePOG0r6EzqAFjjPiZhFbF86Uv0Oq5LjVpnj1swLNVFQhYbZfQdZTg2tFFLg82zm1yiuxf7rwy42ZYEXpRb2UWmTCdGyhAvZu+XaCExJILP75u5QXWxnWTonJD6bbLnHARs4kHODCBcWbs6j8or2RLIYxFOwwzcAOk8/qIBnptr+shqBzDJuur59uGmcqjBI8uUhPwCR4mSYESCH/d9G0IsAbI5E4eJh59d3CsJeKy4OmXruVGrN0BDclvz91uKXz05D/kBz5ZmILW0G/G2nWKlD8SrOzMq4t1HBwa448rm/RoGUkZKmafh2JA62iTEigeGx3WO8aHyVmPYfaNeefoX9rzEf9VZGouMpXCIWE3gVjhcAodn+Sg12rkheZa1Pl59Xztkj2FDf4xYpf0m3gnWpaEUt6PfqE1ZGhaZ8sYy2SFcKHTNT2QJixAR44+VUuGA6x/WuMxHVcwJANFmU1vZ/BLeiRobrgtKKLZVoUnjD6S1Kml+AcOkKuVkcg6D/3tHqv6Z3El5KKfTmXWjsrreX9COHSJsm4+YV1q5EMcCm0iFwm5nwHf3A== 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)(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?AhjeZSYRrjkt8bjwj+E/yz6+kBedpVtqEmzhflpvqIZth3OokmcDXmv4kvHH?= =?us-ascii?Q?FMPchWyRZWhll+Dre81cXxL2NzJMmb5eUEOyp/uSWX/tl1alKdNYMqLV2IKl?= =?us-ascii?Q?IXCGcRIX993AWOU4kXrUtkThBZ0zwBwZ2LzwfTQQaShzAd41vmCfWzHjYucq?= =?us-ascii?Q?IcKUIljeFdRmWSkpB2vihv1/+YLKzEEKitEFYsgOPJC5F6ZXFOuEu6nxJgEV?= =?us-ascii?Q?5LcUb9Jw52CmGxcre+KxG/KgLOgPbgRNul4tHsCLE18zjxr0GDmBXAYRNuCv?= =?us-ascii?Q?z8F7BZUraGxYJBEKVVkVOSVzZ6CLnjpfsTTlODjyn66u7uidNPNCTD5qdj4b?= =?us-ascii?Q?dLlip2ruS5ozFlSxiVvhmtMpmnzNMXfIceruRnhMkmll2fxLfRBhEgqwEqy1?= =?us-ascii?Q?oJpq0VnSng+dxpdjQE9+GtQozDqXyaaJJvxuY1A6YFWG3oDjSNX5hUv4UgGW?= =?us-ascii?Q?ruva1ELAsx5Wjt0XdzWEzYVuF/5ULxJWDJrrnkojxF50NtNUj/OMvcvQRYLe?= =?us-ascii?Q?+hBya0NEm+LDSqWuDlRLviOxFGMWLRof0C1j94Ggj2Le3/IbCF2bqwHJdONg?= =?us-ascii?Q?LIXB8INVKc9sxg5jwZQMQ1ZGCmUMmVDw0zakcJ8AccKVRRzR1SGBD7XUnLKm?= =?us-ascii?Q?cb/JDsgSt/O8kDzTUPylYiyHIgKPbr5p2U+bepijkVYAoHTiVndCWMuX6OOI?= =?us-ascii?Q?z/M6I7+nVjRpSTl8z3aAgQl1umaO5fjaeCv7JI50F7n1w+ibbw81ekWbR1Or?= =?us-ascii?Q?Oc5ahWFXGBthMJTK4qTl3uQGSKf8WErCjsKsJ76MHYLtS9gDst4zffThh27u?= =?us-ascii?Q?wohyB9DbDQavkIiFkyJJz5Rnp0MnYcx6TdJg4H0QT4Xw53f86+/echDJYrp4?= =?us-ascii?Q?8qPDJ7O1Qk1b9V4c1WIaipU8JWg3DPtaioYPxAqkO7Qkify2nLBhwL9n5s3l?= =?us-ascii?Q?UqRXnxGp7xeWh3+RYGuy6XvtubV0xCPF1Tx1hS3qf9sb17Ko3xiQ7XdUomIL?= =?us-ascii?Q?HjoneLpBrHIDL7Inop1UEiHM7LI+/uqi7R/rvgd2FUgIjk4Dbv87L6BSNCDD?= =?us-ascii?Q?hc1m6OAGv2x3ABFncX7rejVga/G48tE1zFBUvHOaCf7FrlRkDygSrwd08cHn?= =?us-ascii?Q?je4Qn+lp6jQr+gkPWOiXwoPiGPd5x4YVkT7aQ18ZdOerayhhmWm9DBk+sa+9?= =?us-ascii?Q?05rCKIVr7bCVhlyEvXF6seq+SnMTbuNrGUX0O9kF1a/lgjpdvIWyYIBIVICD?= =?us-ascii?Q?ObtmPgtcbHEetcyuLqrEZmA9MXOSFWC8/i8auLlyOE+FoqVNNLl3Nmh7lJBV?= =?us-ascii?Q?0RA2jRm3NYZAxWRG3u8nLCqrGQIAXnaxrSL2EdBI+nkLxZJsGv3I/645S3Sg?= =?us-ascii?Q?ya35IiFhT73I50695YqiKffD2QSCvP0UuMRLrDbaTGGg/GuPrrnXF0HRZtF2?= =?us-ascii?Q?k5oBYvFzufmyYyhTUUEh0Tqz56kQvj4Ljolw7sbhlX6jTkleRlaMRWmq+r1Z?= =?us-ascii?Q?fFV6oURqcD0QQj0U7x76lJGCgko3L7J9YvJ3JAIKmLbueybS+QmwwPKFiCA6?= =?us-ascii?Q?8RyHqkCcGfiok5I7+6PjEx6IzbZrcMdUO0UN1xZI?= 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: 6579e110-b34c-4eb0-cea0-08db0296f67e X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Jan 2023 07:52:40.6756 (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: R0TpjYFgPZ1H4ooOWB+HUibcif6cZb0pU98IspwJCsgCi7zxU7sq8gh6TqI0lOs7EtLpOwze3H4+Dj54SkpiIg== 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 > -----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 09/21] net/virtio: refactor indirect desc headers init >=20 > This patch refactors the indirect descriptors headers > initialization in a dedicated function, and makes it used > by both queue init and reset functions. >=20 > Signed-off-by: Maxime Coquelin > --- > drivers/net/virtio/virtio_ethdev.c | 30 +------------ > drivers/net/virtio/virtqueue.c | 68 ++++++++++++++++++++++-------- > drivers/net/virtio/virtqueue.h | 2 + > 3 files changed, 54 insertions(+), 46 deletions(-) >=20 > diff --git a/drivers/net/virtio/virtio_ethdev.c > b/drivers/net/virtio/virtio_ethdev.c > index b546916a9f..8b17b450ec 100644 > --- a/drivers/net/virtio/virtio_ethdev.c > +++ b/drivers/net/virtio/virtio_ethdev.c > @@ -347,7 +347,6 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t > queue_idx) > unsigned int vq_size, size; > struct virtio_hw *hw =3D dev->data->dev_private; > struct virtnet_rx *rxvq =3D NULL; > - struct virtnet_tx *txvq =3D NULL; > struct virtnet_ctl *cvq =3D NULL; > struct virtqueue *vq; > void *sw_ring =3D NULL; > @@ -465,7 +464,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t > queue_idx) > rxvq =3D &vq->rxq; > rxvq->fake_mbuf =3D fake_mbuf; > } else if (queue_type =3D=3D VTNET_TQ) { > - txvq =3D &vq->txq; > + virtqueue_txq_indirect_headers_init(vq); > } else if (queue_type =3D=3D VTNET_CQ) { > cvq =3D &vq->cq; > hw->cvq =3D cvq; > @@ -477,33 +476,6 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t > queue_idx) > else > vq->mbuf_addr_offset =3D offsetof(struct rte_mbuf, buf_iova); >=20 > - if (queue_type =3D=3D VTNET_TQ) { > - struct virtio_tx_region *txr; > - unsigned int i; > - > - txr =3D txvq->hdr_mz->addr; > - for (i =3D 0; i < vq_size; i++) { > - /* first indirect descriptor is always the tx header */ > - if (!virtio_with_packed_queue(hw)) { > - struct vring_desc *start_dp =3D txr[i].tx_indir; > - vring_desc_init_split(start_dp, > - RTE_DIM(txr[i].tx_indir)); > - start_dp->addr =3D txvq->hdr_mem + i * sizeof(*txr) > - + offsetof(struct virtio_tx_region, tx_hdr); > - start_dp->len =3D hw->vtnet_hdr_size; > - start_dp->flags =3D VRING_DESC_F_NEXT; > - } else { > - struct vring_packed_desc *start_dp =3D > - txr[i].tx_packed_indir; > - vring_desc_init_indirect_packed(start_dp, > - RTE_DIM(txr[i].tx_packed_indir)); > - start_dp->addr =3D txvq->hdr_mem + i * sizeof(*txr) > - + offsetof(struct virtio_tx_region, tx_hdr); > - start_dp->len =3D hw->vtnet_hdr_size; > - } > - } > - } > - > if (VIRTIO_OPS(hw)->setup_queue(hw, vq) < 0) { > PMD_INIT_LOG(ERR, "setup_queue failed"); > ret =3D -EINVAL; > diff --git a/drivers/net/virtio/virtqueue.c > b/drivers/net/virtio/virtqueue.c > index 41e3529546..fb651a4ca3 100644 > --- a/drivers/net/virtio/virtqueue.c > +++ b/drivers/net/virtio/virtqueue.c > @@ -143,6 +143,54 @@ virtqueue_rxvq_flush(struct virtqueue *vq) > virtqueue_rxvq_flush_split(vq); > } >=20 > +static void > +virtqueue_txq_indirect_header_init_packed(struct virtqueue *vq, uint32_t > idx) > +{ > + struct virtio_tx_region *txr; > + struct vring_packed_desc *desc; > + rte_iova_t hdr_mem; > + > + txr =3D vq->txq.hdr_mz->addr; > + hdr_mem =3D vq->txq.hdr_mem; > + desc =3D txr[idx].tx_packed_indir; > + > + vring_desc_init_indirect_packed(desc, > RTE_DIM(txr[idx].tx_packed_indir)); > + desc->addr =3D hdr_mem + idx * sizeof(*txr) + offsetof(struct > virtio_tx_region, tx_hdr); > + desc->len =3D vq->hw->vtnet_hdr_size; > +} > + > +static void > +virtqueue_txq_indirect_header_init_split(struct virtqueue *vq, uint32_t > idx) > +{ > + struct virtio_tx_region *txr; > + struct vring_desc *desc; > + rte_iova_t hdr_mem; > + > + txr =3D vq->txq.hdr_mz->addr; > + hdr_mem =3D vq->txq.hdr_mem; > + desc =3D txr[idx].tx_indir; > + > + vring_desc_init_split(desc, RTE_DIM(txr[idx].tx_indir)); > + desc->addr =3D hdr_mem + idx * sizeof(*txr) + offsetof(struct > virtio_tx_region, tx_hdr); > + desc->len =3D vq->hw->vtnet_hdr_size; > + desc->flags =3D VRING_DESC_F_NEXT; > +} > + > +void > +virtqueue_txq_indirect_headers_init(struct virtqueue *vq) > +{ > + uint32_t i; > + > + if (!virtio_with_feature(vq->hw, VIRTIO_RING_F_INDIRECT_DESC)) > + return; > + > + for (i =3D 0; i < vq->vq_nentries; i++) > + if (virtio_with_packed_queue(vq->hw)) > + virtqueue_txq_indirect_header_init_packed(vq, i); > + else > + virtqueue_txq_indirect_header_init_split(vq, i); > +} > + > int > virtqueue_rxvq_reset_packed(struct virtqueue *vq) > { > @@ -182,10 +230,7 @@ virtqueue_txvq_reset_packed(struct virtqueue *vq) > { > int size =3D vq->vq_nentries; > struct vq_desc_extra *dxp; > - struct virtnet_tx *txvq; > uint16_t desc_idx; > - struct virtio_tx_region *txr; > - struct vring_packed_desc *start_dp; >=20 > vq->vq_used_cons_idx =3D 0; > vq->vq_desc_head_idx =3D 0; > @@ -197,10 +242,8 @@ virtqueue_txvq_reset_packed(struct virtqueue *vq) > vq->vq_packed.cached_flags =3D VRING_PACKED_DESC_F_AVAIL; > vq->vq_packed.event_flags_shadow =3D 0; >=20 > - txvq =3D &vq->txq; > - txr =3D txvq->hdr_mz->addr; > memset(vq->mz->addr, 0, vq->mz->len); > - memset(txvq->hdr_mz->addr, 0, txvq->hdr_mz->len); > + memset(vq->txq.hdr_mz->addr, 0, vq->txq.hdr_mz->len); >=20 > for (desc_idx =3D 0; desc_idx < vq->vq_nentries; desc_idx++) { > dxp =3D &vq->vq_descx[desc_idx]; > @@ -208,20 +251,11 @@ virtqueue_txvq_reset_packed(struct virtqueue *vq) > rte_pktmbuf_free(dxp->cookie); > dxp->cookie =3D NULL; > } > - > - if (virtio_with_feature(vq->hw, VIRTIO_RING_F_INDIRECT_DESC)) > { > - /* first indirect descriptor is always the tx header */ > - start_dp =3D txr[desc_idx].tx_packed_indir; > - vring_desc_init_indirect_packed(start_dp, > - > RTE_DIM(txr[desc_idx].tx_packed_indir)); > - start_dp->addr =3D txvq->hdr_mem + desc_idx * sizeof(*txr) > - + offsetof(struct virtio_tx_region, tx_hdr); > - start_dp->len =3D vq->hw->vtnet_hdr_size; > - } > } >=20 > + virtqueue_txq_indirect_headers_init(vq); > vring_desc_init_packed(vq, size); > - > virtqueue_disable_intr(vq); > + > return 0; > } > diff --git a/drivers/net/virtio/virtqueue.h > b/drivers/net/virtio/virtqueue.h > index 8b7bfae643..d453c3ec26 100644 > --- a/drivers/net/virtio/virtqueue.h > +++ b/drivers/net/virtio/virtqueue.h > @@ -384,6 +384,8 @@ int virtqueue_rxvq_reset_packed(struct virtqueue *vq)= ; >=20 > int virtqueue_txvq_reset_packed(struct virtqueue *vq); >=20 > +void virtqueue_txq_indirect_headers_init(struct virtqueue *vq); > + > static inline int > virtqueue_full(const struct virtqueue *vq) > { > -- > 2.38.1 Reviewed-by: Chenbo Xia