From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: netdev@vger.kernel.org
Cc: Willem de Bruijn <willemb@google.com>
Subject: [PATCH RFC net-next 2/6] net: build gso segs in multi release time SO_TXTIME
Date: Tue, 9 Jun 2020 10:09:30 -0400 [thread overview]
Message-ID: <20200609140934.110785-3-willemdebruijn.kernel@gmail.com> (raw)
In-Reply-To: <20200609140934.110785-1-willemdebruijn.kernel@gmail.com>
From: Willem de Bruijn <willemb@google.com>
When sending multiple segments per interval and the device supports
hardware segmentation, build one GSO segment per interval.
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
net/core/dev.c | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 5058083375fb..05f538f0f631 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3379,7 +3379,9 @@ EXPORT_SYMBOL(__skb_gso_segment);
struct sk_buff *skb_gso_segment_txtime(struct sk_buff *skb)
{
+ const netdev_features_t hw_features = NETIF_F_GSO_UDP_L4;
int mss_per_ival, mss_in_cur_ival;
+ u16 gso_size_orig, gso_segs_orig;
struct sk_buff *segs, *seg;
struct skb_shared_info *sh;
u64 step_ns, tstamp;
@@ -3401,13 +3403,27 @@ struct sk_buff *skb_gso_segment_txtime(struct sk_buff *skb)
if (sh->gso_segs <= mss_per_ival)
return NULL;
+ /* update gso size and segs to build 1 GSO packet per ival */
+ gso_size_orig = sh->gso_size;
+ gso_segs_orig = sh->gso_segs;
+ if (mss_per_ival > 1 && skb->dev->features & hw_features) {
+ sh->gso_size *= mss_per_ival;
+ sh->gso_segs = DIV_ROUND_UP(sh->gso_segs, mss_per_ival);
+ mss_per_ival = 1;
+ }
+
segs = skb_gso_segment(skb, NETIF_F_SG | NETIF_F_HW_CSUM);
- if (IS_ERR_OR_NULL(segs))
+ if (IS_ERR_OR_NULL(segs)) {
+ sh->gso_size = gso_size_orig;
+ sh->gso_segs = gso_segs_orig;
return segs;
+ }
mss_in_cur_ival = 0;
for (seg = segs; seg; seg = seg->next) {
+ unsigned int data_len, data_off;
+
seg->tstamp = tstamp & ~0xFF;
mss_in_cur_ival++;
@@ -3415,6 +3431,17 @@ struct sk_buff *skb_gso_segment_txtime(struct sk_buff *skb)
tstamp += step_ns;
mss_in_cur_ival = 0;
}
+
+ data_off = skb_checksum_start_offset(skb) +
+ skb->csum_offset + sizeof(__sum16);
+ data_len = seg->len - data_off;
+
+ if (data_len > gso_size_orig) {
+ sh = skb_shinfo(seg);
+ sh->gso_type = skb_shinfo(skb)->gso_type;
+ sh->gso_size = gso_size_orig;
+ sh->gso_segs = DIV_ROUND_UP(data_len, gso_size_orig);
+ }
}
return segs;
--
2.27.0.278.ge193c7cf3a9-goog
next prev parent reply other threads:[~2020-06-09 14:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-09 14:09 [PATCH RFC net-next 0/6] multi release pacing for UDP GSO Willem de Bruijn
2020-06-09 14:09 ` [PATCH RFC net-next 1/6] net: multiple release time SO_TXTIME Willem de Bruijn
2020-06-09 14:09 ` Willem de Bruijn [this message]
2020-06-09 14:09 ` [PATCH RFC net-next 3/6] net_sched: sch_fq: multiple release time support Willem de Bruijn
2020-06-09 15:00 ` Eric Dumazet
2020-06-09 15:10 ` Eric Dumazet
2020-06-09 14:09 ` [PATCH RFC net-next 4/6] selftests/net: so_txtime: support txonly/rxonly modes Willem de Bruijn
2020-06-09 14:09 ` [PATCH RFC net-next 5/6] selftests/net: so_txtime: add gso and multi release pacing Willem de Bruijn
2020-06-09 14:09 ` [PATCH RFC net-next 6/6] selftests/net: upgso bench: add pacing with SO_TXTIME Willem de Bruijn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200609140934.110785-3-willemdebruijn.kernel@gmail.com \
--to=willemdebruijn.kernel@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).