* [PATCH net-next 1/2] tcp: remove an unnecessary check in tcp_tx_timestamp
@ 2016-04-25 20:51 Soheil Hassas Yeganeh
2016-04-25 20:51 ` [PATCH net-next 2/2] tcp: remove a redundant check for SKBTX_ACK_TSTAMP Soheil Hassas Yeganeh
0 siblings, 1 reply; 4+ messages in thread
From: Soheil Hassas Yeganeh @ 2016-04-25 20:51 UTC (permalink / raw)
To: davem, netdev
Cc: kafai, willemb, edumazet, ycheng, ncardwell,
Soheil Hassas Yeganeh
From: Soheil Hassas Yeganeh <soheil@google.com>
tcp_tx_timestamp() receives tsflags as a parameter. tsflags
is initialized to sk->sk_tsflags and is overridden by control
messages. As a result the "sk->sk_tsflags || tsflags" is the
same expression as "tsflags"
Remove the redundant check for sk->sk_tsflags in tcp_tx_timestamp.
Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
---
net/ipv4/tcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 4d73858..3c542dc 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -430,7 +430,7 @@ EXPORT_SYMBOL(tcp_init_sock);
static void tcp_tx_timestamp(struct sock *sk, u16 tsflags, struct sk_buff *skb)
{
- if (sk->sk_tsflags || tsflags) {
+ if (tsflags) {
struct skb_shared_info *shinfo = skb_shinfo(skb);
struct tcp_skb_cb *tcb = TCP_SKB_CB(skb);
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net-next 2/2] tcp: remove a redundant check for SKBTX_ACK_TSTAMP
2016-04-25 20:51 [PATCH net-next 1/2] tcp: remove an unnecessary check in tcp_tx_timestamp Soheil Hassas Yeganeh
@ 2016-04-25 20:51 ` Soheil Hassas Yeganeh
2016-04-27 18:19 ` Martin KaFai Lau
0 siblings, 1 reply; 4+ messages in thread
From: Soheil Hassas Yeganeh @ 2016-04-25 20:51 UTC (permalink / raw)
To: davem, netdev
Cc: kafai, willemb, edumazet, ycheng, ncardwell,
Soheil Hassas Yeganeh
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next 2/2] tcp: remove a redundant check for SKBTX_ACK_TSTAMP
2016-04-25 20:51 ` [PATCH net-next 2/2] tcp: remove a redundant check for SKBTX_ACK_TSTAMP Soheil Hassas Yeganeh
@ 2016-04-27 18:19 ` Martin KaFai Lau
2016-04-27 19:25 ` Soheil Hassas Yeganeh
0 siblings, 1 reply; 4+ messages in thread
From: Martin KaFai Lau @ 2016-04-27 18:19 UTC (permalink / raw)
To: Soheil Hassas Yeganeh
Cc: davem, netdev, willemb, edumazet, ycheng, ncardwell,
Soheil Hassas Yeganeh
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next 2/2] tcp: remove a redundant check for SKBTX_ACK_TSTAMP
2016-04-27 18:19 ` Martin KaFai Lau
@ 2016-04-27 19:25 ` Soheil Hassas Yeganeh
0 siblings, 0 replies; 4+ messages in thread
From: Soheil Hassas Yeganeh @ 2016-04-27 19:25 UTC (permalink / raw)
To: Martin KaFai Lau
Cc: Soheil Hassas Yeganeh, David Miller, netdev, Willem de Bruijn,
Eric Dumazet, Yuchung Cheng, Neal Cardwell
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!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-04-27 19:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-25 20:51 [PATCH net-next 1/2] tcp: remove an unnecessary check in tcp_tx_timestamp Soheil Hassas Yeganeh
2016-04-25 20:51 ` [PATCH net-next 2/2] tcp: remove a redundant check for SKBTX_ACK_TSTAMP Soheil Hassas Yeganeh
2016-04-27 18:19 ` Martin KaFai Lau
2016-04-27 19:25 ` Soheil Hassas Yeganeh
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).