diff mbox series

[net-next,2/2] gro: change confusing use of flush variable

Message ID 20221124115507.GA73719@debian (mailing list archive)
State Deferred
Delegated to: Netdev Maintainers
Headers show
Series gro: simplify tcp_gro_receive | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 6 this patch: 6
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 5 this patch: 5
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 6 this patch: 6
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 54 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Richard Gobert Nov. 24, 2022, 11:55 a.m. UTC
The variable "flush" in tcp_gro_received is confusingly used for two different
purposes. The first use is to keep track whether we are going to flush the SKB
at the end of the function (the same use as in other GRO receive functions). The
second use is just after the "found" label, where it is used to keep track
whether we are going to skip the call to skb_gro_receive that merges the SKBs.
This is entirely not related to the previous use, but uses the same variable.

To make the code more readable, this patch moves the second use to a separate
variable called "dont_merge".

Signed-off-by: Richard Gobert <richardbgobert@gmail.com>
---
 net/ipv4/tcp_offload.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c
index f17271e5c7c5..7ca6be2f56df 100644
--- a/net/ipv4/tcp_offload.c
+++ b/net/ipv4/tcp_offload.c
@@ -191,6 +191,7 @@  struct sk_buff *tcp_gro_receive(struct list_head *head, struct sk_buff *skb)
 	unsigned int hlen;
 	unsigned int off;
 	int flush = 1;
+	int dont_merge;
 	int i;
 
 	off = skb_gro_offset(skb);
@@ -234,13 +235,13 @@  struct sk_buff *tcp_gro_receive(struct list_head *head, struct sk_buff *skb)
 
 found:
 	/* Include the IP ID check below from the inner most IP hdr */
-	flush = NAPI_GRO_CB(p)->flush;
-	flush |= (__force int)(flags & TCP_FLAG_CWR);
-	flush |= (__force int)((flags ^ tcp_flag_word(th2)) &
+	dont_merge = NAPI_GRO_CB(p)->flush;
+	dont_merge |= (__force int)(flags & TCP_FLAG_CWR);
+	dont_merge |= (__force int)((flags ^ tcp_flag_word(th2)) &
 		  ~(TCP_FLAG_CWR | TCP_FLAG_FIN | TCP_FLAG_PSH));
-	flush |= (__force int)(th->ack_seq ^ th2->ack_seq);
+	dont_merge |= (__force int)(th->ack_seq ^ th2->ack_seq);
 	for (i = sizeof(*th); i < thlen; i += 4)
-		flush |= *(u32 *)((u8 *)th + i) ^
+		dont_merge |= *(u32 *)((u8 *)th + i) ^
 			 *(u32 *)((u8 *)th2 + i);
 
 	/* When we receive our second frame we can made a decision on if we
@@ -250,7 +251,7 @@  struct sk_buff *tcp_gro_receive(struct list_head *head, struct sk_buff *skb)
 	if (NAPI_GRO_CB(p)->flush_id != 1 ||
 	    NAPI_GRO_CB(p)->count != 1 ||
 	    !NAPI_GRO_CB(p)->is_atomic)
-		flush |= NAPI_GRO_CB(p)->flush_id;
+		dont_merge |= NAPI_GRO_CB(p)->flush_id;
 	else
 		NAPI_GRO_CB(p)->is_atomic = false;
 
@@ -261,16 +262,16 @@  struct sk_buff *tcp_gro_receive(struct list_head *head, struct sk_buff *skb)
 	 * is bigger than our mss.
 	 */
 	if (unlikely(skb_is_gso(skb)))
-		flush |= (mss != skb_shinfo(skb)->gso_size);
+		dont_merge |= (mss != skb_shinfo(skb)->gso_size);
 	else
-		flush |= (len - 1) >= mss;
+		dont_merge |= (len - 1) >= mss;
 
-	flush |= (ntohl(th2->seq) + skb_gro_len(p)) ^ ntohl(th->seq);
+	dont_merge |= (ntohl(th2->seq) + skb_gro_len(p)) ^ ntohl(th->seq);
 #ifdef CONFIG_TLS_DEVICE
-	flush |= p->decrypted ^ skb->decrypted;
+	dont_merge |= p->decrypted ^ skb->decrypted;
 #endif
 
-	if (flush || skb_gro_receive(p, skb)) {
+	if (dont_merge || skb_gro_receive(p, skb)) {
 		flush = 0;
 		goto out_check_final;
 	}