Skip to contentSkip to conversation

core: should call pskb_expand_head if skb header is cloned in skb_gso_segment in rx path

PATCH Superseded [email protected] 3 participants 3 messages Mar 27, 2013 – Apr 1, 2013 1 message not in the archive

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

PATCH 1/1 core: should call pskb_expand_head if skb header is cloned in skb_gso_segment in rx path

From: Li RongQing <[email protected]>

12b0004d1d1 (adjust skb_gso_segment() for calling in rx path) tries to kill warnings by checking if ip_summed is CHECK_NONE or not in rx path, since if skb_gso_segment() is called on rx path, and ->ip_summed has different meaning.

but this maybe break skb if skb header is cloned, and not expand the header, since when step into skb_mac_gso_segment(), which will still check ip_summed with CHECKSUM_PARTIAL, then do gso_send_check(). and after __skb_gso_segment() in queue_gso_packets() of openvswitch, queue_userspace_packet() still checks ip_summed with CHECKSUM_PARTIAL, and do checksum.

so I think it is enough to ignore the warning in rx path.

---
 net/core/dev.c |   16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)
net/core/dev.c +3 -13
index de930b7..bf0e586 100644
@@ -2269,17 +2269,6 @@ struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,
 }
 EXPORT_SYMBOL(skb_mac_gso_segment);
 
-
-/* openvswitch calls this on rx path, so we need a different check.
- */
-static inline bool skb_needs_check(struct sk_buff *skb, bool tx_path)
-{
-	if (tx_path)
-		return skb->ip_summed != CHECKSUM_PARTIAL;
-	else
-		return skb->ip_summed == CHECKSUM_NONE;
-}
-
 /**
  *	__skb_gso_segment - Perform segmentation on skb.
  *	@skb: buffer to segment
@@ -2294,10 +2283,11 @@ static inline bool skb_needs_check(struct sk_buff *skb, bool tx_path)
 struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
 				  netdev_features_t features, bool tx_path)
 {
-	if (unlikely(skb_needs_check(skb, tx_path))) {
+	if (unlikely(skb->ip_summed != CHECKSUM_PARTIAL)) {
 		int err;
 
-		skb_warn_bad_offload(skb);
+		if (tx_path)
+			skb_warn_bad_offload(skb);
 
 		if (skb_header_cloned(skb) &&
 		    (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))
Signature · 1 line
1.7.10.4
maintainer
#1 lore raw

From: [email protected]
Date: Wed, 27 Mar 2013 17:34:05 +0800

Quoted 12 lines

From: Li RongQing <[email protected]>

12b0004d1d1 (adjust skb_gso_segment() for calling in rx path) tries to kill warnings by checking if ip_summed is CHECK_NONE or not in rx path, since if skb_gso_segment() is called on rx path, and ->ip_summed has different meaning.

but this maybe break skb if skb header is cloned, and not expand the header, since when step into skb_mac_gso_segment(), which will still check ip_summed with CHECKSUM_PARTIAL, then do gso_send_check(). and after __skb_gso_segment() in queue_gso_packets() of openvswitch, queue_userspace_packet() still checks ip_summed with CHECKSUM_PARTIAL, and do checksum.

Quoted 3 lines

so I think it is enough to ignore the warning in rx path.

I'm not going back-and-forth on this issue yet another time.

I want to see discussion amongst people involved in this area before applying a patch like this, and I'm therefore not applying this patch for now (you'll have to submit it again after the discussions take place).