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 F39BB424BD; Mon, 30 Jan 2023 08:52:55 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DC49541144; Mon, 30 Jan 2023 08:52:55 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id A995F40C35 for ; Mon, 30 Jan 2023 08:52:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675065157; x=1706601157; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=47oEKUWY40EnanxXduKtxzXn/ZaoAy1b8Fa3RVszwdE=; b=GCqoGRfcStVdFCMJ5kSM9jixSlsxtVLCQE5hmFZZ/J2f9m9sKapBzdn7 7NpY7BSt9AJhoeA5DWhLOW09J9vFRoLXjMru+Q1O2E8/c2YgSgey9SdGy LSgL4AXitLLSNSRxfhxH7WzdKhUG6d3E7deM9rilGZGLQ9+8xYyvX3Mox pWnFojLOhin5yQSuGLAirkTKUGX+m/gv8MVVYI0y8WMom0t5Pd3lMVY57 iwm1WV505ylMatokYVPB/KW9HzsEzyPoB8xDhvADBy8+8VntQq7EFx2CL 0tKG3/Sr0rV3uZ2KLSl/bRpFOnomoC4kcr8RZyoe22ed0dfl6l3IQeX8t g==; X-IronPort-AV: E=McAfee;i="6500,9779,10605"; a="413718080" X-IronPort-AV: E=Sophos;i="5.97,257,1669104000"; d="scan'208";a="413718080" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jan 2023 23:52:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10605"; a="752723263" X-IronPort-AV: E=Sophos;i="5.97,257,1669104000"; d="scan'208";a="752723263" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by FMSMGA003.fm.intel.com with ESMTP; 29 Jan 2023 23:52:36 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) 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:36 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx610.amr.corp.intel.com (10.18.126.90) 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:36 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) 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:36 -0800 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.40) 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:35 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dir0YDXcLDxSdCBgfD5Zyue0p/mSPvmHhxYznTIre9eyXF57wGjXV+HPDcbPRdXRVw9bPqoCxQdZJD+MLonXshgO1eSK3XjjTpnIP3pXVDOMARJcVk1lxcvIMwDGwvkXanKZpldhqEm1JnMDgadKrpsBojxMSD+W+08CIVvRFzBHWZ5OW1dGyvijK6WQaSo3HDvl2bGm7KPF0Z2g0kO8JOt62cOPU8Y6Pldaq1Fuu6UR7i+H/Y+dSHn8QXRsHewVoAs6MI7/QqXD9NRxZMDvc0wC3ImqTuTxj5NXPhD5rlxPavAnf9YZzAho9boBHU/tLgN+TIx9Rt+tc2WwIMzekA== 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=2rEdgHYPPSeL0DkKqIgKUPR4KGzNs+lywvfLnOXpwJk=; b=CdKkJMQ/fvAdb4Em20ZXOlykOLUTw+Kjw1o1ZqEaz4FORXUotX4CtV0e2LEZrw9w5jN5mGWXpPr+V6YfBsJuNkBLzR+GwX2nc7AFm42ax3ok0klgbumyejsagxUxwsSQJ+0Kl+qXvVX3oPBrcKE10aAi5GUwXlz4ijbhDdBFH7fbUhlQt3wkI0iJW/WxVlNfPtgqtCd1wdyidxO2ic0+hDGGo1u9JaaJukY9PLR22EM9+qy63duuiShPU+kqpzaSTe9ddnMmf7PMkmBc+AmTDcc7Hx69UOAB3mywNHHCIaKkvAYErP9Fw9UXEup07xqVJYPXRvCyyeYyGWlZ40lCNg== 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:31 +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:31 +0000 From: "Xia, Chenbo" To: "Coquelin, Maxime" , "dev@dpdk.org" , "david.marchand@redhat.com" , "eperezma@redhat.com" Subject: RE: [PATCH v1 08/21] net/virtio: move vring memzone to virtqueue struct Thread-Topic: [PATCH v1 08/21] net/virtio: move vring memzone to virtqueue struct Thread-Index: AQHZBNRsjLc4/ER4nUa6tpQKssjed6629enw Date: Mon, 30 Jan 2023 07:52:31 +0000 Message-ID: References: <20221130155639.150553-1-maxime.coquelin@redhat.com> <20221130155639.150553-9-maxime.coquelin@redhat.com> In-Reply-To: <20221130155639.150553-9-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: 73081905-59ee-409f-38c5-08db0296f11f 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: UfQjzi2h93Qn2BySZDk9ILmSHRmaQKEJfLSV70QiUMrL7/rmJ0Y4uDAT+wsXS8+FoxnVZqLiW2Hg0A/e9Q/715v2BKGM3Z7aGzAvnD3HmuKnBlTWDHLnnwCSnDg5SzYV3u6VRkqDmq5PONVMGqmVr4JZmsn73Bz9LADIFssc/bWQI1ZhEK+ogOgisFf4c90M0FZXcXvxeif0EkyEeNGBY/z4oBNQIsnTCTdCn6EmHwA3ZjaQ3sLVcwq2wyRBolTqCNsC2lrGMxQz7jB30siWLYigqO8pymtwHzASuyaD022EwJ0MqJXHefj7e5YZ7slp5rm0pTPflPePdrlbATVHP02bwYDcPTGtflMSf3L6Sb+T4BTbET1H5ya+n9tjv+Luqbm2aCN5ZI83jVq5ySEuzs/ow9LvwIs7ctAfFfaRJUiA9vuRWn1ZVoovD+jeQ7PERDqrJxhWVIlsyXTVUy/WXLxTemO4nWikNp7g65S9PKULKK4dW0r2FvX8+whLh7vy+zSOLy+cthuP1+KNOh2vprs0stHB+qRYJZDgFRPDxEQbIngVo+xykeZO2T+b2sD9oxCz80IMvEQI20sqUHt+jwG50W9oaIB1HeeAeZP304S1bZq5fHA7z+FTcNwINclOBbcAz42TV+whdHqu5YY9R4H17qI2hamcDzdyOg9eA3ovG+sjikTgeiwl4Pj8iMj+rNsGqp8PQtZMlGZXCeFNfQ== 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?4XsFhJAt377ndZUGAHiBI8c/gczmUzQAymQp+0lqrHhppowsRqbByP/kS9R9?= =?us-ascii?Q?mdFvB9gyIxQt4qLlOD1a879D4ibcfWWPD8fok8BlUuHuSGZZtKZdDZ6ZmzFV?= =?us-ascii?Q?BhFBFJ3xfn+CTJjvekuyEWwEuqoj8cEJ/niMlVFzSt7tqbrw9fQcAlL2OYI/?= =?us-ascii?Q?9G+7t1YmVbWHaMfu6urLYG1O6wAlURf+LeCJKeBriiCQR6edSCHSEQQd1a0v?= =?us-ascii?Q?jbs1Msh2JVMGimtF0y+MA0rpZDVgdHcZB/92UnVY/qCyu/3PSXuqekyiiazW?= =?us-ascii?Q?6k9JIOErHAsZ6rDWIJALDNeBNOK2NGwy4NR3bq+SXjR6CidSxH/N/cHv+B2d?= =?us-ascii?Q?VkuKBQdj4YbWEmEGzv4mFCdicO20xpbhoMCRkBaPMl2q+d3AGgv0SbdfW9Lk?= =?us-ascii?Q?G7i26jsZyjDTDGutPTLniaxxXCBlJK00+573Lg9pnIExn932lBL4w2jFHt0T?= =?us-ascii?Q?NdRCjeFrKduebbcCrswgP0lZExQvH5L81aPkTNJlb1VIPM35G/cZ4b0l3JZk?= =?us-ascii?Q?XBToD0MNn0GPGj4JsiptWmhbcwRSf3dOVycgEl5pkKlbv+5ApvPqT9Rvv26p?= =?us-ascii?Q?OnlOzNa+rstWUBwCySgNzZX6tq9g0AUMd+sgoOXTWPVYnqHhPaJbIdehBXth?= =?us-ascii?Q?N9nQh7BXER+e8F/QAKAjgvcuX75EY8LwSqFUgYH3SeXn6Pn47CVUXlbkti1D?= =?us-ascii?Q?fT0c50scEquFSImgNFg1L3MaaJite+JIgfX3+/B3CD/qm5ookcTK37/OmXiT?= =?us-ascii?Q?da3RQNe7VnZelRCD76yKPkYmePs8IylGUnriek35vhBm01++Nlaj4I4TyRfB?= =?us-ascii?Q?fHlNAXpO2ZPtvmSNEDx7BAAi0d+VrU9NplR6Nb23PWMtUVF1RAUOYBC2Ml1M?= =?us-ascii?Q?GigQ6mR4BBgVQNtPJMyG0i5EfUEJfoxtR6647u2/bNQKEp1BhkLJ0h1Y7KnX?= =?us-ascii?Q?IC8Hsq72QqI4x5bAMZr+IDWXiT8+UC3mnujkYt8AOL0oitkEgvk5bizTTAI/?= =?us-ascii?Q?8iWAPs73sCOcGuesshavqGOcL4Hgs95DSbkuwfBd4154sUuxdiU84yVVhUaf?= =?us-ascii?Q?wo/LEGDgsg11rcO/0NItWtNi2aPKbF57302y7eK5GZyEOXQ1ZV/KLsKCwR1K?= =?us-ascii?Q?NnzznlvWlEN+neRqyAgO0GK5UQyKHhjwKVLiHdzHo4goigye7wGAjBZvg1nW?= =?us-ascii?Q?xN311LzV2pOvTYT84s/qQUDEUpWepDL1V5xXjAarGZNQv7KEV2DmQc6DIspI?= =?us-ascii?Q?IqbKJYQD62cbGBc653k9rokMXYAhaLmOdWvuNbn3b1Ny9HmzB2Zf6IudrOT7?= =?us-ascii?Q?EEUt0wcOIwgFaA8inwBZ/5sc22lNJaLPGXD2IjFS2ULro7igYG5w0k8VoBtb?= =?us-ascii?Q?vGiwDTTyuLjjlwwuqIaljA3OQsH6RUZEGK6BpWVwHMoBRI0Q2YIk++rjU4eh?= =?us-ascii?Q?lj3vmehpL090l6mEPjxu6fYCKEMdyjxn/JfQ96H/A6nDWYA6TYODRR5c9+dT?= =?us-ascii?Q?BHL0w/zrtaYJrUYrrRSFfIVLAtsG/CL3okrWySJHO5FU1lWgbz08Mbib5dNG?= =?us-ascii?Q?cdbj9tef1FNdr1/YOtbZpYSCns8kFpY/X5d7tp9+?= 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: 73081905-59ee-409f-38c5-08db0296f11f X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Jan 2023 07:52:31.6606 (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: DDsAFCqc0CIksZOYChvp1SYploZJE5Pe4CCit7M4TqjTCgbbeDYWN0RkL+o2hdv4EM/Fe9JP3Dh8D8VypY1CQg== 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 08/21] net/virtio: move vring memzone to virtqueue > struct >=20 > Whatever its type (Rx, Tx or Ctl), all the virtqueue > require a memzone for the vrings. This patch moves its > pointer to the virtqueue struct, simplifying the code. >=20 > Signed-off-by: Maxime Coquelin > --- > drivers/net/virtio/virtio_cvq.h | 1 - > drivers/net/virtio/virtio_ethdev.c | 11 ++--------- > drivers/net/virtio/virtio_rxtx.h | 4 ---- > drivers/net/virtio/virtqueue.c | 6 ++---- > drivers/net/virtio/virtqueue.h | 1 + > 5 files changed, 5 insertions(+), 18 deletions(-) >=20 > diff --git a/drivers/net/virtio/virtio_cvq.h > b/drivers/net/virtio/virtio_cvq.h > index 0ff326b063..70739ae04b 100644 > --- a/drivers/net/virtio/virtio_cvq.h > +++ b/drivers/net/virtio/virtio_cvq.h > @@ -108,7 +108,6 @@ typedef uint8_t virtio_net_ctrl_ack; > struct virtnet_ctl { > const struct rte_memzone *hdr_mz; /**< memzone to populate hdr. */ > rte_iova_t hdr_mem; /**< hdr for each xmit packet */ > - const struct rte_memzone *mz; /**< mem zone to populate CTL ring. > */ > rte_spinlock_t lock; /**< spinlock for control queue. > */ > void (*notify_queue)(struct virtqueue *vq, void *cookie); /**< > notify ops. */ > void *notify_cookie; /**< cookie for notify ops */ > diff --git a/drivers/net/virtio/virtio_ethdev.c > b/drivers/net/virtio/virtio_ethdev.c > index a581fae408..b546916a9f 100644 > --- a/drivers/net/virtio/virtio_ethdev.c > +++ b/drivers/net/virtio/virtio_ethdev.c > @@ -423,6 +423,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t > queue_idx) >=20 > memset(mz->addr, 0, mz->len); >=20 > + vq->mz =3D mz; > if (hw->use_va) > vq->vq_ring_mem =3D (uintptr_t)mz->addr; > else > @@ -462,14 +463,11 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t > queue_idx) >=20 > vq->sw_ring =3D sw_ring; > rxvq =3D &vq->rxq; > - rxvq->mz =3D mz; > rxvq->fake_mbuf =3D fake_mbuf; > } else if (queue_type =3D=3D VTNET_TQ) { > txvq =3D &vq->txq; > - txvq->mz =3D mz; > } else if (queue_type =3D=3D VTNET_CQ) { > cvq =3D &vq->cq; > - cvq->mz =3D mz; > hw->cvq =3D cvq; > vq->cq.notify_queue =3D &virtio_control_queue_notify; > } > @@ -550,15 +548,10 @@ virtio_free_queues(struct virtio_hw *hw) > if (queue_type =3D=3D VTNET_RQ) { > rte_free(vq->rxq.fake_mbuf); > rte_free(vq->sw_ring); > - rte_memzone_free(vq->rxq.mz); > - } else if (queue_type =3D=3D VTNET_TQ) { > - rte_memzone_free(vq->txq.mz); > - } else { > - rte_memzone_free(vq->cq.mz); > } >=20 > virtio_free_queue_headers(vq); > - > + rte_memzone_free(vq->mz); > rte_free(vq); > hw->vqs[i] =3D NULL; > } > diff --git a/drivers/net/virtio/virtio_rxtx.h > b/drivers/net/virtio/virtio_rxtx.h > index a5fe3ea95c..57af630110 100644 > --- a/drivers/net/virtio/virtio_rxtx.h > +++ b/drivers/net/virtio/virtio_rxtx.h > @@ -25,8 +25,6 @@ struct virtnet_rx { >=20 > /* Statistics */ > struct virtnet_stats stats; > - > - const struct rte_memzone *mz; /**< mem zone to populate RX ring. */ > }; >=20 > struct virtnet_tx { > @@ -34,8 +32,6 @@ struct virtnet_tx { > rte_iova_t hdr_mem; /**< hdr for each xmit packet */ >=20 > struct virtnet_stats stats; /* Statistics */ > - > - const struct rte_memzone *mz; /**< mem zone to populate TX ring. > */ > }; >=20 > int virtio_rxq_vec_setup(struct virtnet_rx *rxvq); > diff --git a/drivers/net/virtio/virtqueue.c > b/drivers/net/virtio/virtqueue.c > index 3b174a5923..41e3529546 100644 > --- a/drivers/net/virtio/virtqueue.c > +++ b/drivers/net/virtio/virtqueue.c > @@ -148,7 +148,6 @@ virtqueue_rxvq_reset_packed(struct virtqueue *vq) > { > int size =3D vq->vq_nentries; > struct vq_desc_extra *dxp; > - struct virtnet_rx *rxvq; > uint16_t desc_idx; >=20 > vq->vq_used_cons_idx =3D 0; > @@ -162,8 +161,7 @@ virtqueue_rxvq_reset_packed(struct virtqueue *vq) > vq->vq_packed.event_flags_shadow =3D 0; > vq->vq_packed.cached_flags |=3D VRING_DESC_F_WRITE; >=20 > - rxvq =3D &vq->rxq; > - memset(rxvq->mz->addr, 0, rxvq->mz->len); > + memset(vq->mz->addr, 0, vq->mz->len); >=20 > for (desc_idx =3D 0; desc_idx < vq->vq_nentries; desc_idx++) { > dxp =3D &vq->vq_descx[desc_idx]; > @@ -201,7 +199,7 @@ virtqueue_txvq_reset_packed(struct virtqueue *vq) >=20 > txvq =3D &vq->txq; > txr =3D txvq->hdr_mz->addr; > - memset(txvq->mz->addr, 0, txvq->mz->len); > + memset(vq->mz->addr, 0, vq->mz->len); > memset(txvq->hdr_mz->addr, 0, txvq->hdr_mz->len); >=20 > for (desc_idx =3D 0; desc_idx < vq->vq_nentries; desc_idx++) { > diff --git a/drivers/net/virtio/virtqueue.h > b/drivers/net/virtio/virtqueue.h > index f5058f362c..8b7bfae643 100644 > --- a/drivers/net/virtio/virtqueue.h > +++ b/drivers/net/virtio/virtqueue.h > @@ -201,6 +201,7 @@ struct virtqueue { > struct virtnet_ctl cq; > }; >=20 > + const struct rte_memzone *mz; /**< mem zone to populate ring. */ > rte_iova_t vq_ring_mem; /**< physical address of vring, > * or virtual address for virtio_user. */ >=20 > -- > 2.38.1 Reviewed-by: Chenbo Xia