gro: simplify flush logic
Subsystems (3)
PATCH 1/2 gro: simplify flush logic
In tcp_gro_receive, the variable mss is sometimes assigned 1 to make the check "flush = len < mss" fail, and indirectly set flush to 0.
This somewhat obfuscates the meaning of the code. Also, setting mss to 1 doesn't influence the value of flush in the case when skb_is_gso(skb) is true.
This patch changes the code to set flush to 0 directly. The out_check_final can then be moved, which avoids unnecessary conditions.
Signed-off-by Richard Gobert <[email protected]>
--- net/ipv4/tcp_offload.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/ipv4/tcp_offload.c +4 -3
@@ -187,7 +187,7 @@ struct sk_buff *tcp_gro_receive(struct list_head *head, struct sk_buff *skb)unsigned int len;unsigned int thlen;__be32 flags; -unsigned int mss =1 ; +unsigned int mss;unsigned int hlen;unsigned int off;int flush =1 ;
@@ -229,6 +229,7 @@ struct sk_buff *tcp_gro_receive(struct list_head *head, struct sk_buff *skb) goto found; } p =NULL ; + flush =0 ; goto out_check_final; found:
@@ -270,19 +271,19 @@ struct sk_buff *tcp_gro_receive(struct list_head *head, struct sk_buff *skb)#endif if (flush ||skb_gro_receive (p, skb)) { - mss =1 ; + flush =0 ; goto out_check_final; }tcp_flag_word (th2) |= flags & (TCP_FLAG_FIN |TCP_FLAG_PSH ); -out_check_final:/* Force a flush if last segment is smaller than mss. */ if (unlikely (skb_is_gso (skb))) flush = len !=NAPI_GRO_CB (skb)->count *skb_shinfo (skb)->gso_size;else flush = len < mss; +out_check_final: flush |= (__force int )(flags & (TCP_FLAG_URG |TCP_FLAG_PSH |TCP_FLAG_RST |TCP_FLAG_SYN |TCP_FLAG_FIN ));
Signature · 1 line
2.36.1