* [PATCH net-next v2] tcp: minor optimization in tcp ack fast path processing
@ 2018-11-11 12:10 Yafang Shao
2018-11-11 14:34 ` Eric Dumazet
2018-11-11 18:26 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Yafang Shao @ 2018-11-11 12:10 UTC (permalink / raw)
To: davem, edumazet; +Cc: netdev, linux-kernel, Yafang Shao, Joe Perches
Bitwise operation is a little faster.
So I replace after() with using the flag FLAG_SND_UNA_ADVANCED as it is
already set before.
In addtion, there's another similar improvement in tcp_cwnd_reduction().
Cc: Joe Perches <joe@perches.com>
Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
net/ipv4/tcp_input.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 2868ef2..edaaebf 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -2457,8 +2457,8 @@ void tcp_cwnd_reduction(struct sock *sk, int newly_acked_sacked, int flag)
u64 dividend = (u64)tp->snd_ssthresh * tp->prr_delivered +
tp->prior_cwnd - 1;
sndcnt = div_u64(dividend, tp->prior_cwnd) - tp->prr_out;
- } else if ((flag & FLAG_RETRANS_DATA_ACKED) &&
- !(flag & FLAG_LOST_RETRANS)) {
+ } else if ((flag & (FLAG_RETRANS_DATA_ACKED | FLAG_LOST_RETRANS)) ==
+ FLAG_RETRANS_DATA_ACKED) {
sndcnt = min_t(int, delta,
max_t(int, tp->prr_delivered - tp->prr_out,
newly_acked_sacked) + 1);
@@ -3610,7 +3610,8 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
if (flag & FLAG_UPDATE_TS_RECENT)
tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq);
- if (!(flag & FLAG_SLOWPATH) && after(ack, prior_snd_una)) {
+ if ((flag & (FLAG_SLOWPATH | FLAG_SND_UNA_ADVANCED)) ==
+ FLAG_SND_UNA_ADVANCED) {
/* Window is constant, pure forward advance.
* No more checks are required.
* Note, we use the fact that SND.UNA>=SND.WL2.
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v2] tcp: minor optimization in tcp ack fast path processing
2018-11-11 12:10 [PATCH net-next v2] tcp: minor optimization in tcp ack fast path processing Yafang Shao
@ 2018-11-11 14:34 ` Eric Dumazet
2018-11-11 18:26 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2018-11-11 14:34 UTC (permalink / raw)
To: Yafang Shao, davem, edumazet; +Cc: netdev, linux-kernel, Joe Perches
On 11/11/2018 04:10 AM, Yafang Shao wrote:
> Bitwise operation is a little faster.
> So I replace after() with using the flag FLAG_SND_UNA_ADVANCED as it is
> already set before.
>
> In addtion, there's another similar improvement in tcp_cwnd_reduction().
>
> Cc: Joe Perches <joe@perches.com>
> Suggested-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v2] tcp: minor optimization in tcp ack fast path processing
2018-11-11 12:10 [PATCH net-next v2] tcp: minor optimization in tcp ack fast path processing Yafang Shao
2018-11-11 14:34 ` Eric Dumazet
@ 2018-11-11 18:26 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-11-11 18:26 UTC (permalink / raw)
To: laoar.shao; +Cc: edumazet, netdev, linux-kernel, joe
From: Yafang Shao <laoar.shao@gmail.com>
Date: Sun, 11 Nov 2018 20:10:10 +0800
> Bitwise operation is a little faster.
> So I replace after() with using the flag FLAG_SND_UNA_ADVANCED as it is
> already set before.
>
> In addtion, there's another similar improvement in tcp_cwnd_reduction().
>
> Cc: Joe Perches <joe@perches.com>
> Suggested-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-11-11 18:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-11 12:10 [PATCH net-next v2] tcp: minor optimization in tcp ack fast path processing Yafang Shao
2018-11-11 14:34 ` Eric Dumazet
2018-11-11 18:26 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox