[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ea087229cc6f7953875fc69f1b73df1ae1ee9b72.camel@siemens.com>
Date: Thu, 23 Jan 2025 18:24:22 +0100
From: Florian Bezdeka <florian.bezdeka@...mens.com>
To: "Song, Yoong Siang" <yoong.siang.song@...el.com>, "Bouska, Zdenek"
<zdenek.bouska@...mens.com>, "David S . Miller" <davem@...emloft.net>, Eric
Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo
Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>, Willem de
Bruijn <willemb@...gle.com>, Donald Hunter <donald.hunter@...il.com>,
Jonathan Corbet <corbet@....net>, Bjorn Topel <bjorn@...nel.org>,
"Karlsson, Magnus" <magnus.karlsson@...el.com>, "Fijalkowski, Maciej"
<maciej.fijalkowski@...el.com>, Jonathan Lemon <jonathan.lemon@...il.com>,
Andrew Lunn <andrew+netdev@...n.ch>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, Jesper Dangaard Brouer
<hawk@...nel.org>, John Fastabend <john.fastabend@...il.com>, "Damato, Joe"
<jdamato@...tly.com>, Stanislav Fomichev <sdf@...ichev.me>, Xuan Zhuo
<xuanzhuo@...ux.alibaba.com>, Mina Almasry <almasrymina@...gle.com>, Daniel
Jurgens <danielj@...dia.com>, Andrii Nakryiko <andrii@...nel.org>, Eduard
Zingerman <eddyz87@...il.com>, Mykola Lysenko <mykolal@...com>, Martin
KaFai Lau <martin.lau@...ux.dev>, Song Liu <song@...nel.org>, Yonghong Song
<yonghong.song@...ux.dev>, KP Singh <kpsingh@...nel.org>, Hao Luo
<haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>, Shuah Khan
<shuah@...nel.org>, Alexandre Torgue <alexandre.torgue@...s.st.com>, Jose
Abreu <joabreu@...opsys.com>, Maxime Coquelin <mcoquelin.stm32@...il.com>,
"Nguyen, Anthony L" <anthony.l.nguyen@...el.com>, "Kitszel, Przemyslaw"
<przemyslaw.kitszel@...el.com>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
"bpf@...r.kernel.org" <bpf@...r.kernel.org>,
"linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>,
"linux-stm32@...md-mailman.stormreply.com"
<linux-stm32@...md-mailman.stormreply.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "intel-wired-lan@...ts.osuosl.org"
<intel-wired-lan@...ts.osuosl.org>, "xdp-hints@...-project.net"
<xdp-hints@...-project.net>
Subject: Re: [PATCH bpf-next v6 4/4] igc: Add launch time support to XDP ZC
Hi all,
On Thu, 2025-01-23 at 16:41 +0000, Song, Yoong Siang wrote:
> On Thursday, January 23, 2025 11:40 PM, Bouska, Zdenek <zdenek.bouska@...mens.com> wrote:
> >
> > Hi Siang,
> >
> > I tested this patch series on 6.13 with Intel I226-LM (rev 04).
> >
> > I also applied patch "selftests/bpf: Actuate tx_metadata_len in xdp_hw_metadata" [1]
> > and "selftests/bpf: Enable Tx hwtstamp in xdp_hw_metadata" [2] so that TX timestamps
> > work.
> >
> > HW RX-timestamp was small (0.5956 instead of 1737373125.5956):
> >
> > HW RX-time: 595572448 (sec:0.5956) delta to User RX-time sec:1737373124.9873 (1737373124987318.750 usec)
> > XDP RX-time: 1737373125582798388 (sec:1737373125.5828) delta to User RX-time sec:0.0001 (92.733 usec)
> >
> > Igc's raw HW RX-timestamp in front of frame data was overwritten by BPF program on
> > line 90 in tools/testing/selftests/bpf: meta->hint_valid = 0;
> >
> > "HW timestamp has been copied into local variable" comment is outdated on
> > line 2813 in drivers/net/ethernet/intel/igc/igc_main.c after
> > commit 069b142f5819 igc: Add support for PTP .getcyclesx64() [3].
> >
> > Workaround is to add unused data to xdp_meta struct:
> >
> > --- a/tools/testing/selftests/bpf/xdp_metadata.h
> > +++ b/tools/testing/selftests/bpf/xdp_metadata.h
> > @@ -49,4 +49,5 @@ struct xdp_meta {
> > __s32 rx_vlan_tag_err;
> > };
> > enum xdp_meta_field hint_valid;
> > + __u8 avoid_IGC_TS_HDR_LEN[16];
> > };
> >
>
> Hi Zdenek Bouska,
>
> Thanks for your help on testing this patch set.
> You are right, there is some issue with the Rx hw timestamp,
> I will submit the bug fix patch when the solution is finalized,
> but the fix will not be part of this launch time patch set.
> Until then, you can continue to use your WA.
I think there is no simple fix for that. That needs some discussion
around the "expectations" to the headroom / meta data area in front of
the actual packet data.
To be able to write generic BPF programs - generic in terms of "works
with all drivers" - the headroom is expected to be available for use
inside the BPF program.
I think that is true for most drivers / devices, but at least igc is
different in this regard. Devices deliver the RX timestamp in front of
the actual data while other devices deliver the meta information as
part of the RX descriptor.
For igc we get:
+----------+-----------------+-----+------+
| headroom | custom metadata |RX TS| data |
+----------+-----------------+-----+------+
^ ^
| |
xdp_buff->data_meta xdp_buff->data
The only information the application gets is a pointer to the start of
the data section. For calculating / finding the beginning of the meta
data area the application has to go backward.
That is exactly how it is currently implemented in the selftest.
Problem: By writing into the calculated meta data area the BPF program
might already destroy meta information delivered by the driver. At
least for igc this is a problem.
I hope that was clear...
Best regards,
Florian
>
> > But Launch time still does not work:
> >
> > HW Launch-time: 1737374407515922696 (sec:1737374407.5159) delta to HW TX-complete-time sec:-0.9999 (-999923.649 usec)
> >
> > Command "sudo ethtool -X enp1s0 start 1 equal 1" was in v4 [4] but is not in v6.
> > Was that intentional? After executing it Launch time feature works:
>
> This ethtool command is to use RSS method to route the incoming packet
> to the queue which has launch time enabled. However, not every device support
> RSS. So I move to use a more generic method, which is vlan priority method,
> to route the incoming packet. Therefore, you need to send an
> UDP packet with VLAN priority 1 to port 9091 of DUT.
>
> Below is example of my python script to generate the vlan UDP packet.
> You can have a quick try on it.
>
> from scapy.all import *
> from scapy.all import Ether, Dot1Q, IP, UDP
> packet = Ether(src="44:ab:bc:bb:21:44", dst="22:ab:bc:bb:12:34") / Dot1Q(vlan=100, prio=1) / IP(src="169.254.1.2", dst="169.254.1.1") / UDP(dport=9091)
> sendp(packet, iface="enp1s0")
>
> Thanks & Regards
> Siang
>
> >
> > HW Launch-time: 1737374618088557111 (sec:1737374618.0886) delta to HW TX-complete-time sec:0.0000 (0.012 usec)
> >
> > Thank you for XDP launch time support!
> >
> > [1] https://lore.kernel.org/linux-kernel/20241205044258.3155799-1-
> > yoong.siang.song@...el.com/
> > [2] https://lore.kernel.org/linux-kernel/20241205051936.3156307-1-
> > yoong.siang.song@...el.com/
> > [3]
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=069
> > b142f58196bd9f47b35e493255741e2c663c7
> > [4] https://lore.kernel.org/linux-kernel/20250106135724.9749-1-
> > yoong.siang.song@...el.com/
> >
> > Best regards,
> > Zdenek Bouska
> >
> > --
> > Siemens, s.r.o
> > Foundational Technologies
> >
Powered by blists - more mailing lists