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 B42CFA0543; Fri, 7 Oct 2022 22:20:51 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A0A0F400D5; Fri, 7 Oct 2022 22:20:51 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 9A66940042 for ; Fri, 7 Oct 2022 22:20:50 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 297FLi49007139; Fri, 7 Oct 2022 13:20:44 -0700 Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2177.outbound.protection.outlook.com [104.47.56.177]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3k2ppes52g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Oct 2022 13:20:44 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TcubHpLBfPjxurpME4LEAf6q7+jdFWBPkPu0cD+yOV9VC0QEtkppEFaXH6pt15bwXNurNBx48b3JPtmFLCB86NXzLUMAVNW/hf48ummpyrlXrvhxOFZTwBHBpTrO10TeSeEPOgCd7RbrR0VT6jMxemu4taXstXVaj18CvG0kliSmL8DwSuVMsbHue18rvT8+8X8umdUuVKsKDIq8reQi//JJPp8CTpaJBuS1FAyPsrwBeIiVLbnEgdF/YBVsjePhIr0KXUXE1A36JdncNwCwNJanq8FILpg+VNj8tWn+W39u1ozqI3kV9L+hiUdPbFTdRsDdiQGA1K4RuDyPg1Mdxg== 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=PsK2SMdDXFsgxcGSkqT4yX5HlgCMstbEB+crf6ty9mA=; b=ekcU8GGtZQ0rGcZayBPz+KzlxYFsEKKIMsVJo6PsjaJAsleaHMARMxzxFdY/9FwRLvlOfK9iBjkV+/UbnLhU+9oV0DauTcEW6q/CxisHg4VAc4Ml/jY8JKpS63r8YJFWEmO+qjjDO69+5z/WkPMQ7RDw0PDas7wSJB3nrpi+Kd4QJVfKV9AzWKd0eOosGeyjB+g9mzKLXaYBT20mmVxutBhvvyU7gKJCGVZqAqESZrtPDpYue58ajD9D+SbHI7Dqj6qO9iejdEtab61rNM1yDerPZFCsDk3X8y67KrpfrZ4f4f+JvaWxmDopwSqeydfpe3Ez3doyD1l/yYdCRawcxA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PsK2SMdDXFsgxcGSkqT4yX5HlgCMstbEB+crf6ty9mA=; b=ugM6Gw14xMGbDG764yQNeQsaQx7mu8EoC1HJXlzwqyUSu/g4iLQZ2oKI95kuPESmOnv5JR0aRw95tg7Amt2KA3DMc1jjKpIqcFiQliMS/ohdVk+sUf10/HgrdX5hJLnkahNO02WPMh5JJ3JoMUrBuRfo/l+nE0KBxj1tBYPkx5w= Received: from PH0PR18MB4425.namprd18.prod.outlook.com (2603:10b6:510:ef::13) by CH0PR18MB4177.namprd18.prod.outlook.com (2603:10b6:610:bc::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15; Fri, 7 Oct 2022 20:20:42 +0000 Received: from PH0PR18MB4425.namprd18.prod.outlook.com ([fe80::16f8:9275:a441:cfec]) by PH0PR18MB4425.namprd18.prod.outlook.com ([fe80::16f8:9275:a441:cfec%6]) with mapi id 15.20.5676.028; Fri, 7 Oct 2022 20:20:42 +0000 From: Shijith Thotton To: Olivier Matz CC: "dev@dpdk.org" , "Honnappa.Nagarahalli@arm.com" , "bruce.richardson@intel.com" , Jerin Jacob Kollanukkaran , "mb@smartsharesystems.com" , "stephen@networkplumber.org" , "thomas@monjalon.net" , "ferruh.yigit@amd.com" , Pavan Nikhilesh Bhagavatula , Nicolas Chautru , Ciara Power , Konstantin Ananyev , Reshma Pattan , Cristian Dumitrescu , Maxime Coquelin , Chenbo Xia Subject: RE: [EXT] Re: [PATCH v4 1/7] mbuf: add API to get and set mbuf physical address Thread-Topic: [EXT] Re: [PATCH v4 1/7] mbuf: add API to get and set mbuf physical address Thread-Index: AQHY2oNaoGUDcByJQEGyH6yPaddNmq4DXmCAgAAA5GA= Date: Fri, 7 Oct 2022 20:20:42 +0000 Message-ID: References: <8380a296e1b5e7775691fbe20966e267a37dbf1f.1665170500.git.sthotton@marvell.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH0PR18MB4425:EE_|CH0PR18MB4177:EE_ x-ms-office365-filtering-correlation-id: f795287f-c358-42cd-285f-08daa8a1688a x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: d0UWsH15rycOSnMyVwEswIxJH1tOBdlXruCD+I4CwdjCCzN1eyCYkcqoFbgM3J+X6VKhSXwmV2mRO+Bj4WWOQlaJqWCJOMk2YfAq0O2Xd9IDR705md6PLTq+b6biA2kgBN4mvgVN5KB0mLOP/2VaVEZTTpOQ8V2QkdDLABGXrWZ3c4PDs3bq618cAB2mFX2X4Z+PIFNR3+VoT6Ux9617lSW0sKiBuku+hxzA0AeRp1FQXEIu4S95Ou6H3KMlhECEj+u+gnyiDovkEToauUr9sd3m/XwGd1O4htJMJvxpgNzTA8xzFmtV9xEeDoLWyK4RJspBCTyhdpNv66AGcjuEuV2Ah6f8Yd1guAMGZEJ3+OsGelcN4Jbhs5LC+sjyRQl09RnIjDV+hu+yHFrSnrd1ch+NItOpRppgmBDlND7iFzbk2j8Wl+Gp4eUy2hGXGKpb/x3q+spXMcpzAsNB9PSMa9AABPj0m83Oa0xhwJYdUYP/nfoH6f1Hvtip1NeveR/rKem1Hw0w57QA3Nhqb3NJbb0l6GxCNGZ/RvzXyqissm2W4DAExAXDrjuDaB6axFgcDFcoA/lprGnOsF0bYwB1hXhYKR5xTNThmLFJ5aM+MnKhKFYqSdSMMfHIQQcySDw8we1fCyOPMCZkA4sbiInfQ1+1DWvobRCwEDGrfdv/XiMjiiN60Iu/4iFexHnJpEOdsGsRoLKZv3L/Fs4ZDqW2A5iVoeI1+vhxSbRn63g2SwXSPstuq7w43oeodeLu8nO3+EO/oTmgoebK1+mb8T/alw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR18MB4425.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(396003)(376002)(39860400002)(366004)(136003)(346002)(451199015)(2906002)(4326008)(54906003)(30864003)(66446008)(6916009)(66946007)(66556008)(8676002)(66476007)(7416002)(316002)(41300700001)(33656002)(71200400001)(52536014)(86362001)(478600001)(76116006)(64756008)(5660300002)(8936002)(6506007)(7696005)(186003)(83380400001)(38070700005)(122000001)(9686003)(38100700002)(26005)(55016003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?b9BSRdPT3kxjCHjnjVx84pU5ixJniVdrfaZU7YS6SkuWEyXGXu1wRzv0s60a?= =?us-ascii?Q?xXLSeUkONXR1X1JaAYt5dW1B7kHo2jFfQIpinngJ84xYqO2iUe4tOKsmuTWt?= =?us-ascii?Q?1E0LPYK+MzomGZ7k4fHCBNlxT23GWH2p2uIS5v/qCRZxVJbQV6sSiIMrFOjc?= =?us-ascii?Q?V18jAhrYxWpe9C3EE2fcuacSq977Frw0FYDvL4eM9UKVi0HvH4DYF3pbzXfU?= =?us-ascii?Q?N7pJ2IEWHNrIRykk/MeI36HxoGhx/+YmNOHsTAwidVGJBHdvzj87v2OG3NK9?= =?us-ascii?Q?Lz85xIynMYBRUYY5OkKJQARrtnWwaPW5HkQmXkDrh7SNqEQ61QhaXlUeFazb?= =?us-ascii?Q?i4N5PdSVL4PkDf8qWrT8UyRsx1wetxPDi+JS0ueeohAbOCNlVPWJpvN2G7Lh?= =?us-ascii?Q?zHDVLOMMqXmGtsyRX9qQq5/kQQXN1Rt1gQv8a5o6LCGdYo0/OHVHA4Y7wi/1?= =?us-ascii?Q?UpxoCJ7+763Kdlm78W//TS0Yeu1vbneJOxTGUkJ7VMbLq2iCJJF+WiHo4ov4?= =?us-ascii?Q?+Czog2GnWg3VOvFev5v3AHpMxXogpf7NvyMxFAaR8RZXLuehqOFT75C1BASz?= =?us-ascii?Q?aDCBqSFBT0GFqLkWuMNwvgbp10hrRd3eO8H/wJOCMkGD8+TioauB/31hcrv1?= =?us-ascii?Q?1sc1h9vYOtnD93mMAav17LGLEpq5GWZdy5FlGKsu3fwUwuVqhWZwNDpFNw/B?= =?us-ascii?Q?ygzVv4etJBlwSUjVHTVOlr7l/aOJkfm3T6aawYLBncK7WBhtZ4JFlRa/RSRS?= =?us-ascii?Q?LLJCIfZaerT1DT0OH05K5KVT/KhSDic1Pe9FGLCWEaZwgd/A78y40dR6Vcbx?= =?us-ascii?Q?jM6GDxZyUkjtK1LjWzOAkfxW8EDvlV+CMsT4WoF91x6x8RoV/P6j2CH3voBd?= =?us-ascii?Q?4wgAvheuaO+2NDTxhqWC3eommAxO8HME9eAYnAvIY/QL4a5/RwcPWvqTlYxN?= =?us-ascii?Q?Af7mKfo9vgrp58nb5x+A6DFwqj9Mb3tS3otjJpWg+nuJ7o8TXF8j+YXooGX7?= =?us-ascii?Q?odm6WznceNVOFSOxnJIXCMZ7zhswI+JHf8y9QSzZtsdAq11WmLD0FYSA4YjF?= =?us-ascii?Q?ogxApGkWuvb3sZsZSGKFId+pGgEXlVxY9ss2Jp5kgrpdp3utmVljpsMyiund?= =?us-ascii?Q?Vgwgd2dln0H6Vemc4rTS9SmA6+JoMYh5Dv6h+E11/7BzcEHxEpvIZfLUBNLc?= =?us-ascii?Q?DvsDyxut1pP+wp2by0mDNuBN5rkux2wfLB6/6SEUBxrxMg4yr5glk92Sh900?= =?us-ascii?Q?OnU+geNp99UB4q+xnVC3EAhAv45boIlLsdSkK0AYT7GHGQ0n6cqY6JwKfj+p?= =?us-ascii?Q?pg1H7QhlFOvlMZAYoRveb4QbVld44UTKBx74mSF5fMifDazwKm93896F/gtm?= =?us-ascii?Q?9p16Z7s2NALL7b3hTV7rh9fCV/rW2iO2ZmZirSLdC8tsTWOO9T/X9ZS3elSL?= =?us-ascii?Q?p9th/EFFD7h7oZ/b2IR7ERWKY6kKsevrTlnZkReqlJC69gnDud84f1zGl+KB?= =?us-ascii?Q?eXnbP/+fidnDkrHYrKMQSjgKihSzNDCkj+GsCHZ4iKpP1sSW26pjKofqrUzC?= =?us-ascii?Q?aXWiO0urDxWrULMBvYxdti7+rl2hCYWsk1V2JfF4?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: marvell.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR18MB4425.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f795287f-c358-42cd-285f-08daa8a1688a X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Oct 2022 20:20:42.2964 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Cub2hMBhd22KDAgJHysWcwRLWM2VsSjsYh5zThY1vPQa2Q1JCxMFA/SflbunWnbSwDktTDNoFsdLELXlVXSwKw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR18MB4177 X-Proofpoint-GUID: N5gAKBjegWR3fyHnsce9zNQn4R3SLt8W X-Proofpoint-ORIG-GUID: N5gAKBjegWR3fyHnsce9zNQn4R3SLt8W X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-10-07_04,2022-10-07_01,2022-06-22_01 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 Olivier, >On Sat, Oct 08, 2022 at 01:00:23AM +0530, Shijith Thotton wrote: >> Added APIs rte_mbuf_iova_set and rte_mbuf_iova_get to set and get the >> physical address of an mbuf respectively. Updated applications and >> library to use the same. >> >> Signed-off-by: Shijith Thotton >> --- >> app/test-bbdev/test_bbdev_perf.c | 2 +- >> app/test-crypto-perf/cperf_test_common.c | 5 ++--- >> app/test/test_bpf.c | 2 +- >> app/test/test_mbuf.c | 2 +- >> app/test/test_pcapng.c | 2 +- >> lib/kni/rte_kni.c | 3 +-- >> lib/mbuf/rte_mbuf.c | 12 +++++----- >> lib/mbuf/rte_mbuf.h | 28 +++++++++++++++++++----- >> lib/mbuf/rte_mbuf_core.h | 3 +-- >> lib/pipeline/rte_table_action.c | 2 +- >> lib/vhost/vhost.h | 2 +- >> lib/vhost/vhost_crypto.c | 25 ++++++++++----------- >> 12 files changed, 51 insertions(+), 37 deletions(-) >> >> diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test- >bbdev/test_bbdev_perf.c >> index 311e5d1a96..e7fbf71f6d 100644 >> --- a/app/test-bbdev/test_bbdev_perf.c >> +++ b/app/test-bbdev/test_bbdev_perf.c >> @@ -1002,7 +1002,7 @@ init_op_data_objs(struct rte_bbdev_op_data *bufs, >> seg->length); >> memcpy(data, seg->addr, seg->length); >> m_head->buf_addr =3D data; >> - m_head->buf_iova =3D rte_malloc_virt2iova(data); >> + rte_mbuf_iova_set(m_head, >rte_malloc_virt2iova(data)); >> m_head->data_off =3D 0; >> m_head->data_len =3D seg->length; >> } else { >> diff --git a/app/test-crypto-perf/cperf_test_common.c b/app/test-crypto- >perf/cperf_test_common.c >> index 00aadc9a47..27646cd619 100644 >> --- a/app/test-crypto-perf/cperf_test_common.c >> +++ b/app/test-crypto-perf/cperf_test_common.c >> @@ -26,8 +26,7 @@ fill_single_seg_mbuf(struct rte_mbuf *m, struct >rte_mempool *mp, >> /* start of buffer is after mbuf structure and priv data */ >> m->priv_size =3D 0; >> m->buf_addr =3D (char *)m + mbuf_hdr_size; >> - m->buf_iova =3D rte_mempool_virt2iova(obj) + >> - mbuf_offset + mbuf_hdr_size; >> + rte_mbuf_iova_set(m, rte_mempool_virt2iova(obj) + mbuf_offset + >mbuf_hdr_size); >> m->buf_len =3D segment_sz; >> m->data_len =3D data_len; >> m->pkt_len =3D data_len; >> @@ -58,7 +57,7 @@ fill_multi_seg_mbuf(struct rte_mbuf *m, struct >rte_mempool *mp, >> /* start of buffer is after mbuf structure and priv data */ >> m->priv_size =3D 0; >> m->buf_addr =3D (char *)m + mbuf_hdr_size; >> - m->buf_iova =3D next_seg_phys_addr; >> + rte_mbuf_iova_set(m, next_seg_phys_addr); >> next_seg_phys_addr +=3D mbuf_hdr_size + segment_sz; >> m->buf_len =3D segment_sz; >> m->data_len =3D data_len; >> diff --git a/app/test/test_bpf.c b/app/test/test_bpf.c >> index 97f500809e..f5af5e8a3f 100644 >> --- a/app/test/test_bpf.c >> +++ b/app/test/test_bpf.c >> @@ -2600,7 +2600,7 @@ dummy_mbuf_prep(struct rte_mbuf *mb, uint8_t >buf[], uint32_t buf_len, >> uint8_t *db; >> >> mb->buf_addr =3D buf; >> - mb->buf_iova =3D (uintptr_t)buf; >> + rte_mbuf_iova_set(mb, (uintptr_t)buf); >> mb->buf_len =3D buf_len; >> rte_mbuf_refcnt_set(mb, 1); >> >> diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c >> index e09b2549ca..22e45e66c1 100644 >> --- a/app/test/test_mbuf.c >> +++ b/app/test/test_mbuf.c >> @@ -1233,7 +1233,7 @@ test_failing_mbuf_sanity_check(struct rte_mempool >*pktmbuf_pool) >> } >> >> badbuf =3D *buf; >> - badbuf.buf_iova =3D 0; >> + rte_mbuf_iova_set(&badbuf, 0); >> if (verify_mbuf_check_panics(&badbuf)) { >> printf("Error with bad-physaddr mbuf test\n"); >> return -1; >> diff --git a/app/test/test_pcapng.c b/app/test/test_pcapng.c >> index 320dacea34..abbf00f6da 100644 >> --- a/app/test/test_pcapng.c >> +++ b/app/test/test_pcapng.c >> @@ -40,7 +40,7 @@ dummy_mbuf_prep(struct rte_mbuf *mb, uint8_t buf[], >uint32_t buf_len, >> uint8_t *db; >> >> mb->buf_addr =3D buf; >> - mb->buf_iova =3D (uintptr_t)buf; >> + rte_mbuf_iova_set(mb, (uintptr_t)buf); >> mb->buf_len =3D buf_len; >> rte_mbuf_refcnt_set(mb, 1); >> >> diff --git a/lib/kni/rte_kni.c b/lib/kni/rte_kni.c >> index 7971c56bb4..3737a91de7 100644 >> --- a/lib/kni/rte_kni.c >> +++ b/lib/kni/rte_kni.c >> @@ -357,8 +357,7 @@ static void * >> va2pa(struct rte_mbuf *m) >> { >> return (void *)((unsigned long)m - >> - ((unsigned long)m->buf_addr - >> - (unsigned long)m->buf_iova)); >> + ((unsigned long)m->buf_addr - (unsigned >long)rte_mbuf_iova_get(m))); >> } >> >> static void * >> diff --git a/lib/mbuf/rte_mbuf.c b/lib/mbuf/rte_mbuf.c >> index a2307cebe6..16f6ed6731 100644 >> --- a/lib/mbuf/rte_mbuf.c >> +++ b/lib/mbuf/rte_mbuf.c >> @@ -89,7 +89,7 @@ rte_pktmbuf_init(struct rte_mempool *mp, >> /* start of buffer is after mbuf structure and priv data */ >> m->priv_size =3D priv_size; >> m->buf_addr =3D (char *)m + mbuf_size; >> - m->buf_iova =3D rte_mempool_virt2iova(m) + mbuf_size; >> + rte_mbuf_iova_set(m, rte_mempool_virt2iova(m) + mbuf_size); >> m->buf_len =3D (uint16_t)buf_len; >> >> /* keep some headroom between start of buffer and data */ >> @@ -187,8 +187,8 @@ __rte_pktmbuf_init_extmem(struct rte_mempool *mp, >> RTE_ASSERT(ctx->off + ext_mem->elt_size <=3D ext_mem->buf_len); >> >> m->buf_addr =3D RTE_PTR_ADD(ext_mem->buf_ptr, ctx->off); >> - m->buf_iova =3D ext_mem->buf_iova =3D=3D RTE_BAD_IOVA ? >> - RTE_BAD_IOVA : (ext_mem->buf_iova + ctx->off); >> + rte_mbuf_iova_set(m, ext_mem->buf_iova =3D=3D RTE_BAD_IOVA ? >RTE_BAD_IOVA : >> + (ext_mem- >>buf_iova + ctx->off)); >> >> ctx->off +=3D ext_mem->elt_size; >> if (ctx->off + ext_mem->elt_size > ext_mem->buf_len) { >> @@ -388,7 +388,7 @@ int rte_mbuf_check(const struct rte_mbuf *m, int >is_header, >> *reason =3D "bad mbuf pool"; >> return -1; >> } >> - if (m->buf_iova =3D=3D 0) { >> + if (rte_mbuf_iova_get(m) =3D=3D 0) { >> *reason =3D "bad IO addr"; >> return -1; >> } >> @@ -669,8 +669,8 @@ rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, >unsigned dump_len) >> >> __rte_mbuf_sanity_check(m, 1); >> >> - fprintf(f, "dump mbuf at %p, iova=3D%#"PRIx64", buf_len=3D%u\n", >> - m, m->buf_iova, m->buf_len); >> + fprintf(f, "dump mbuf at %p, iova=3D%#" PRIx64 ", buf_len=3D%u\n", m, >rte_mbuf_iova_get(m), >> + m->buf_len); >> fprintf(f, " pkt_len=3D%u, ol_flags=3D%#"PRIx64", nb_segs=3D%u, port= =3D%u", >> m->pkt_len, m->ol_flags, m->nb_segs, m->port); >> >> diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h >> index 9811e8c760..c552dfbcac 100644 >> --- a/lib/mbuf/rte_mbuf.h >> +++ b/lib/mbuf/rte_mbuf.h >> @@ -135,6 +135,24 @@ rte_mbuf_prefetch_part2(struct rte_mbuf *m) >> >> static inline uint16_t rte_pktmbuf_priv_size(struct rte_mempool *mp); >> >> +/** >> + * Get the mbuf physical address. >> + */ > >Not blocking for the rc1, but the comment should be clarified. > >"Get the IOVA address of the mbuf data buffer." looks more accurate >to me. > >Also, even if it does not bring a big added-value, it's better to >have documentation for @param and @return. > =20 I will update. >> +static inline rte_iova_t >> +rte_mbuf_iova_get(const struct rte_mbuf *m) >> +{ >> + return m->buf_iova; >> +} >> + >> +/** >> + * Set the mbuf physical address. >> + */ > >Same > =20 Ack. >> +static inline void >> +rte_mbuf_iova_set(struct rte_mbuf *m, rte_iova_t iova) >> +{ >> + m->buf_iova =3D iova; >> +} >> + >> /** >> * Return the IO address of the beginning of the mbuf data >> * >> @@ -146,7 +164,7 @@ static inline uint16_t rte_pktmbuf_priv_size(struct >rte_mempool *mp); >> static inline rte_iova_t >> rte_mbuf_data_iova(const struct rte_mbuf *mb) >> { >> - return mb->buf_iova + mb->data_off; >> + return rte_mbuf_iova_get(mb) + mb->data_off; >> } >> >> /** >> @@ -164,7 +182,7 @@ rte_mbuf_data_iova(const struct rte_mbuf *mb) >> static inline rte_iova_t >> rte_mbuf_data_iova_default(const struct rte_mbuf *mb) >> { >> - return mb->buf_iova + RTE_PKTMBUF_HEADROOM; >> + return rte_mbuf_iova_get(mb) + RTE_PKTMBUF_HEADROOM; >> } >> >> /** >> @@ -1056,7 +1074,7 @@ rte_pktmbuf_attach_extbuf(struct rte_mbuf *m, void >*buf_addr, >> RTE_ASSERT(shinfo->free_cb !=3D NULL); >> >> m->buf_addr =3D buf_addr; >> - m->buf_iova =3D buf_iova; >> + rte_mbuf_iova_set(m, buf_iova); >> m->buf_len =3D buf_len; >> >> m->data_len =3D 0; >> @@ -1143,7 +1161,7 @@ static inline void rte_pktmbuf_attach(struct rte_m= buf >*mi, struct rte_mbuf *m) >> >> mi->data_off =3D m->data_off; >> mi->data_len =3D m->data_len; >> - mi->buf_iova =3D m->buf_iova; >> + rte_mbuf_iova_set(mi, rte_mbuf_iova_get(m)); >> mi->buf_addr =3D m->buf_addr; >> mi->buf_len =3D m->buf_len; >> >> @@ -1245,7 +1263,7 @@ static inline void rte_pktmbuf_detach(struct rte_m= buf >*m) >> >> m->priv_size =3D priv_size; >> m->buf_addr =3D (char *)m + mbuf_size; >> - m->buf_iova =3D rte_mempool_virt2iova(m) + mbuf_size; >> + rte_mbuf_iova_set(m, rte_mempool_virt2iova(m) + mbuf_size); >> m->buf_len =3D (uint16_t)buf_len; >> rte_pktmbuf_reset_headroom(m); >> m->data_len =3D 0; >> diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h >> index e672d59b36..51a12a1fb9 100644 >> --- a/lib/mbuf/rte_mbuf_core.h >> +++ b/lib/mbuf/rte_mbuf_core.h >> @@ -736,8 +736,7 @@ struct rte_mbuf_ext_shared_info { >> * @param o >> * The offset into the data to calculate address from. >> */ >> -#define rte_pktmbuf_iova_offset(m, o) \ >> - (rte_iova_t)((m)->buf_iova + (m)->data_off + (o)) >> +#define rte_pktmbuf_iova_offset(m, o) (rte_iova_t)(rte_mbuf_iova_get(m)= + >(m)->data_off + (o)) >> >> /** >> * A macro that returns the IO address that points to the start of the >> diff --git a/lib/pipeline/rte_table_action.c b/lib/pipeline/rte_table_ac= tion.c >> index b1310be565..06a8cdcf05 100644 >> --- a/lib/pipeline/rte_table_action.c >> +++ b/lib/pipeline/rte_table_action.c >> @@ -1929,7 +1929,7 @@ pkt_work_sym_crypto(struct rte_mbuf *mbuf, struct >sym_crypto_data *data, >> >> op->type =3D RTE_CRYPTO_OP_TYPE_SYMMETRIC; >> op->sess_type =3D RTE_CRYPTO_OP_WITH_SESSION; >> - op->phys_addr =3D mbuf->buf_iova + cfg->op_offset - sizeof(*mbuf); >> + op->phys_addr =3D rte_mbuf_iova_get(mbuf) + cfg->op_offset - >sizeof(*mbuf); >> op->status =3D RTE_CRYPTO_OP_STATUS_NOT_PROCESSED; >> sym->m_src =3D mbuf; >> sym->m_dst =3D NULL; >> diff --git a/lib/vhost/vhost.h b/lib/vhost/vhost.h >> index eeeda681cc..ef211ed519 100644 >> --- a/lib/vhost/vhost.h >> +++ b/lib/vhost/vhost.h >> @@ -971,7 +971,7 @@ restore_mbuf(struct rte_mbuf *m) >> /* start of buffer is after mbuf structure and priv data */ >> >> m->buf_addr =3D (char *)m + mbuf_size; >> - m->buf_iova =3D rte_mempool_virt2iova(m) + mbuf_size; >> + rte_mbuf_iova_set(m, rte_mempool_virt2iova(m) + mbuf_size); >> m =3D m->next; >> } >> } >> diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c >> index 54946f46d9..3077a21ae8 100644 >> --- a/lib/vhost/vhost_crypto.c >> +++ b/lib/vhost/vhost_crypto.c >> @@ -823,11 +823,10 @@ prepare_sym_cipher_op(struct vhost_crypto >*vcrypto, struct rte_crypto_op *op, >> switch (vcrypto->option) { >> case RTE_VHOST_CRYPTO_ZERO_COPY_ENABLE: >> m_src->data_len =3D cipher->para.src_data_len; >> - m_src->buf_iova =3D gpa_to_hpa(vcrypto->dev, desc->addr, >> - cipher->para.src_data_len); >> + rte_mbuf_iova_set(m_src, >> + gpa_to_hpa(vcrypto->dev, desc->addr, cipher- >>para.src_data_len)); >> m_src->buf_addr =3D get_data_ptr(vc_req, desc, >VHOST_ACCESS_RO); >> - if (unlikely(m_src->buf_iova =3D=3D 0 || >> - m_src->buf_addr =3D=3D NULL)) { >> + if (unlikely(rte_mbuf_iova_get(m_src) =3D=3D 0 || m_src->buf_addr >=3D=3D NULL)) { >> VC_LOG_ERR("zero_copy may fail due to cross page >data"); >> ret =3D VIRTIO_CRYPTO_ERR; >> goto error_exit; >> @@ -867,10 +866,10 @@ prepare_sym_cipher_op(struct vhost_crypto >*vcrypto, struct rte_crypto_op *op, >> >> switch (vcrypto->option) { >> case RTE_VHOST_CRYPTO_ZERO_COPY_ENABLE: >> - m_dst->buf_iova =3D gpa_to_hpa(vcrypto->dev, >> - desc->addr, cipher->para.dst_data_len); >> + rte_mbuf_iova_set(m_dst, >> + gpa_to_hpa(vcrypto->dev, desc->addr, cipher- >>para.dst_data_len)); >> m_dst->buf_addr =3D get_data_ptr(vc_req, desc, >VHOST_ACCESS_RW); >> - if (unlikely(m_dst->buf_iova =3D=3D 0 || m_dst->buf_addr =3D=3D NULL)= ) { >> + if (unlikely(rte_mbuf_iova_get(m_dst) =3D=3D 0 || m_dst->buf_addr >=3D=3D NULL)) { >> VC_LOG_ERR("zero_copy may fail due to cross page >data"); >> ret =3D VIRTIO_CRYPTO_ERR; >> goto error_exit; >> @@ -981,10 +980,10 @@ prepare_sym_chain_op(struct vhost_crypto *vcrypto, >struct rte_crypto_op *op, >> m_src->data_len =3D chain->para.src_data_len; >> m_dst->data_len =3D chain->para.dst_data_len; >> >> - m_src->buf_iova =3D gpa_to_hpa(vcrypto->dev, desc->addr, >> - chain->para.src_data_len); >> + rte_mbuf_iova_set(m_src, >> + gpa_to_hpa(vcrypto->dev, desc->addr, chain- >>para.src_data_len)); >> m_src->buf_addr =3D get_data_ptr(vc_req, desc, >VHOST_ACCESS_RO); >> - if (unlikely(m_src->buf_iova =3D=3D 0 || m_src->buf_addr =3D=3D NULL)= ) { >> + if (unlikely(rte_mbuf_iova_get(m_src) =3D=3D 0 || m_src->buf_addr >=3D=3D NULL)) { >> VC_LOG_ERR("zero_copy may fail due to cross page >data"); >> ret =3D VIRTIO_CRYPTO_ERR; >> goto error_exit; >> @@ -1024,10 +1023,10 @@ prepare_sym_chain_op(struct vhost_crypto >*vcrypto, struct rte_crypto_op *op, >> >> switch (vcrypto->option) { >> case RTE_VHOST_CRYPTO_ZERO_COPY_ENABLE: >> - m_dst->buf_iova =3D gpa_to_hpa(vcrypto->dev, >> - desc->addr, chain->para.dst_data_len); >> + rte_mbuf_iova_set(m_dst, >> + gpa_to_hpa(vcrypto->dev, desc->addr, chain- >>para.dst_data_len)); >> m_dst->buf_addr =3D get_data_ptr(vc_req, desc, >VHOST_ACCESS_RW); >> - if (unlikely(m_dst->buf_iova =3D=3D 0 || m_dst->buf_addr =3D=3D NULL)= ) { >> + if (unlikely(rte_mbuf_iova_get(m_dst) =3D=3D 0 || m_dst->buf_addr >=3D=3D NULL)) { >> VC_LOG_ERR("zero_copy may fail due to cross page >data"); >> ret =3D VIRTIO_CRYPTO_ERR; >> goto error_exit; >> -- >> 2.25.1 >>