Skip to contentSkip to conversation

xen-netback: add gso_segs calculation

PATCH Applied Paul Durrant 4 participants 9 messages Dec 17, 2013 – Dec 19, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 xen-netback: add gso_segs calculation

netback already has code which parses IPv4 and v6 headers to set up checksum offsets and these are always applied to GSO packets being sent from frontends. It's therefore suboptimal that GSOs are being marked SKB_GSO_DODGY to defer the gso_segs calculation when netback already has all necessary information to hand to do the calculation. This patch adds that calculation.

Cc Wei Liu <[email protected]>
Cc Ian Campbell <[email protected]>
Cc David Vrabel <[email protected]>
Cc Eric Dumazet <[email protected]>

---
v2:
- Fixed header size calculation

 drivers/net/xen-netback/netback.c |   19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/net/xen-netback/netback.c +15 -4
index 904e497..d376e27 100644
@@ -1043,10 +1043,7 @@ static int xenvif_set_skb_gso(struct xenvif *vif,
 	}
 
 	skb_shinfo(skb)->gso_size = gso->u.gso.size;
-
-	/* Header must be checked, and gso_segs computed. */
-	skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY;
-	skb_shinfo(skb)->gso_segs = 0;
+	/* gso_segs will be calculated later */
 
 	return 0;
 }
@@ -1582,6 +1579,20 @@ static int xenvif_tx_submit(struct xenvif *vif, int budget)
 
 		skb_probe_transport_header(skb, 0);
 
+		/* If the packet is GSO then we will have just set up the
+		 * transport header offset in checksum_setup so it's now
+		 * straightforward to calculate gso_segs.
+		 */
+		if (skb_is_gso(skb)) {
+			int mss = skb_shinfo(skb)->gso_size;
+			int hdrlen = skb_transport_header(skb) -
+				skb_mac_header(skb) +
+				tcp_hdrlen(skb);
+
+			skb_shinfo(skb)->gso_segs =
+				DIV_ROUND_UP(skb->len - hdrlen, mss);
+		}
+
 		vif->dev->stats.rx_bytes += skb->len;
 		vif->dev->stats.rx_packets++;
 
Signature · 1 line
1.7.10.4
Acked-by on v2 1/1
#1 lore raw
Quoted 7 lines · Paul Durrant

netback already has code which parses IPv4 and v6 headers to set up checksum offsets and these are always applied to GSO packets being sent from frontends. It's therefore suboptimal that GSOs are being marked SKB_GSO_DODGY to defer the gso_segs calculation when netback already has all necessary information to hand to do the calculation. This patch adds that calculation.

Quoted 6 lines
Cc Wei Liu <[email protected]>
Cc Ian Campbell <[email protected]>
Cc David Vrabel <[email protected]>
Cc Eric Dumazet <[email protected]>

---

Acked-by on v2 1/1
#2 lore raw
In reply to Paul Durrant
Quoted 7 lines · Paul Durrant

netback already has code which parses IPv4 and v6 headers to set up checksum offsets and these are always applied to GSO packets being sent from frontends. It's therefore suboptimal that GSOs are being marked SKB_GSO_DODGY to defer the gso_segs calculation when netback already has all necessary information to hand to do the calculation. This patch adds that calculation.

Quoted 6 lines
Cc Wei Liu <[email protected]>
Cc Ian Campbell <[email protected]>
Cc David Vrabel <[email protected]>
Cc Eric Dumazet <[email protected]>

---

#3 lore raw
Quoted 19 lines

-----Original Message-----
From: [email protected] [mailto:netdev- [email protected]] On Behalf Of Eric Dumazet
Sent: 17 December 2013 22:15
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; Ian Campbell; David Vrabel
Subject: Re: [PATCH net-next v2] xen-netback: add gso_segs calculation

Quoted 1 line · Paul Durrant

netback already has code which parses IPv4 and v6 headers to set up

checksum

Quoted 3 lines

offsets and these are always applied to GSO packets being sent from frontends. It's therefore suboptimal that GSOs are being marked SKB_GSO_DODGY to defer the gso_segs calculation when netback already

has all

Quoted 3 lines

necessary information to hand to do the calculation. This patch adds that calculation.

Quoted 9 lines
Quoted 6 lines
Cc Wei Liu <[email protected]>
Cc Ian Campbell <[email protected]>
Cc David Vrabel <[email protected]>
Cc Eric Dumazet <[email protected]>

---

Thanks :-)

Paul

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
In reply to Eric Dumazet
Quoted 19 lines

-----Original Message-----
From: [email protected] [mailto:netdev- [email protected]] On Behalf Of Eric Dumazet
Sent: 17 December 2013 22:15
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; Ian Campbell; David Vrabel
Subject: Re: [PATCH net-next v2] xen-netback: add gso_segs calculation

Quoted 1 line · Paul Durrant

netback already has code which parses IPv4 and v6 headers to set up

checksum

Quoted 3 lines

offsets and these are always applied to GSO packets being sent from frontends. It's therefore suboptimal that GSOs are being marked SKB_GSO_DODGY to defer the gso_segs calculation when netback already

has all

Quoted 3 lines

necessary information to hand to do the calculation. This patch adds that calculation.

Quoted 9 lines
Quoted 6 lines
Cc Wei Liu <[email protected]>
Cc Ian Campbell <[email protected]>
Cc David Vrabel <[email protected]>
Cc Eric Dumazet <[email protected]>

---

Thanks :-)

Paul

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Acked-by on v2 1/1
#5 lore raw
In reply to Paul Durrant
Quoted 7 lines · Paul Durrant

netback already has code which parses IPv4 and v6 headers to set up checksum offsets and these are always applied to GSO packets being sent from frontends. It's therefore suboptimal that GSOs are being marked SKB_GSO_DODGY to defer the gso_segs calculation when netback already has all necessary information to hand to do the calculation. This patch adds that calculation.

Quoted 5 lines
Cc Wei Liu <[email protected]>
Cc Ian Campbell <[email protected]>
Cc David Vrabel <[email protected]>
Cc Eric Dumazet <[email protected]>
Acked-by on v2 1/1
#6 lore raw
In reply to Paul Durrant
Quoted 7 lines · Paul Durrant

netback already has code which parses IPv4 and v6 headers to set up checksum offsets and these are always applied to GSO packets being sent from frontends. It's therefore suboptimal that GSOs are being marked SKB_GSO_DODGY to defer the gso_segs calculation when netback already has all necessary information to hand to do the calculation. This patch adds that calculation.

Quoted 5 lines
Cc Wei Liu <[email protected]>
Cc Ian Campbell <[email protected]>
Cc David Vrabel <[email protected]>
Cc Eric Dumazet <[email protected]>
maintainer Applied
#7 lore raw
In reply to Paul Durrant

From: Paul Durrant <[email protected]>
Date: Tue, 17 Dec 2013 11:44:35 +0000

Quoted 8 lines

netback already has code which parses IPv4 and v6 headers to set up checksum offsets and these are always applied to GSO packets being sent from frontends. It's therefore suboptimal that GSOs are being marked SKB_GSO_DODGY to defer the gso_segs calculation when netback already has all necessary information to hand to do the calculation. This patch adds that calculation.

Applied, thanks.

maintainer Applied
#8 lore raw
In reply to Paul Durrant

From: Paul Durrant <[email protected]>
Date: Tue, 17 Dec 2013 11:44:35 +0000

Quoted 8 lines

netback already has code which parses IPv4 and v6 headers to set up checksum offsets and these are always applied to GSO packets being sent from frontends. It's therefore suboptimal that GSOs are being marked SKB_GSO_DODGY to defer the gso_segs calculation when netback already has all necessary information to hand to do the calculation. This patch adds that calculation.

Applied, thanks.