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 15E784595D; Wed, 11 Sep 2024 08:59:24 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D79B8402DE; Wed, 11 Sep 2024 08:59:23 +0200 (CEST) Received: from dkmailrelay1.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id DA8C8402D1 for ; Wed, 11 Sep 2024 08:59:21 +0200 (CEST) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesys.local [192.168.4.10]) by dkmailrelay1.smartsharesystems.com (Postfix) with ESMTP id AC8162097B; Wed, 11 Sep 2024 08:59:21 +0200 (CEST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: [PATCH] net/af_packet: add timestamp offloading support Date: Wed, 11 Sep 2024 08:59:18 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.5 Message-ID: <98CBD80474FA8B44BF855DF32C47DC35E9F6CC@smartserver.smartshare.dk> In-Reply-To: <20240903114306.2336633-1-stefan.laesser@omicronenergy.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH] net/af_packet: add timestamp offloading support Thread-Index: Adr99pJlNqD0Bqe/RemHtYiNyLZeqwGHv4vg References: <20240903114306.2336633-1-stefan.laesser@omicronenergy.com> From: =?iso-8859-1?Q?Morten_Br=F8rup?= To: "Stefan Laesser" Cc: , , "Thomas Monjalon" , "John W. Linville" 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 Laesser [mailto:stefan.laesser@omicronenergy.com] > Sent: Tuesday, 3 September 2024 13.43 >=20 > Add the packet timestamp from TPACKET_V2 to the mbuf > dynamic rx timestamp register if offload RTE_ETH_RX_OFFLOAD_TIMESTAMP > is enabled. >=20 > TPACKET_V2 provides the timestamp with nanosecond resolution. Suggest adding: and UNIX origo, i.e. time since 1-JAN-1970 UTC. >=20 > Signed-off-by: Stefan Laesser > --- > +uint64_t af_packet_timestamp_dynflag; > +int af_packet_timestamp_dynfield_offset =3D -1; No need to expose these publicly, they should be static. This also means that you can remove the af_packet_ prefix. > eth_dev_start(struct rte_eth_dev *dev) > { > struct pmd_internals *internals =3D dev->data->dev_private; > - uint16_t i; > + > + if (internals->timestamp_offloading) { > + /* Register mbuf field and flag for Rx timestamp */ > + int rc =3D > = rte_mbuf_dyn_rx_timestamp_register(&af_packet_timestamp_dynfield_offset, > + &af_packet_timestamp_dynflag); > + if (rc) { > + PMD_LOG(ERR, "Cannot register mbuf field/flag for > timestamp"); > + return rc; > + } > + } >=20 > dev->data->dev_link.link_status =3D RTE_ETH_LINK_UP; > + > + uint16_t i; No need to move this down here. Please leave it where it was. Alternatively, minimize its scope by moving it inside the for loop: - for (i =3D 0; i < internals->nb_queues; i++) { + for (uint16_t i =3D 0; i < internals->nb_queues; i++) { With the two variables made local, Acked-by: Morten Br=F8rup