aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_input.c
diff options
context:
space:
mode:
authorYafang Shao <laoar.shao@gmail.com>2018-11-11 07:10:10 -0500
committerDavid S. Miller <davem@davemloft.net>2018-11-11 13:24:18 -0500
commit5e13a0d3f5c11df7eb297e6583cf874a79a00374 (patch)
tree6836047a30acd0c55c00e11d2814b427fadca5a5 /net/ipv4/tcp_input.c
parent0cf3a68a53829815db58461da1807728437c5de2 (diff)
tcp: minor optimization in tcp ack fast path processing
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r--net/ipv4/tcp_input.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 2868ef28ce52..edaaebfbcd46 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)
2457 u64 dividend = (u64)tp->snd_ssthresh * tp->prr_delivered + 2457 u64 dividend = (u64)tp->snd_ssthresh * tp->prr_delivered +
2458 tp->prior_cwnd - 1; 2458 tp->prior_cwnd - 1;
2459 sndcnt = div_u64(dividend, tp->prior_cwnd) - tp->prr_out; 2459 sndcnt = div_u64(dividend, tp->prior_cwnd) - tp->prr_out;
2460 } else if ((flag & FLAG_RETRANS_DATA_ACKED) && 2460 } else if ((flag & (FLAG_RETRANS_DATA_ACKED | FLAG_LOST_RETRANS)) ==
2461 !(flag & FLAG_LOST_RETRANS)) { 2461 FLAG_RETRANS_DATA_ACKED) {
2462 sndcnt = min_t(int, delta, 2462 sndcnt = min_t(int, delta,
2463 max_t(int, tp->prr_delivered - tp->prr_out, 2463 max_t(int, tp->prr_delivered - tp->prr_out,
2464 newly_acked_sacked) + 1); 2464 newly_acked_sacked) + 1);
@@ -3610,7 +3610,8 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
3610 if (flag & FLAG_UPDATE_TS_RECENT) 3610 if (flag & FLAG_UPDATE_TS_RECENT)
3611 tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq); 3611 tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq);
3612 3612
3613 if (!(flag & FLAG_SLOWPATH) && after(ack, prior_snd_una)) { 3613 if ((flag & (FLAG_SLOWPATH | FLAG_SND_UNA_ADVANCED)) ==
3614 FLAG_SND_UNA_ADVANCED) {
3614 /* Window is constant, pure forward advance. 3615 /* Window is constant, pure forward advance.
3615 * No more checks are required. 3616 * No more checks are required.
3616 * Note, we use the fact that SND.UNA>=SND.WL2. 3617 * Note, we use the fact that SND.UNA>=SND.WL2.