diff mbox series

[ovs-dev,v2,19/24] datapath: use skb_list_walk_safe helper for gso segments

Message ID 20200909192021.9545-20-gvrose8192@gmail.com
State Superseded
Headers show
Series Add support for Linux kernels up to 5.8.x | expand

Commit Message

Gregory Rose Sept. 9, 2020, 7:20 p.m. UTC
From: "Jason A. Donenfeld" <Jason@zx2c4.com>

Upstream commit:
    commit 2cec4448db38758832c2edad439f99584bb8fa0d
    Author: Jason A. Donenfeld <Jason@zx2c4.com>
    Date:   Mon Jan 13 18:42:29 2020 -0500

    net: openvswitch: use skb_list_walk_safe helper for gso segments

    This is a straight-forward conversion case for the new function, keeping
    the flow of the existing code as intact as possible.

    Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Cc: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
---
 datapath/datapath.c                          | 11 ++++-------
 datapath/linux/compat/include/linux/skbuff.h |  7 +++++++
 2 files changed, 11 insertions(+), 7 deletions(-)

Comments

0-day Robot Sept. 9, 2020, 9:13 p.m. UTC | #1
Bleep bloop.  Greetings Greg Rose, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
ERROR: Author Jason A. Donenfeld <Jason@zx2c4.com> needs to sign off.
WARNING: Unexpected sign-offs from developers who are not authors or co-authors or committers: Greg Rose <gvrose8192@gmail.com>
Lines checked: 79, Warnings: 1, Errors: 1


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
diff mbox series

Patch

diff --git a/datapath/datapath.c b/datapath/datapath.c
index deffb3a60..4b71e2c46 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -343,8 +343,7 @@  static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb,
 	}
 #endif
 	/* Queue all of the segments. */
-	skb = segs;
-	do {
+	skb_list_walk_safe(segs, skb, nskb) {
 		*OVS_CB(skb) = ovs_cb;
 #ifdef HAVE_SKB_GSO_UDP
 		if (gso_type & SKB_GSO_UDP && skb != segs)
@@ -354,17 +353,15 @@  static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb,
 		if (err)
 			break;
 
-	} while ((skb = skb->next));
+	}
 
 	/* Free all of the segments. */
-	skb = segs;
-	do {
-		nskb = skb->next;
+	skb_list_walk_safe(segs, skb, nskb) {
 		if (err)
 			kfree_skb(skb);
 		else
 			consume_skb(skb);
-	} while ((skb = nskb));
+	}
 	return err;
 }
 
diff --git a/datapath/linux/compat/include/linux/skbuff.h b/datapath/linux/compat/include/linux/skbuff.h
index 6d248b3ed..204ce5497 100644
--- a/datapath/linux/compat/include/linux/skbuff.h
+++ b/datapath/linux/compat/include/linux/skbuff.h
@@ -487,4 +487,11 @@  static inline __u32 skb_get_hash_raw(const struct sk_buff *skb)
 }
 #endif
 
+#ifndef skb_list_walk_safe
+/* Iterate through singly-linked GSO fragments of an skb. */
+#define skb_list_walk_safe(first, skb, next_skb)                               \
+	for ((skb) = (first), (next_skb) = (skb) ? (skb)->next : NULL; (skb);  \
+	     (skb) = (next_skb), (next_skb) = (skb) ? (skb)->next : NULL)
+#endif
+
 #endif