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 9E1A143F13; Fri, 26 Apr 2024 12:44:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2B55143CEA; Fri, 26 Apr 2024 12:44:15 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by mails.dpdk.org (Postfix) with ESMTP id 55B3040289 for ; Fri, 26 Apr 2024 12:44:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714128252; x=1745664252; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=XNHlEzak2o+vIJKD7Lgwf3lkti8a7yJ4zKBvvwoOO8Y=; b=feKe+xB6dA+AMrH0U1LbmQzoeRgKovK6eSZ+dD5sFpP4XCBwjKVe3sFo +cr3l0vG9zu7nY3er1iIbWylbRic+JOY7QgM6rM4zGohmbOjafYpLGhxP 0v1F3WUEtxHz5kNA14PvXbCbV2jeKn3Si7l/3tv1HoXweZ6WoG7rPUCiH /P9e6MPImpcANHRTZqCgB0OZyXWiiNLzBKoDzz1V55ILi9GH1RzzXhSDz 1zIVZA1u9Z0hNDugDZNC222o7l/dJ8Ip1BrESzZenjEqkKkX2ZyvvrmQ6 hs878QYCbMMUUWdLNhhPRxaAeg5gfrI7YN1s+/rO1pzlmmkjr+xuq+yQH Q==; X-CSE-ConnectionGUID: h1MIUXAJRvmj9lJE5hMIXg== X-CSE-MsgGUID: jjGVYBP1QKCrSj1NQn0EAg== X-IronPort-AV: E=McAfee;i="6600,9927,11055"; a="21264237" X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="21264237" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 03:44:11 -0700 X-CSE-ConnectionGUID: aoQJbK7WRRaf1+vDFTbGaw== X-CSE-MsgGUID: fieaojEbQguOerEv4CC3hw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="25467416" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmviesa010.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 26 Apr 2024 03:44:11 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 26 Apr 2024 03:44:00 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Fri, 26 Apr 2024 03:44:00 -0700 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (104.47.51.41) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 26 Apr 2024 03:43:59 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dtZFYFkfZjT4smCXiWcezlxhRorvWovZBPtIoMB6wvchkAv/L63r/FoCOzjlRQfZ2GZGIOKQ8t0OdVeJbwA7P2r0us48jlmANdVBs9ZaLKrgUyLHFed6E9zjN2qUTCmtOkWCzEvxZef4/R97My/s8vtsEvdb0xj1aCUaFdD1M51iff7KV3k/1kak5rLwaxmADjAtMlNL7pdTu8Sk8krQa0vCqaw7LCde+jK7H7rxcjhxx1lPxk7hw2EDC8sir/6PlyHBnwvii52GEJHtTmI8miBkgpX7gkIpm4JJM4u687osZ7lXXHDHbJzE6pz2dDAxs8V9WdLmP5GhXYKfpEqMdA== 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=IFD1EMxqCPQFF7y3qJ1DBum0YRTf+GhQPE92tTLDvzQ=; b=Ah0BaqnJQV0XP4BIha0GDQ4zQNDdLHXM9XFn0oacckASNeJLfKvTf98dmGCRdGdFRLuM46l1cwXkl4BBoRivrr1u0vSaQ1c0DsY+V+rQSNmdGshR4AE1Zb3DtR3fQRRZeiKLy4VHa1cWRiBjaGNcphAEnwGigXW5RkFgrrOi7Vm0UfJ/NjMIsSN+KedGeC0Z7a9yk/Lz5wuLastW2W7fyIflHrWkBkqYAVRkh9FhuSGiiVWfN9eXFuCqY71vAADPH7SxPKCWUCkWULDojR+loQJNhLBy3DUbJCelynsm2QFBX4ZFMz+jqnOaA9zw7oUR6l1VEfO+xxymNxg7dXJJsw== 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 MW4PR11MB5872.namprd11.prod.outlook.com (2603:10b6:303:169::14) by SJ0PR11MB4925.namprd11.prod.outlook.com (2603:10b6:a03:2df::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.22; Fri, 26 Apr 2024 10:43:57 +0000 Received: from MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::be3f:5a4f:5180:2ba9]) by MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::be3f:5a4f:5180:2ba9%4]) with mapi id 15.20.7519.021; Fri, 26 Apr 2024 10:43:57 +0000 From: "Loftus, Ciara" To: "Du, Frank" CC: "dev@dpdk.org" Subject: RE: [PATCH] net/af_xdp: fix umem map size for zero copy Thread-Topic: [PATCH] net/af_xdp: fix umem map size for zero copy Thread-Index: AQHal3X0z6x0LdlbSECwoepFfDoVGbF6XhKw Date: Fri, 26 Apr 2024 10:43:57 +0000 Message-ID: References: <20240426005128.148730-1-frank.du@intel.com> In-Reply-To: <20240426005128.148730-1-frank.du@intel.com> Accept-Language: en-GB, en-US 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: MW4PR11MB5872:EE_|SJ0PR11MB4925:EE_ x-ms-office365-filtering-correlation-id: 26b14af3-9603-45eb-2d22-08dc65ddc6a8 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|376005|1800799015|366007|38070700009; x-microsoft-antispam-message-info: =?us-ascii?Q?/uk6brezY7KhO/D9bnaa+OuPjbBF2akRWSct/RzECkSPA0pBEBmqnjFLL7JP?= =?us-ascii?Q?8D7cJHSbGzVtCtZzrtQRjuYdvxjNQlW35vYVZdWFNp5XZSQhYdRU7pYiPGS6?= =?us-ascii?Q?RfQcpwTR5MSLmktEDEx260ZKNo1/VHuQmnbvd/nbmeJNSojtM93bDkU3gw16?= =?us-ascii?Q?7Rpc8v6+fcwQIxikQiskl9Xt+ADTl9Q/bd+eeAxym+fIuAJ5sgy+lS4aSzh+?= =?us-ascii?Q?SBQtIq7mzaEemK9azH8xiSHqpATs5owQ7rOvLAnODaE52BFWjwJ0PzMwGxMh?= =?us-ascii?Q?gd1hvcCpnpwTxdMQl4GA5oCtGtbp4P8txyLyT5TgBbMmAPJmNFU3uJwoTif9?= =?us-ascii?Q?I8H3DKV78yHcTAx4pAA8h7xPaHyK1TMwq92Z20XeKQZ1BRXUwg8armDbUsN1?= =?us-ascii?Q?FgU2OicTLJ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us-ascii?Q?k26TEvjrXXJRJuBaoOCr3lcHMOZYlTwLVUmQa2ulwplstA=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW4PR11MB5872.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(1800799015)(366007)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?VvfjSIf5oN7A0QmwJaFZfinlr0+o3Yfl3o5+SiHgAdZ3jnDUIKbveoPbT2iD?= =?us-ascii?Q?OjD1RA9EceogfxnFuwmaJb9Bb67KGTEhjRdQE9FyT+KM0C5o7E2Jj/krYZyC?= =?us-ascii?Q?aJ2SaWzp4ixsZDAp+rjxtT5CPqUzDz1skx4KeuO42GH6BZcMCjtlQ0pC9uUs?= =?us-ascii?Q?7yGEHcLMeVV+HjmvtMZvugKQsD+agMBYJVPgXsRxLcSYzhnIbhs/O3DMD7pg?= =?us-ascii?Q?3drLosHgyI7IGfAloEi8eU5KJEx2SiKbh7jMSDrGq5/NvoZ050mooNIp/BXH?= =?us-ascii?Q?h/uC80M+UAtnaOHdqAGN4cPW2UP8qU/lLBDsq8VZX30Th90h/X3fwcY/K2Pt?= =?us-ascii?Q?oYF890n1DR6Yu4BJMDO4w9jLGde9Rb3dEz3ssbz9x5SDi6LUd9jhQRW2YJ1+?= =?us-ascii?Q?YN40sqp/ZcdVwqCrDCc+cKrg4nx2Jjgh5nXY+AzBcZHCOIffe8mT9cxxXVh2?= =?us-ascii?Q?O/pv7RMF2u66TLfY1Z3B1cxf65oGyXrKuAWMohl9XC5cZTC4ovMLLJn/WJzf?= =?us-ascii?Q?Zype5oU5c2j9tXbABoiERnTRuLsVUVW+kO20c0t4IetQzr3abPbW0OT3jQv2?= =?us-ascii?Q?R9ZGkFytNCZ0xcjNACC6PME71p+UgtnkYlp/vgtbVUA9RixOrm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yckfiPAaeU/b7dxOB8+s/d/r8hJj?= =?us-ascii?Q?S+GKlVPxtmI3fvlZ0cy25lsEl0n4M5hwgN5A7s8W?= 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: MW4PR11MB5872.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 26b14af3-9603-45eb-2d22-08dc65ddc6a8 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Apr 2024 10:43:57.4408 (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: AmhnxnQ3ybYCb2CkvizknkuGcsfAUfVn8e3ECOb6C7BpvoiS1wer0o4dAqdk0PNbvlzW8vs2QdnFkUM2LyX3zw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB4925 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 > Subject: [PATCH] net/af_xdp: fix umem map size for zero copy >=20 > The current calculation assumes that the mbufs are contiguous. However, > this assumption is incorrect when the memory spans across a huge page. > Correct to directly read the size from the mempool memory chunks. >=20 > Signed-off-by: Frank Du > --- > drivers/net/af_xdp/rte_eth_af_xdp.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) >=20 > diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c > b/drivers/net/af_xdp/rte_eth_af_xdp.c > index 268a130c49..cb95d17d13 100644 > --- a/drivers/net/af_xdp/rte_eth_af_xdp.c > +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c > @@ -1039,7 +1039,7 @@ eth_link_update(struct rte_eth_dev *dev > __rte_unused, > } >=20 > #if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG) > -static inline uintptr_t get_base_addr(struct rte_mempool *mp, uint64_t > *align) > +static inline uintptr_t get_memhdr_info(struct rte_mempool *mp, uint64_t > *align, size_t *len) > { > struct rte_mempool_memhdr *memhdr; > uintptr_t memhdr_addr, aligned_addr; > @@ -1048,6 +1048,7 @@ static inline uintptr_t get_base_addr(struct > rte_mempool *mp, uint64_t *align) > memhdr_addr =3D (uintptr_t)memhdr->addr; > aligned_addr =3D memhdr_addr & ~(getpagesize() - 1); > *align =3D memhdr_addr - aligned_addr; > + *len =3D memhdr->len; >=20 > return aligned_addr; > } > @@ -1125,6 +1126,7 @@ xsk_umem_info *xdp_umem_configure(struct > pmd_internals *internals, > void *base_addr =3D NULL; > struct rte_mempool *mb_pool =3D rxq->mb_pool; > uint64_t umem_size, align =3D 0; > + size_t len =3D 0; >=20 > if (internals->shared_umem) { > if (get_shared_umem(rxq, internals->if_name, &umem) < 0) > @@ -1156,10 +1158,8 @@ xsk_umem_info *xdp_umem_configure(struct > pmd_internals *internals, > } >=20 > umem->mb_pool =3D mb_pool; > - base_addr =3D (void *)get_base_addr(mb_pool, &align); > - umem_size =3D (uint64_t)mb_pool->populated_size * > - (uint64_t)usr_config.frame_size + > - align; > + base_addr =3D (void *)get_memhdr_info(mb_pool, &align, > &len); > + umem_size =3D (uint64_t)len + align; len is set to the length of the first memhdr of the mempool. There may be m= any other memhdrs in the mempool. So I don't think this is the correct valu= e to use for calculating the entire umem size. >=20 > ret =3D xsk_umem__create(&umem->umem, base_addr, > umem_size, > &rxq->fq, &rxq->cq, &usr_config); > -- > 2.34.1