All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] tcp: tcp_data_queue() cleanup
@ 2017-08-01 14:02 Eric Dumazet
  2017-08-02 17:45 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2017-08-01 14:02 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Florian Westphal

From: Eric Dumazet <edumazet@google.com>

Commit c13ee2a4f03f ("tcp: reindent two spots after prequeue removal")
removed code in tcp_data_queue().

We can go a little farther, removing an always true test,
and removing initializers for fragstolen and eaten variables.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Florian Westphal <fw@strlen.de>
---
 net/ipv4/tcp_input.c |   15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index af0a98d54b627a90d90fb9f1f2a600277c620559..df670d7ed98df1c108dc654cf446344ff9fdd4be 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4564,8 +4564,8 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size)
 static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
 {
 	struct tcp_sock *tp = tcp_sk(sk);
-	bool fragstolen = false;
-	int eaten = -1;
+	bool fragstolen;
+	int eaten;
 
 	if (TCP_SKB_CB(skb)->seq == TCP_SKB_CB(skb)->end_seq) {
 		__kfree_skb(skb);
@@ -4588,12 +4588,11 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
 
 		/* Ok. In sequence. In window. */
 queue_and_out:
-		if (eaten < 0) {
-			if (skb_queue_len(&sk->sk_receive_queue) == 0)
-				sk_forced_mem_schedule(sk, skb->truesize);
-			else if (tcp_try_rmem_schedule(sk, skb, skb->truesize))
-				goto drop;
-		}
+		if (skb_queue_len(&sk->sk_receive_queue) == 0)
+			sk_forced_mem_schedule(sk, skb->truesize);
+		else if (tcp_try_rmem_schedule(sk, skb, skb->truesize))
+			goto drop;
+
 		eaten = tcp_queue_rcv(sk, skb, 0, &fragstolen);
 		tcp_rcv_nxt_update(tp, TCP_SKB_CB(skb)->end_seq);
 		if (skb->len)

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] tcp: tcp_data_queue() cleanup
  2017-08-01 14:02 [PATCH net-next] tcp: tcp_data_queue() cleanup Eric Dumazet
@ 2017-08-02 17:45 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-08-02 17:45 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, fw

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 01 Aug 2017 07:02:44 -0700

> From: Eric Dumazet <edumazet@google.com>
> 
> Commit c13ee2a4f03f ("tcp: reindent two spots after prequeue removal")
> removed code in tcp_data_queue().
> 
> We can go a little farther, removing an always true test,
> and removing initializers for fragstolen and eaten variables.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Series applied, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-02 17:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-01 14:02 [PATCH net-next] tcp: tcp_data_queue() cleanup Eric Dumazet
2017-08-02 17:45 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.