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 A5C444591A; Fri, 6 Sep 2024 08:22:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7960B4025D; Fri, 6 Sep 2024 08:22:44 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11023108.outbound.protection.outlook.com [52.101.67.108]) by mails.dpdk.org (Postfix) with ESMTP id 315104025C for ; Fri, 6 Sep 2024 08:22:43 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FBi8OKRWpiyLus4lFP2C2t4K9AbIGWmtbS1cnfcieItkseFlQRdc+lxZORTk47+EhHrwELj0ldmbGs5fMSOfba1QvfUNlhoUMIJYe+0WS9FyP4uwZz6yrURPl1QOamQUbakhd9quoIUWpOXc9cLUI63SPyJqOotkZus7xEtiZdfUYnjTrYI/fW/rU/7fz7QoR7mc/s3VH/QzLiwoqHdzXxsIqBEAGA48Mqwe9ptWop4uJ3C6bmM9CXQHPbypaF289ZLuEA5G348+WqJD4DZ9d7m3r0zZhZfrKRAYlV7bQqW8oCkFU5MMf1Xp4SoQAKujLATsR1SSH1snkUmQW0r08Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Yw6Q807i9bLyDfudCIQu4vtIdMFwOxtGBBYviK6L7Zo=; b=vPFpags8O4mLBcSgTXg9snD7werD/uNc4zMyIRBf3OunMcM2spcM2gm68ukLeY7qpwbrQ47TMMhQoQf/yJCwngJHGjqBKHNFgK+7ihLTHacjPcVN8dK/Ng4cC4VQk8SiUSP/gvDgL17mdFAixmSqkR3vCYgQ4mgAuwRnOkygK7to2EgRn+2MWD+Lvl8dDh/Q94rOn72kgfFiPmb08pZk0JUyqHlH8xvIFjONUmEW2fVt2ihvH/eptA/kX7FasBwyP4rrQ3OG1IaVrWhSiV4gi6Kc+M+Iuj80afV6X68iHpNNKHqP/cdp+NK0ovGBR9vTe40SS3pbxsz+4XhgIVwDeg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=omicronenergy.com; dmarc=pass action=none header.from=omicronenergy.com; dkim=pass header.d=omicronenergy.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=omicronenergy.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Yw6Q807i9bLyDfudCIQu4vtIdMFwOxtGBBYviK6L7Zo=; b=L0e0+8xHy8N79ERWXiS0HEuHfH3uJ+aUC8sCDYwBlgf0fbVpo0AN2HhafQwzMhMxvyyX7O/64gT21h1oO/7xIi/8I6Vt2wy4HZm5a5cRzTwCAegUjj9cVZHI2mRo1lBDf2Yl9oROw/NjM6fzoAneicuREvQDNi42fgSahdaKq5E= Received: from AM0PR03MB6275.eurprd03.prod.outlook.com (2603:10a6:20b:154::17) by VI1PR03MB6382.eurprd03.prod.outlook.com (2603:10a6:800:195::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.17; Fri, 6 Sep 2024 06:22:38 +0000 Received: from AM0PR03MB6275.eurprd03.prod.outlook.com ([fe80::7ab2:814:12eb:1c8d]) by AM0PR03MB6275.eurprd03.prod.outlook.com ([fe80::7ab2:814:12eb:1c8d%7]) with mapi id 15.20.7897.021; Fri, 6 Sep 2024 06:22:37 +0000 From: =?Windows-1252?Q?Stefan_L=E4sser?= To: =?Windows-1252?Q?Morten_Br=F8rup?= , Stephen Hemminger CC: Thomas Monjalon , "John W. Linville" , "dev@dpdk.org" Subject: RE: [PATCH] net/af_packet: add timestamp offloading support Thread-Topic: [PATCH] net/af_packet: add timestamp offloading support Thread-Index: AQHa/faIgXyAWopV9kGrv4mtbbKJvrJGPscAgABQ2QCAA7yKkA== Date: Fri, 6 Sep 2024 06:22:37 +0000 Message-ID: References: <20240903114306.2336633-1-stefan.laesser@omicronenergy.com> <20240903092138.0e071924@hermes.local> <98CBD80474FA8B44BF855DF32C47DC35E9F698@smartserver.smartshare.dk> In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9F698@smartserver.smartshare.dk> Accept-Language: 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=omicronenergy.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM0PR03MB6275:EE_|VI1PR03MB6382:EE_ x-ms-office365-filtering-correlation-id: 5fb506bf-bf61-40b5-3d28-08dcce3c4dd8 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|1800799024|366016|376014|38070700018; x-microsoft-antispam-message-info: =?Windows-1252?Q?/z4DxhPtQtmw6odWNfJeITHaw84odL1Luu1+H6stvcnxDAlAeyFe9uAt?= =?Windows-1252?Q?mCTgPNFRpjupyitsICFbs2LnVwtU9gvQp7kkS3LLauHfAd9K0K2gRyw7?= =?Windows-1252?Q?zi5T8UKPsWwmqUA8vH/w/eAS7ze06kR5VnV4tsLsQ2+7J0wQZPG4YXq2?= =?Windows-1252?Q?8oDLHBzcRNrT93Wb8WedqE2pWr1TM7rEA1jvPQZpWjn40IFmU2vp7okz?= =?Windows-1252?Q?cOAZTxlWDE/bofV1s72Jm4eB/i1S4Do6Hd/M8BZukjR+I0hFmHT0jXot?= =?Windows-1252?Q?PTqLQUY6NArkqOGrakLU3RBZ25/P7Ie6VLJadfQmNwI65KnC61kk97vX?= =?Windows-1252?Q?WvvYj7PUuPPms9hbX1w8rC0lrazGjSMNrUkomnpZHp24dvEcPzVg6ac+?= =?Windows-1252?Q?M25P7UCbMIUK7JUDGwZb74RgzLb8nFNTNz7BX8nPqBTU5Zpnww6BYuyw?= =?Windows-1252?Q?qPffXVm6V3Izi4Aj1jUGn1Ac/GIPRu/h5bSlv/EA+jdtOiqE2oG/bE6u?= =?Windows-1252?Q?YSt7OrnIGHiZvFXQscQqPQ/nfgmRLdc8N3p7W8ydRE9zafbzfioARtTW?= =?Windows-1252?Q?dTgrS0YSQFO5u8dLqYSg1tAZ9/1AgvwnqJa/iuUFUX+oT6jLV6ByLQLf?= =?Windows-1252?Q?tVUdjx6tV65pXfLFCE31Ywmvi5jG/8jsQcbMBxr5hJahyoqMAOJZvbpp?= =?Windows-1252?Q?UaA1EuYhoYGfn6VEui4q3tTVXwCG+pdR7dLXy2HSP0VvB+wirVgJicDV?= =?Windows-1252?Q?qWzeaNDHGgWI1uNziIYZBleZbBn8fifOZM2SKENukFswuCn/R90j4z2r?= =?Windows-1252?Q?xRrd9PVAFuwTm4QzXAcjPCrrOWwioDpHt7BOe+d30MUjVen5/XEO4SZl?= =?Windows-1252?Q?eDZ/9m51GD7fgpZcOpnmZxsss+HGG53aimxAcdtllB8EPn2KWVfeqVvt?= =?Windows-1252?Q?6ca2j7WvRBVQPzLCBEnV2DD7veAmlPA5DfqoDLDRwZVIo0BTA8Pemi/C?= =?Windows-1252?Q?8suH4oNqnA0mGnnO46LWBEKUOl6Rj2qwxE6ujLiRe7eahT+l5TOiLcwD?= =?Windows-1252?Q?GS0ChxVSa1vokYTyx/N2JKjSKMyledw8BNlqn21EDYcCjqyb/gGdLlty?= =?Windows-1252?Q?gbMu2dSzFOTDWW8pAG7jPie/v/1PmiZfEQv4qMYIH06RfuvJ2rq+8Z0S?= =?Windows-1252?Q?BcUU3/qYtc2jPejLLca02muMzhjAsuhG2xOZdL+QbKF1ImcYk0BDxyID?= =?Windows-1252?Q?lvd5smEE1WfW01p3SDY1IedpSR+QaSB3WkJNZQrmsp0tQJbexEb2pb93?= =?Windows-1252?Q?0fV3gX+Sq/u8ZipWaa/BK5gQiqaiYhvG7bNpv4GEY4ILbzKA0+/HA9k2?= =?Windows-1252?Q?bri6p3sqLB1s0czzGB3gV9HrZrVnPS0EJKqCGLNy8zSuBdO2ZrkxeI/Q?= =?Windows-1252?Q?Fw03KLy8oZ+eXTnh1mbx/Nu+NQICKf2mBZwnHZmyDIH4Rh357r1bYK8g?= =?Windows-1252?Q?r2WE14tjaPQPItYgcI8JyurUHI3ozw=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR03MB6275.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014)(38070700018); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?Windows-1252?Q?Hl/8m1YneW8RDLGCJHkQ2exz4kQpi9yvasOrV3duCKbrcEW06e99NVn7?= =?Windows-1252?Q?SeL4+SMPH0bxn8lDdhMD/EPD7QGDtV8NYGoHF792AbBMH1bvqi53wiAV?= =?Windows-1252?Q?enLNeaZXTSD2EhSVcoJ536LYy55EMnXqghKoa5jLfQrLZEAkrYe7OvOj?= =?Windows-1252?Q?WVCjFKNSD1PsHtg4g7qgIEruMNTImDp1MGmxe3IbwvKYY1EbxwctdxWA?= =?Windows-1252?Q?sJ/D1ZUyLdWKdWM9y/gZjDKkLmw0GL3n6/RIScST3MF2eumDtfx0HxeW?= =?Windows-1252?Q?0lcwKbKkP8rn4Db9kO0x4XUwlF7WKGW2Z5G5b91fzSus2gFjtvn9iGM/?= =?Windows-1252?Q?1h3Iv1rPeGbtswqsPyS8pLtyXamtptfsimBEF/yafTPqMUvsZ9FNj6mi?= =?Windows-1252?Q?Xg059rzcS3HpaAzU5BeGhIETUVnqBWUu9nSsFVXUrqyKKgZerozyBAo7?= =?Windows-1252?Q?NfBA4Z9LYpEZ+tjz/77d8fFOo4yoYOU6CTS4oGDlAK9jZjVCJ9h5Bqto?= =?Windows-1252?Q?HqR2pGSyMRwnOlecLjhqMWnDOt3M+YDI+PI4bsVLh1oBVQdxRfWDZqvf?= =?Windows-1252?Q?ZHQAWO/bhMl6FiWbWx+D8loNJbPVi+vRgKGtFIDBUZuN1BBHwu+UsE0g?= =?Windows-1252?Q?OwGsR5VHCTCisYFTBbvZWTeuRIji1iQwxerv5CvQ3ZC27gpOO6KOjNzW?= =?Windows-1252?Q?80PO83mUo7VDfqPO0yCF3l2jqnfx/PjZE7bM561Zf0znZAzjCekP89wT?= =?Windows-1252?Q?p0L7ZT2ajagK9C2reVrRJNrbpV0AmTzbs5sYbUdbxIvpWmmRU6bxmwgA?= =?Windows-1252?Q?QNrkNCZ5UdAUl8pEX/IICTOtCrGw5Ado5GpiDWZ+T7rgUF5kZtCpqn2o?= =?Windows-1252?Q?s7+9hMes07MYk2lSePJ28mqQ2DBwEk0VGqi/6oaSHiSg1HOiiJ1bI941?= =?Windows-1252?Q?lCdpsa3bPsUvH7nagfUTn6UdghVoc236N/hrS301ai0//Phw9PFRVyMr?= =?Windows-1252?Q?V4sxJZJ+jsxZyx8JY5qhv8Kra3BqwVkCtdK95p60JO3urcX2tGu0GjZm?= =?Windows-1252?Q?KefCqa0Bs59LS/usyzQosAjglLRNEzOXxNL1/dV9p6cdWZZ3S4Z0H/Br?= =?Windows-1252?Q?x7tZEttdjNW1vYliXNN4uNZqK79BeQGtATNZIfixiSwyGB4+7YkKR2ov?= =?Windows-1252?Q?aP8BSL79/1N48w85BsxqNe72g+k4+kVocuIPm6EFtrJAs9D5IY3n0NPJ?= =?Windows-1252?Q?EYF743kjHxPSL/24IT3HAXoc53JrBtmmCV1xYeKjp5KacgB/EL2aYSwR?= =?Windows-1252?Q?b8smluKpx42dXQUrEawas6UPn36wLuXQ2J9k7wgpvdRRupTwg91zGnkc?= =?Windows-1252?Q?krV1pH5VaDMyOFOIU4FdKXvcQZfMvgVYFMdrKIfkfk9m8rhejkT4rQHH?= =?Windows-1252?Q?xvnxt57KP/V5clSMgy28Olv+3xX6xJos+ThFcXXd3DZIeyLrmfIYr+ZY?= =?Windows-1252?Q?pX8ij9EMxLcla3l9WfqNQh85M4ALpSyJ/MRvkoE9i11OPhXY7ye0XUDC?= =?Windows-1252?Q?o2e9Wyibe3NFzo8oNqMLsakaJUew62rmdOKLjzfdKtQpOJOL5SdW0dKh?= =?Windows-1252?Q?JOujV+t9YUCQVV+G+vMm5dAxvSmjGBJBsrK865BaKYaULdg2lqI03WlR?= =?Windows-1252?Q?THItYGXjD8VgRhBX1W4Qi6/OpyFJsk16JxI7U54wthVfeewpYIdYkQ?= =?Windows-1252?Q?=3D=3D?= Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: omicronenergy.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM0PR03MB6275.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5fb506bf-bf61-40b5-3d28-08dcce3c4dd8 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Sep 2024 06:22:37.8559 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 1357ca9e-a1a5-404b-bb16-554d5d05c5c9 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: /nLiyFXXZdRuDZVUA262STX8kQvImfK7Un/uBeCeIoO56+GzLcxJm+Vs2x2RjbMB3QbxP89GFEShb2637+hedy4yIfxSMrZohUpXMUAJRtDIFrzLcXNLdP0qiFLw/AE8 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR03MB6382 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 > > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > > Sent: Tuesday, 3 September 2024 18.22 > > > > On Tue, 3 Sep 2024 13:43:06 +0200 > > Stefan Laesser wrote: > > > > > Add the packet timestamp from TPACKET_V2 to the mbuf dynamic rx > > > timestamp register if offload RTE_ETH_RX_OFFLOAD_TIMESTAMP is > > > enabled. > > > > > > TPACKET_V2 provides the timestamp with nanosecond resolution. > > > > > > Signed-off-by: Stefan Laesser > > > --- > > > .mailmap | 1 + > > > doc/guides/nics/af_packet.rst | 8 ++++-- > > > drivers/net/af_packet/rte_eth_af_packet.c | 34 > > > +++++++++++++++++++++- > > - > > > 3 files changed, 38 insertions(+), 5 deletions(-) > > > > Adding timestamp is good, but it would be better if the timestamp > > field was generic. The pcap PMD also has a timestamp, and pdump API > > could/should use timestamp as well. >=20 > As far as I can see, this patch does use the existing cross-driver/generi= c > timestamp dynamic field, like the pcap driver. Yes, I use the generic timestamp dynamic field as used in all the other PMD= s I have looked at. >=20 > > > > What makes sense is for there to be a standard dynamic field for > > nanosecond resolution timestamp, and add a make sure that all drivers > > use the same base 1/1/1970 same as Linux/Unix. >=20 > Yes, standardizing on nanosecond resolution and a common base might have > been a better choice than using driver-specific units for the generic > timestamp dynamic field. > If the driver can use the NIC's native clock system, the driver doesn't n= eed to > convert to nanoseconds, which has a performance cost. > However, I suppose any application using timestamps needs to do this > conversion in the application instead, so the total performance is the sa= me as > if the drivers did it. I.e. from a performance perspective, the drivers m= ight as > well do the conversion, and from a usability perspective, it would be eas= ier > with a standard unit and base. >=20 > We should define a roadmap towards dynamic mbuf field timestamps using > fixed unit and base (instead of driver-specific) and migrate towards it. >=20 > Perhaps start by adding an ethdev capability flag, > RTE_ETH_RX_OFFLOAD_TIMESTAMP_NS used together with > RTE_ETH_RX_OFFLOAD_TIMESTAMP to indicate that the timestamp unit and > base follows a common standard, i.e. nanoseconds since UNIX epoch. >=20 > There may be other considerations, though: The NIC's clock may drift > compared to the CPU's clock, and compared to the clock of other NICs in t= he > same system. So the "base" and "nanoseconds" will still be using the NIC'= s > clock as reference, and it might be way out of sync with the CPU's clock. >=20 > > Also, having > > standard helpers in ethdev for the conversion from TSC to NS would > > help. >=20 > Helpers to convert from CPU TSC to nanoseconds have broader scope than > ethdev and belong in the EAL, perhaps in > /lib/eal/include/generic/rte_cycles.h? Should I extend my patch to include the new RTE_ETH_RX_OFFLOAD_TIMESTAMP_NS= capability? What happens if the user only enables RTE_ETH_RX_OFFLOAD_TIMESTAMP in the A= F_PACKET PMD? I would suggest that in this case the timestamp will have microsecond accur= acy and only if RTE_ETH_RX_OFFLOAD_TIMESTAMP_NS is also enabled, then the t= imestamp will have nanosecond accuracy.