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 15A414595B; Wed, 11 Sep 2024 07:44:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CDC9B402DE; Wed, 11 Sep 2024 07:44:51 +0200 (CEST) Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11020127.outbound.protection.outlook.com [52.101.69.127]) by mails.dpdk.org (Postfix) with ESMTP id 4CE63402D1 for ; Wed, 11 Sep 2024 07:44:50 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tsLqbK8nsOGeljUdll4ywe2ty2WU3249+LVkgwNz8slHlDFzu8PJvxhGLVXuj3HuF1TYqqwZgMuWOLysdvekbxkm6XCXxuMH2GCLQsHYkGifJz0nFx2XklSYgsaDsS/8DkSYVNRaaEgdO3dUAHLmloUjEn+y2JTGMlGImhRELl8o17f0MZqV4uvrENdMHl+cXTr4bR2eOnADRzDp4DWeRa7aYOQhgzjeJb78v1V0UjkOIF3BmJOajd6J7soTOLukmKH5ioRBzbpNb8ckt7dfmZsPKLO+mu4eVZnY+0y8FaJuXZdKZN8g3hoDpQgbw79wuBDzeWFq7bT1enH12C+Fnw== 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=ko2UvBo66JoixlBIWZuvN6HBMp8+6GDl6Mqdf54kLgY=; b=sAnxTmDjMIwrNvsZE42nGBmLYUlxh9d8nohLO7N5lAhsMWIuYuX74fedEFU1DnMseiPTD4pbLoj+7Iq52P7zHs6svEPNE7NSuna8TUt6d6WIhWmLQFB0QXC2eGC+Hsm3B379k9BQ+kokOigsZSxPUAqfESIGvcm2ZX3F3vlsfPIb3gKQ86sjctBgdTSm/hbtEscLGx32GMTQs8l26UIHfLtJ4FPhqT8+VdwZJr/DauVTmne6Fx8LbcSJQrUIGTHfHvTRQsIC9pMMj8IO1fdxQxqza/VCXsZj4CkGw1BD7dMgVyqhMbVoRdTe3svFsrnNFHuginhZpJTvzB8MNdQy0A== 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=ko2UvBo66JoixlBIWZuvN6HBMp8+6GDl6Mqdf54kLgY=; b=BQgeUUoA9J+h43inRQfA9goMTAQkfBKEd2o1/1Ny77T0bvlYAEo5nIgXy7iVRruFCMR2KeYeqPuAeSbnI/WG4xDPVbvrpap2LumPacyf9ZDW6ZdvGXT/LZ8U762cTX+2dfcW8Vyc//zJktr+skpdMwHuuvuaauRfJ32WRCOJlLU= Received: from AM0PR03MB6275.eurprd03.prod.outlook.com (2603:10a6:20b:154::17) by DB8PR03MB6233.eurprd03.prod.outlook.com (2603:10a6:10:136::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Wed, 11 Sep 2024 05:44:47 +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; Wed, 11 Sep 2024 05:44:47 +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/faIgXyAWopV9kGrv4mtbbKJvrJGPscAgABQ2QCAA7yKkIAAHJmQgAe1myA= Date: Wed, 11 Sep 2024 05:44:47 +0000 Message-ID: References: <20240903114306.2336633-1-stefan.laesser@omicronenergy.com> <20240903092138.0e071924@hermes.local> <98CBD80474FA8B44BF855DF32C47DC35E9F698@smartserver.smartshare.dk> <98CBD80474FA8B44BF855DF32C47DC35E9F6AE@smartserver.smartshare.dk> In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9F6AE@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_|DB8PR03MB6233:EE_ x-ms-office365-filtering-correlation-id: e2ceb260-5441-4525-93a0-08dcd224d8ad x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|376014|1800799024|366016|38070700018; x-microsoft-antispam-message-info: =?Windows-1252?Q?1a+AxcLnCD2+QEgceya4Q31N3R4HL0v7DkAMYePCaUgEnot22oGcmMSx?= =?Windows-1252?Q?AefMrbC/6jOsVl3i8iW2g4wEcG/4w9z5vbBD5VNssYfJq3wsmUp+cjHS?= =?Windows-1252?Q?UqSli5BIiI0mB5dY6RyBBZ3W/wHznKQKf7wCb5f3x8HjSraYRkWD9G05?= =?Windows-1252?Q?vmB2nKIByRvkEr6NojrQGQ1tp6o/3D2kMw8MrSwj4M/BfuTIIe1JAZMx?= =?Windows-1252?Q?QqvCQ7pMT5lz3f2x7dUV6vGIAssdZ7p5ZSHxgMkxMCfk+yAT6gPXX0qs?= =?Windows-1252?Q?YyIGfA8njKmKyQITVqn89zTm1ActkYhKu8zUo+2ox9/SiGtx0GleGbug?= =?Windows-1252?Q?Nrv2dlIkyqd3WidgF6y3wYdwacZekQ6Mdd/O/HSGpOBO03wFkjOC3yEK?= =?Windows-1252?Q?fJ8UVbF3kKI6PiJfRtXjkquq+h2YThEwZ360BomeAf4PHTCojOIF3nUk?= =?Windows-1252?Q?UJOj017voZsu+G0/OXdy4q0DWGbZaQGZJzIRiq8F/YKAxXxgFPMC//WU?= =?Windows-1252?Q?YZFvvDUHVAO6Xg7bA/cvzT+g9wkHHSbdwcWwHRUTGvToyXH76xtdN+50?= =?Windows-1252?Q?n+5KuQGoXwig+BJwlT0iUYQn3iIb571/Ijz7Cl3pidWdSdUgJb7UCs4r?= =?Windows-1252?Q?1Y5NiYH303/Q9GpZuCVgjobVbFww75LsC3nFpBKIVvw9wN++w5PAVtV1?= =?Windows-1252?Q?NK8pBpJtivSG52tCtVLYAx5lNO6jeLYpM2coMjFSBzis/yp6y86sJOuL?= =?Windows-1252?Q?/piTULJMnfqK425EiIXh5+0XZi6+mJCNQfs/s4wsC+2aE0dTmNHGL1tc?= =?Windows-1252?Q?+3UDWHBbRBGk6/z3O59zR0BDZy5ctL50ijCOl5lsIPKqzHY/TeTdGavL?= =?Windows-1252?Q?juA2SfX38oaDQDr0nqHK24ucvawTH1fhHOjGFTDlDRApZFmUMUmB58rN?= =?Windows-1252?Q?5b5n5gv1KsbjQLa3ck9mxu0aSDF/xM1SIY1ejhpm4XL7jpXSK9+nlNH4?= =?Windows-1252?Q?hLXRmDpeR1dvCeWcLs1sdINGwcyjj6TMkpx4P1SSId0/S4sHoZu9WAlb?= =?Windows-1252?Q?E6QzsRjX7/3opIqexEMPJEP8AircU8ghp3Sz7nBfjm5SnGLaev0M5vUg?= =?Windows-1252?Q?E6OAd+x/Ndv3TIBYWw3pStuK8OZ+ZlHpF/iV5fqcmh61IIubAOpD3aRW?= =?Windows-1252?Q?vIp0tt0Ph+/y92/EsBrkzqn8eWBJ3vXPcXy0hN0TrCDsD/Y/Rf+thpXD?= =?Windows-1252?Q?BAsE/UxQACChb2Ipqi2/viHYiM7KQ5su22nfV3pAstrHeBuv1ekDpna5?= =?Windows-1252?Q?BNXpIZk/f1Q6/dzD/Aq5e7hkCEgkJVKkc4QGeWxIPw0XeJjoA8KGM+7e?= =?Windows-1252?Q?Ayx4ZKX/94o+ph/PlugnV8yLkK5vQ0g8eO26JHv5PbUHBtIL3J2jfa8x?= =?Windows-1252?Q?JXEugsQaiHmTIpzcVul/q9lbzO8DLF3Qd1LrvWNtmihVkxMOZBTft0W0?= =?Windows-1252?Q?NjutAtjGQx/bXv1Dz7GpKBhWHB2eVA=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)(376014)(1800799024)(366016)(38070700018); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?Windows-1252?Q?V1ElT7Z2lvAwP+4G2bYjB3652ZSQneX6wDPLZVhkxSkAqZ1tcuu2l62M?= =?Windows-1252?Q?ftH3jO/ETdz2WbUBgbWOjmxR0AGt4dOpcgorS2FjP/6OQ6RCYBYFvwCB?= =?Windows-1252?Q?EEH5gylaHIFMiDWwcCkjkqUVIKPPwcTv2+SX9TD8pgCW3xrRKObeQxZy?= =?Windows-1252?Q?daiAytHXM4VhU907391NYZaBuivwO84s2Ma698ZVsMNl5jZ7SwRwNikS?= =?Windows-1252?Q?ALWCrmXvm3emY/uSGnL3Jx1Hsg9QHHQgf8R21WedLgjiSC4mbfuPR83Y?= =?Windows-1252?Q?1b9vzCgopaYqFPybFXe4sM+xAK2UEIQf7cFuiyFRc1At+CYmibIUcjRX?= =?Windows-1252?Q?Ky6rpJK6gPVbf5YcOdfOQYsoq5Qm/Ajhl0V0SbpkJmR8m7OniD0I3aWq?= =?Windows-1252?Q?AeTDok9AT9U5BCKCKebH21Wuuq1mN0+AwOFlYfg/uOLUW61bCv4cl19U?= =?Windows-1252?Q?8csFqxemUHslqJi5+FeD7USkLsSd8/5HiOYxAz+dN1cMolXbwaT3rQD6?= =?Windows-1252?Q?XIfcYIPKE8cZQT/5Fq5nnimFOkktSF1AQTg7RmDGnUamZsPvmcPWMGgU?= =?Windows-1252?Q?acPjs3S/bbmsPrF07cj1sk8scmsH4nx3p6/gApYBYC/TGAZfDXEFcfgY?= =?Windows-1252?Q?HKMhehlg13T5Y6qudQOVALFo9ubnLjuJJEpUiGRoWCuwJMqJBu8n2Rah?= =?Windows-1252?Q?HbgFx+gfT63rTv4039vjJDc8m0uom23ekTqwLBqLjuW2SgOZ+4ve9uFA?= =?Windows-1252?Q?XlpKfiCyfoIKkpB/yu2PVnu4YaxcbqEjophudBLNxXFWLi7BwCGGJ7ie?= =?Windows-1252?Q?nnjtBZ1JNVUoAMhbFaqUM2WpLQ/2bj32hpE7Mg40p/sdROfHvVie8Mh4?= =?Windows-1252?Q?h8Z6AGDwshhB2EIZhcssDqHAUNvE0t9EODfs4joCM9KV2BJDf9TEANyC?= =?Windows-1252?Q?GTj8OwHy07vXKve4N86hMid48sUzjuJDkZZs/4Vkul4xoVMZMpXDs8BD?= =?Windows-1252?Q?YVQj/XNh0hfjwuvxQLEXWI6jwsQERV+smZXRzqbpkm0Pp9rYCWHFeutM?= =?Windows-1252?Q?wHtuVbhtGJ2PpAutG4t8YZYidOvKrTeI6FBv9OdfYAqTWw7sp2nIggcT?= =?Windows-1252?Q?9wH/A8qAFxMBNwU5OA2FLUrWpfAQCD0iFh80AojYS8GaUWcRqMBF1ktb?= =?Windows-1252?Q?HBWS5Okn8yu8mPpha6RrCaFvK6ZgNGccuPc6njMiLKfz1MLHumfJnVgO?= =?Windows-1252?Q?aqwgMktbGNjGYnnmIrSxlQR4Fpg48gxFxCG7cOP0Wxh7tW5mNHAFR25X?= =?Windows-1252?Q?oaCV3tJ7bPLyo+72X8UzwmDxzjRMhPRL5dk2mCxp4Elagd9FJGGX8F3v?= =?Windows-1252?Q?JK+a+oPN2S4jzahV65C9QUBavPCD15V4Gf0z4SR2fsJPTMjDEe5CtAlX?= =?Windows-1252?Q?Ns1a/xLS0e4po9txKBUsQhoZJ4ZVaY4GHl/+mgRyYMDOyC5ZOfeDBG49?= =?Windows-1252?Q?qW4GKLxZ9NFb1+vm6480H8NJf5kpHnb7zx4VoKldrD7haC++qB2rNvLx?= =?Windows-1252?Q?2LGqG/ew+MI4dBsTnqidpnEzxBFsRHyhhW9XDA9rkJoHZVgzCEy6IDwm?= =?Windows-1252?Q?GndRKst8TqOaWHQHIMuIZH0TnwJ3Mn1leeqcBCnCm+GoUL+RlfqnDMI8?= =?Windows-1252?Q?3Vhg5zpYi8Oqr9GmZOqrCqXZKzqqdgCMbIrKeVpFU/fNThgoPTHA9w?= =?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: e2ceb260-5441-4525-93a0-08dcd224d8ad X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Sep 2024 05:44:47.5114 (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: 8dMwFrXNXN3c0R+O3NYxJJ7gjmIpvevinvIrlTlfE1GYawVJm66MBT0EZCheWizOuk7bmLmacrDC5WbchsZDZeupV5TRAr06A19Uaue8JzihaDQlvOPABbWf1kO9CHq5 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR03MB6233 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: Stefan L=E4sser [mailto:stefan.laesser@omicronenergy.com] > > Sent: Friday, 6 September 2024 08.23 > > > > > > 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. > > > > > > As far as I can see, this patch does use the existing > > > cross-driver/generic timestamp dynamic field, like the pcap driver. > > > > Yes, I use the generic timestamp dynamic field as used in all the > > other PMDs I have looked at. > > > > > > > > > > > > > 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. > > > > > > 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 need > > 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 same > > as > > > if the drivers did it. I.e. from a performance perspective, the > > > drivers > > might as > > > well do the conversion, and from a usability perspective, it would > > > be easier with a standard unit and base. > > > > > > We should define a roadmap towards dynamic mbuf field timestamps > > > using fixed unit and base (instead of driver-specific) and migrate to= wards it. > > > > > > 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. > > > > > > 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 the 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 w= ith the > CPU's clock. > > > > > > > Also, having > > > > standard helpers in ethdev for the conversion from TSC to NS would > > > > help. > > > > > > 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? >=20 > That would be nice, but not a requirement. :-) >=20 > Please do it as a series of patches, maybe three: > 1. This patch. > 2. A patch to generally introduce TIMESTAMP_NS RX offload and capability > flags. > 3. A patch to implement TIMESTAMP_NS in af_packet. I will give it a try. :-) > The new TIMESTAMP_NS feature might trigger some discussions, and you don'= t > want this patch caught up too much in that discussion. >=20 > > What happens if the user only enables RTE_ETH_RX_OFFLOAD_TIMESTAMP in > > the AF_PACKET PMD? > > I would suggest that in this case the timestamp will have microsecond > > accuracy and only if RTE_ETH_RX_OFFLOAD_TIMESTAMP_NS is also enabled, > > then the timestamp will have nanosecond accuracy. >=20 > There's no need for different timestamp accuracy if TIMESTAMP_NS is not > enabled. > RTE_ETH_RX_OFFLOAD_TIMESTAMP means that a timestamp is present, with > driver dependent clock and base. > The driver is allowed to use nanoseconds as clock and UNIX origo as base, > regardless. >=20 Okay - so the purpose of RTE_ETH_RX_OFFLOAD_TIMESTAMP_NS is just to signal = that the PMD delivers timestamps with nanoseconds resolution - I see. What about this patch: are the changes valid / good enough to become part o= f the mainline version?