netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next 1/1] selftests/bpf: Enable Tx hwtstamp in xdp_hw_metadata
@ 2024-12-04 11:57 Song Yoong Siang
  2024-12-04 15:48 ` Stanislav Fomichev
  0 siblings, 1 reply; 4+ messages in thread
From: Song Yoong Siang @ 2024-12-04 11:57 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, David S . Miller,
	Jakub Kicinski, Jesper Dangaard Brouer, John Fastabend,
	Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
	Martin KaFai Lau, Song Liu, Yonghong Song, KP Singh,
	Stanislav Fomichev, Hao Luo, Jiri Olsa, Shuah Khan
  Cc: netdev, bpf, linux-kselftest, linux-kernel

Set tx_type to HWTSTAMP_TX_ON to enable hardware timestamping for all
outgoing packets.

Besides, set XDP_UMEM_TX_METADATA_LEN flag to reserve tx_metadata_len bytes
of per-chunk metadata.

Signed-off-by: Song Yoong Siang <yoong.siang.song@intel.com>
---
 tools/testing/selftests/bpf/xdp_hw_metadata.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/xdp_hw_metadata.c b/tools/testing/selftests/bpf/xdp_hw_metadata.c
index 06266aad2f99..6f7b15d6c6ed 100644
--- a/tools/testing/selftests/bpf/xdp_hw_metadata.c
+++ b/tools/testing/selftests/bpf/xdp_hw_metadata.c
@@ -79,7 +79,7 @@ static int open_xsk(int ifindex, struct xsk *xsk, __u32 queue_id)
 		.fill_size = XSK_RING_PROD__DEFAULT_NUM_DESCS,
 		.comp_size = XSK_RING_CONS__DEFAULT_NUM_DESCS,
 		.frame_size = XSK_UMEM__DEFAULT_FRAME_SIZE,
-		.flags = XSK_UMEM__DEFAULT_FLAGS,
+		.flags = XDP_UMEM_TX_METADATA_LEN,
 		.tx_metadata_len = sizeof(struct xsk_tx_metadata),
 	};
 	__u32 idx = 0;
@@ -551,6 +551,7 @@ static void hwtstamp_enable(const char *ifname)
 {
 	struct hwtstamp_config cfg = {
 		.rx_filter = HWTSTAMP_FILTER_ALL,
+		.tx_type = HWTSTAMP_TX_ON,
 	};
 
 	hwtstamp_ioctl(SIOCGHWTSTAMP, ifname, &saved_hwtstamp_cfg);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH bpf-next 1/1] selftests/bpf: Enable Tx hwtstamp in xdp_hw_metadata
  2024-12-04 11:57 [PATCH bpf-next 1/1] selftests/bpf: Enable Tx hwtstamp in xdp_hw_metadata Song Yoong Siang
@ 2024-12-04 15:48 ` Stanislav Fomichev
  2024-12-05  1:36   ` Song, Yoong Siang
  0 siblings, 1 reply; 4+ messages in thread
From: Stanislav Fomichev @ 2024-12-04 15:48 UTC (permalink / raw)
  To: Song Yoong Siang
  Cc: Alexei Starovoitov, Daniel Borkmann, David S . Miller,
	Jakub Kicinski, Jesper Dangaard Brouer, John Fastabend,
	Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
	Martin KaFai Lau, Song Liu, Yonghong Song, KP Singh,
	Stanislav Fomichev, Hao Luo, Jiri Olsa, Shuah Khan, netdev, bpf,
	linux-kselftest, linux-kernel

On 12/04, Song Yoong Siang wrote:
> Set tx_type to HWTSTAMP_TX_ON to enable hardware timestamping for all
> outgoing packets.
> 
> Besides, set XDP_UMEM_TX_METADATA_LEN flag to reserve tx_metadata_len bytes
> of per-chunk metadata.

XDP_UMEM_TX_METADATA_LEN is missing after d5e726d9143c ("xsk: Require
XDP_UMEM_TX_METADATA_LEN to actuate tx_metadata_len"), so that make
sense. Maybe add a fixes tag?

And I don't see mlx5 looking at HWTSTAMP_TX anywhere in the drivers,
so I'm assuming that's why I didn't need HWTSTAMP_TX_ON during my tests..
Which device are you testing against? I do see some hwts_tx_en
checks in the stfmmac at least... Can you add these details to the
commit message and respin?

With the above addressed:
Acked-by: Stanislav Fomichev <sdf@fomichev.me>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH bpf-next 1/1] selftests/bpf: Enable Tx hwtstamp in xdp_hw_metadata
  2024-12-04 15:48 ` Stanislav Fomichev
@ 2024-12-05  1:36   ` Song, Yoong Siang
  2024-12-05 19:25     ` Stanislav Fomichev
  0 siblings, 1 reply; 4+ messages in thread
From: Song, Yoong Siang @ 2024-12-05  1:36 UTC (permalink / raw)
  To: Stanislav Fomichev
  Cc: Alexei Starovoitov, Daniel Borkmann, David S . Miller,
	Jakub Kicinski, Jesper Dangaard Brouer, John Fastabend,
	Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
	Martin KaFai Lau, Song Liu, Yonghong Song, KP Singh,
	Stanislav Fomichev, Hao Luo, Jiri Olsa, Shuah Khan,
	netdev@vger.kernel.org, bpf@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org

On Wednesday, December 4, 2024 11:49 PM, Stanislav Fomichev <stfomichev@gmail.com> wrote:
>On 12/04, Song Yoong Siang wrote:
>> Set tx_type to HWTSTAMP_TX_ON to enable hardware timestamping for all
>> outgoing packets.
>>
>> Besides, set XDP_UMEM_TX_METADATA_LEN flag to reserve tx_metadata_len bytes
>> of per-chunk metadata.
>
>XDP_UMEM_TX_METADATA_LEN is missing after d5e726d9143c ("xsk: Require
>XDP_UMEM_TX_METADATA_LEN to actuate tx_metadata_len"), so that make
>sense. Maybe add a fixes tag?
>

Sure. I will add the fixes tag and submit with "PATCH bpf" prefix
in next version.

>And I don't see mlx5 looking at HWTSTAMP_TX anywhere in the drivers,
>so I'm assuming that's why I didn't need HWTSTAMP_TX_ON during my tests..
>Which device are you testing against? I do see some hwts_tx_en
>checks in the stfmmac at least... Can you add these details to the
>commit message and respin?
>

I am testing on stmmac and igc drivers.
You are right, stmmac needs it for hwts_tx_en check.
Besides, igc needs it to set IGC_RING_FLAG_TX_HWTSTAMP flag.

Without this patch, user will need to manually enable tx hwts using
command: sudo hwstamp_ctl -i eth0 -t 1 -r 1
after start xdp_hw_metadata.

Therefore, adding HWTSTAMP_TX_ON is not a bug fix solution.
I will separate this as another new patch to "PATCH bpf-next"
and provide detail in commit message.

Btw, is mlx5 driver always enable Tx HWTS?

>With the above addressed:
>Acked-by: Stanislav Fomichev <sdf@fomichev.me>

Thanks & Regards
Siang


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH bpf-next 1/1] selftests/bpf: Enable Tx hwtstamp in xdp_hw_metadata
  2024-12-05  1:36   ` Song, Yoong Siang
@ 2024-12-05 19:25     ` Stanislav Fomichev
  0 siblings, 0 replies; 4+ messages in thread
From: Stanislav Fomichev @ 2024-12-05 19:25 UTC (permalink / raw)
  To: Song, Yoong Siang
  Cc: Alexei Starovoitov, Daniel Borkmann, David S . Miller,
	Jakub Kicinski, Jesper Dangaard Brouer, John Fastabend,
	Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
	Martin KaFai Lau, Song Liu, Yonghong Song, KP Singh,
	Stanislav Fomichev, Hao Luo, Jiri Olsa, Shuah Khan,
	netdev@vger.kernel.org, bpf@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org

On 12/05, Song, Yoong Siang wrote:
> On Wednesday, December 4, 2024 11:49 PM, Stanislav Fomichev <stfomichev@gmail.com> wrote:
> >On 12/04, Song Yoong Siang wrote:
> >> Set tx_type to HWTSTAMP_TX_ON to enable hardware timestamping for all
> >> outgoing packets.
> >>
> >> Besides, set XDP_UMEM_TX_METADATA_LEN flag to reserve tx_metadata_len bytes
> >> of per-chunk metadata.
> >
> >XDP_UMEM_TX_METADATA_LEN is missing after d5e726d9143c ("xsk: Require
> >XDP_UMEM_TX_METADATA_LEN to actuate tx_metadata_len"), so that make
> >sense. Maybe add a fixes tag?
> >
> 
> Sure. I will add the fixes tag and submit with "PATCH bpf" prefix
> in next version.
> 
> >And I don't see mlx5 looking at HWTSTAMP_TX anywhere in the drivers,
> >so I'm assuming that's why I didn't need HWTSTAMP_TX_ON during my tests..
> >Which device are you testing against? I do see some hwts_tx_en
> >checks in the stfmmac at least... Can you add these details to the
> >commit message and respin?
> >
> 
> I am testing on stmmac and igc drivers.
> You are right, stmmac needs it for hwts_tx_en check.
> Besides, igc needs it to set IGC_RING_FLAG_TX_HWTSTAMP flag.
> 
> Without this patch, user will need to manually enable tx hwts using
> command: sudo hwstamp_ctl -i eth0 -t 1 -r 1
> after start xdp_hw_metadata.
> 
> Therefore, adding HWTSTAMP_TX_ON is not a bug fix solution.
> I will separate this as another new patch to "PATCH bpf-next"
> and provide detail in commit message.
> 
> Btw, is mlx5 driver always enable Tx HWTS?

I don't remember doing anything special to enable it. And looking at
the code I also don't see any conditionals on HWTSTAMP_TX_ON.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-12-05 19:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-04 11:57 [PATCH bpf-next 1/1] selftests/bpf: Enable Tx hwtstamp in xdp_hw_metadata Song Yoong Siang
2024-12-04 15:48 ` Stanislav Fomichev
2024-12-05  1:36   ` Song, Yoong Siang
2024-12-05 19:25     ` Stanislav Fomichev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).