diff mbox

[net-next,2/2] tcp: remove a redundant check for SKBTX_ACK_TSTAMP

Message ID 1461617473-11349-2-git-send-email-soheil.kdev@gmail.com
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

Soheil Hassas Yeganeh April 25, 2016, 8:51 p.m. UTC
From: Soheil Hassas Yeganeh <soheil@google.com>

txstamp_ack in tcp_skb_cb is set iff the SKBTX_ACK_TSTAMP
flag is set for an skb. Thus, it is not required to check
shinfo->tx_flags if the txstamp_ack bit is checked.

Remove the check on shinfo->tx_flags & SKBTX_ACK_TSTAMP, since
it has already been checked using the txstamp_ack bit.

Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
---
 net/ipv4/tcp_input.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Martin KaFai Lau April 27, 2016, 6:19 p.m. UTC | #1
On Mon, Apr 25, 2016 at 04:51:13PM -0400, Soheil Hassas Yeganeh wrote:
> From: Soheil Hassas Yeganeh <soheil@google.com>
>
> txstamp_ack in tcp_skb_cb is set iff the SKBTX_ACK_TSTAMP
> flag is set for an skb. Thus, it is not required to check
> shinfo->tx_flags if the txstamp_ack bit is checked.
>
> Remove the check on shinfo->tx_flags & SKBTX_ACK_TSTAMP, since
> it has already been checked using the txstamp_ack bit.
>
> Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
> ---
>  net/ipv4/tcp_input.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index 967520d..2f3fd92 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -3087,8 +3087,7 @@ static void tcp_ack_tstamp(struct sock *sk, struct sk_buff *skb,
>  		return;
>
>  	shinfo = skb_shinfo(skb);
> -	if ((shinfo->tx_flags & SKBTX_ACK_TSTAMP) &&
> -	    !before(shinfo->tskey, prior_snd_una) &&
> +	if (!before(shinfo->tskey, prior_snd_una) &&
>  	    before(shinfo->tskey, tcp_sk(sk)->snd_una))
>  		__skb_tstamp_tx(skb, NULL, sk, SCM_TSTAMP_ACK);
>  }
> --
> 2.8.0.rc3.226.g39d4020
>
Acked-by: Martin KaFai Lau <kafai@fb.com>

Can it be one step further and completely remove SKBTX_ACK_TSTAMP?
like what Willem has also suggested here:
http://www.spinics.net/lists/netdev/msg374231.html

It seems no one else is using the SKBTX_ACK_TSTAMP except TCP.
Soheil Hassas Yeganeh April 27, 2016, 7:25 p.m. UTC | #2
On Wed, Apr 27, 2016 at 2:19 PM, Martin KaFai Lau <kafai@fb.com> wrote:
> On Mon, Apr 25, 2016 at 04:51:13PM -0400, Soheil Hassas Yeganeh wrote:
>> From: Soheil Hassas Yeganeh <soheil@google.com>
>>
>> txstamp_ack in tcp_skb_cb is set iff the SKBTX_ACK_TSTAMP
>> flag is set for an skb. Thus, it is not required to check
>> shinfo->tx_flags if the txstamp_ack bit is checked.
>>
>> Remove the check on shinfo->tx_flags & SKBTX_ACK_TSTAMP, since
>> it has already been checked using the txstamp_ack bit.
>>
>> Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
>> ---
>>  net/ipv4/tcp_input.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
>> index 967520d..2f3fd92 100644
>> --- a/net/ipv4/tcp_input.c
>> +++ b/net/ipv4/tcp_input.c
>> @@ -3087,8 +3087,7 @@ static void tcp_ack_tstamp(struct sock *sk, struct sk_buff *skb,
>>               return;
>>
>>       shinfo = skb_shinfo(skb);
>> -     if ((shinfo->tx_flags & SKBTX_ACK_TSTAMP) &&
>> -         !before(shinfo->tskey, prior_snd_una) &&
>> +     if (!before(shinfo->tskey, prior_snd_una) &&
>>           before(shinfo->tskey, tcp_sk(sk)->snd_una))
>>               __skb_tstamp_tx(skb, NULL, sk, SCM_TSTAMP_ACK);
>>  }
>> --
>> 2.8.0.rc3.226.g39d4020
>>
> Acked-by: Martin KaFai Lau <kafai@fb.com>
>
> Can it be one step further and completely remove SKBTX_ACK_TSTAMP?
> like what Willem has also suggested here:
> http://www.spinics.net/lists/netdev/msg374231.html
>
> It seems no one else is using the SKBTX_ACK_TSTAMP except TCP.

Ah, good point. Will update the patch then. Thanks!
diff mbox

Patch

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 967520d..2f3fd92 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3087,8 +3087,7 @@  static void tcp_ack_tstamp(struct sock *sk, struct sk_buff *skb,
 		return;
 
 	shinfo = skb_shinfo(skb);
-	if ((shinfo->tx_flags & SKBTX_ACK_TSTAMP) &&
-	    !before(shinfo->tskey, prior_snd_una) &&
+	if (!before(shinfo->tskey, prior_snd_una) &&
 	    before(shinfo->tskey, tcp_sk(sk)->snd_una))
 		__skb_tstamp_tx(skb, NULL, sk, SCM_TSTAMP_ACK);
 }