netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 1/1] tcp: Remove useless acceptable check because the return vlaue always is 0
@ 2022-07-26 22:58 gfree.wind
  2022-07-29  2:50 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: gfree.wind @ 2022-07-26 22:58 UTC (permalink / raw)
  To: edumazet, davem, yoshfuji, dsahern, kuba, pabeni, netdev
  Cc: gfree.wind, Gao Feng

From: Gao Feng <gfree.wind@gmail.com>

The conn_request function of IPv4 and IPv6 always returns 0, so it's
useless to check for acceptable.

Signed-off-by: Gao Feng <gfree.wind@gmail.com>
---
 net/ipv4/tcp_input.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 3ec4edc37313..82a875efd1e8 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -6453,12 +6453,11 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
 			 */
 			rcu_read_lock();
 			local_bh_disable();
-			acceptable = icsk->icsk_af_ops->conn_request(sk, skb) >= 0;
+			/* TCP's conn_request always returns 0. */
+			icsk->icsk_af_ops->conn_request(sk, skb);
 			local_bh_enable();
 			rcu_read_unlock();
 
-			if (!acceptable)
-				return 1;
 			consume_skb(skb);
 			return 0;
 		}
-- 
2.25.1


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

* Re: [PATCH net-next 1/1] tcp: Remove useless acceptable check because the return vlaue always is 0
  2022-07-26 22:58 [PATCH net-next 1/1] tcp: Remove useless acceptable check because the return vlaue always is 0 gfree.wind
@ 2022-07-29  2:50 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2022-07-29  2:50 UTC (permalink / raw)
  To: gfree.wind; +Cc: edumazet, davem, yoshfuji, dsahern, pabeni, netdev, Gao Feng

On Wed, 27 Jul 2022 06:58:03 +0800 gfree.wind@outlook.com wrote:
> From: Gao Feng <gfree.wind@gmail.com>
> 
> The conn_request function of IPv4 and IPv6 always returns 0, so it's
> useless to check for acceptable.

I don't think this is an improvement. If the function returns 
a value we should not be ignoring it.

> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index 3ec4edc37313..82a875efd1e8 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -6453,12 +6453,11 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
>  			 */
>  			rcu_read_lock();
>  			local_bh_disable();
> -			acceptable = icsk->icsk_af_ops->conn_request(sk, skb) >= 0;
> +			/* TCP's conn_request always returns 0. */
> +			icsk->icsk_af_ops->conn_request(sk, skb);
>  			local_bh_enable();
>  			rcu_read_unlock();
>  
> -			if (!acceptable)
> -				return 1;
>  			consume_skb(skb);
>  			return 0;
>  		}


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

end of thread, other threads:[~2022-07-29  2:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-26 22:58 [PATCH net-next 1/1] tcp: Remove useless acceptable check because the return vlaue always is 0 gfree.wind
2022-07-29  2:50 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).