Allow TX timestamp with UDP GSO
Subsystems (3)
v2 cover Allow TX timestamp with UDP GSO
Fixes an issue where TX Timestamps are not arriving on the error queue when UDP_SEGMENT CMSG type is combined with CMSG type SO_TIMESTAMPING.
This is version 2 which moves the tests to net-next.
Fred Klassen (1):
net/udp_gso: Allow TX timestamp with UDP GSO
net/ipv4/udp_offload.c | 4 ++++ 1 file changed, 4 insertions(+)
Signature · 1 line
2.11.0
PATCH v2 1/1 net/udp_gso: Allow TX timestamp with UDP GSO
Fixes an issue where TX Timestamps are not arriving on the error queue when UDP_SEGMENT CMSG type is combined with CMSG type SO_TIMESTAMPING. This can be illustrated with an updated updgso_bench_tx program which includes the '-T' option to test for this condition.
./udpgso_bench_tx -4ucTPv -S 1472 -l2 -D 172.16.120.18 poll timeout
udp tx: 0 MB/s 1 calls/s 1 msg/s
The "poll timeout" message above indicates that TX timestamp never arrived.
It also appears that other TX CMSG types cause similar issues, for example trying to set SOL_IP/IP_TOS.
./udpgso_bench_tx -4ucPv -S 1472 -q 182 -l2 -D 172.16.120.18 poll timeout
udp tx: 0 MB/s 1 calls/s 1 msg/s
This patch preserves tx_flags for the first UDP GSO segment. This mirrors the stack's behaviour for IPv4 fragments.
--- net/ipv4/udp_offload.c | 4 ++++ 1 file changed, 4 insertions(+)
net/ipv4/udp_offload.c +4 -0
@@ -228,6 +228,10 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, seg = segs; uh =udp_hdr (seg); +/* preserve TX timestamp and zero-copy info for first segment */ +skb_shinfo (seg)->tskey =skb_shinfo (gso_skb)->tskey; +skb_shinfo (seg)->tx_flags =skb_shinfo (gso_skb)->tx_flags; +/* compute checksum adjustment based on old length versus new */ newlen =htons (sizeof (*uh) + mss); check =csum16_add (csum16_sub (uh->check, uh->len), newlen);
Signature · 1 line
2.11.0
Re: [PATCH net v2 1/1] net/udp_gso: Allow TX timestamp with UDP GSO
Quoted 10 lines · Fred Klassen
Fixes an issue where TX Timestamps are not arriving on the error queue when
UDP_SEGMENTCMSG type is combined with CMSG typeSO_TIMESTAMPING. This can be illustrated with an updatedupdgso_bench_txprogram which includes the '-T' option to test for this condition../udpgso_bench_tx -4ucTPv -S 1472 -l2 -D 172.16.120.18 poll timeout
udp tx: 0 MB/s 1 calls/s 1 msg/s
Quoted 5 lines
The "poll timeout" message above indicates that TX timestamp never arrived.
It also appears that other TX CMSG types cause similar issues, for example trying to set SOL_IP/IP_TOS.
If correct we need to find the root cause. Without that, this is not very informative. And likely the fix is not related, as that does not involve tx_flags or tskey.
What exact behavior do you observe: tx timestamp notifications go missing when enabling IP_TOS?
Quoted 7 lines
./udpgso_bench_tx -4ucPv -S 1472 -q 182 -l2 -D 172.16.120.18 poll timeout
udp tx: 0 MB/s 1 calls/s 1 msg/sThis patch preserves
tx_flagsfor the first UDP GSO segment. This mirrors the stack's behaviour for IPv4 fragments.
But deviates from the established behavior of other transport protocol TCP.
I think it's a bit premature to resubmit as is while still discussing the original patch.
Quoted 12 lines
Fixes ee80d1ebe5ba ("udp: add udp gso")Signed-off-by Fred Klassen <fklassen at appneta.com>--- net/ipv4/udp_offload.c | 4 ++++ 1 file changed, 4 insertions(+)net/ipv4/udp_offload.c +0
-0
net/ipv4/udp_offload.c struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, · line 231
Quoted 4 lines
net/ipv4/udp_offload.c +1
-0@@ -228,6 +228,10 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, seg = segs; uh =udp_hdr (seg); +/* preserve TX timestamp and zero-copy info for first segment */
As pointed out in v1, zerocopy flags are handled by protocol independent skb_segment. It calls skb_zerocopy_clone.
Quoted 9 lines
net/ipv4/udp_offload.c +3
-1+skb_shinfo (seg)->tskey =skb_shinfo (gso_skb)->tskey; +skb_shinfo (seg)->tx_flags =skb_shinfo (gso_skb)->tx_flags; +/* compute checksum adjustment based on old length versus new */ newlen =htons (sizeof (*uh) + mss); check =csum16_add (csum16_sub (uh->check, uh->len), newlen); --2.11.0
Re: [PATCH net v2 1/1] net/udp_gso: Allow TX timestamp with UDP GSO
Quoted 9 lines
Quoted 2 lines
It also appears that other TX CMSG types cause similar issues, for example trying to set SOL_IP/IP_TOS.
If correct we need to find the root cause. Without that, this is not very informative. And likely the fix is not related, as that does not involve
tx_flagsor tskey.What exact behavior do you observe: tx timestamp notifications go missing when enabling
IP_TOS?
The IP_TOS observation was a false positive, so removing this comment for v3.
Quoted 5 lines
Quoted 3 lines
This patch preserves
tx_flagsfor the first UDP GSO segment. This mirrors the stack's behaviour for IPv4 fragments.But deviates from the established behavior of other transport protocol TCP.
Ack. Removing comment for v3. The noted IPv4 fragment behavior is from at patch that is not been accepted yet.
Quoted 3 lines
I think it's a bit premature to resubmit as is while still discussing the original patch.
Understood. Will wait for acceptance before submitting v3.
Quoted 11 lines
net/ipv4/udp_offload.c struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, · line 231
Quoted 7 lines
net/ipv4/udp_offload.c +1
-0@@ -228,6 +228,10 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, seg = segs; uh =udp_hdr (seg); +/* preserve TX timestamp and zero-copy info for first segment */ As pointed out in v1, zerocopy flags are handled by protocol independent
skb_segment. It callsskb_zerocopy_clone.
Correcting in v3 to read …
"preserve TX timestamp flags and TS key for first segment”.
Re: [PATCH net v2 1/1] net/udp_gso: Allow TX timestamp with UDP GSO
Quoted 34 lines · Fred Klassen
Quoted 10 lines
Quoted 3 lines
It also appears that other TX CMSG types cause similar issues, for example trying to set SOL_IP/IP_TOS.
If correct we need to find the root cause. Without that, this is not very informative. And likely the fix is not related, as that does not involve
tx_flagsor tskey.What exact behavior do you observe: tx timestamp notifications go missing when enabling
IP_TOS?The
IP_TOSobservation was a false positive, so removing this comment for v3.Quoted 5 lines
Quoted 3 lines
This patch preserves
tx_flagsfor the first UDP GSO segment. This mirrors the stack's behaviour for IPv4 fragments.But deviates from the established behavior of other transport protocol TCP.
Ack. Removing comment for v3. The noted IPv4 fragment behavior is from at patch that is not been accepted yet.
Quoted 3 lines
I think it's a bit premature to resubmit as is while still discussing the original patch.
Understood. Will wait for acceptance before submitting v3.
Quoted 6 lines
Quoted 6 lines
net/ipv4/udp_offload.c +0
-0@@ -228,6 +228,10 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, seg = segs; uh =udp_hdr (seg);
Quoted 8 lines
Quoted 5 lines
net/ipv4/udp_offload.c struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb, · line 231
Quoted 1 line
net/ipv4/udp_offload.c +1
-0+/* preserve TX timestamp and zero-copy info for first segment */ As pointed out in v1, zerocopy flags are handled by protocol independent
skb_segment. It callsskb_zerocopy_clone.Correcting in v3 to read …
"preserve TX timestamp flags and TS key for first segment”.
Sounds good.
When resubmitting otherwise the same patch, please comment clearly why this is the preferred solution (because in some ways it is not):
- Timestamping both first and last segmented is not feasible. Hardware can only have one outstanding TS request at a time.
- Timestamping last segment may under report network latency of the previous segments. Even though the doorbell is suppressed, the ring producer counter has been incremented.
I have probably missed a few.
Timestamping the first segment has the downside that it may underreport tx host network latency. It appears that we have to pick one or the other. And possibly follow-up with a config flag to choose behavior..