@@ -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;