Skip to content

Commit 1ed8346

Browse files
xemuldavem330
authored andcommitted
tcp: replace tcp_sock argument with sock in some places
These places have a tcp_sock, but we'd prefer the sock itself to get net from it. Fortunately, tcp_sk macro is just a type cast, so this replace is really cheap. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ca12a1a commit 1ed8346

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

net/ipv4/tcp_input.c

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,10 +1169,11 @@ static void tcp_mark_lost_retrans(struct sock *sk)
11691169
tp->lost_retrans_low = new_low_seq;
11701170
}
11711171

1172-
static int tcp_check_dsack(struct tcp_sock *tp, struct sk_buff *ack_skb,
1172+
static int tcp_check_dsack(struct sock *sk, struct sk_buff *ack_skb,
11731173
struct tcp_sack_block_wire *sp, int num_sacks,
11741174
u32 prior_snd_una)
11751175
{
1176+
struct tcp_sock *tp = tcp_sk(sk);
11761177
u32 start_seq_0 = get_unaligned_be32(&sp[0].start_seq);
11771178
u32 end_seq_0 = get_unaligned_be32(&sp[0].end_seq);
11781179
int dup_sack = 0;
@@ -1434,7 +1435,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb,
14341435
tcp_highest_sack_reset(sk);
14351436
}
14361437

1437-
found_dup_sack = tcp_check_dsack(tp, ack_skb, sp_wire,
1438+
found_dup_sack = tcp_check_dsack(sk, ack_skb, sp_wire,
14381439
num_sacks, prior_snd_una);
14391440
if (found_dup_sack)
14401441
flag |= FLAG_DSACKING_ACK;
@@ -3711,8 +3712,10 @@ static inline int tcp_sack_extend(struct tcp_sack_block *sp, u32 seq,
37113712
return 0;
37123713
}
37133714

3714-
static void tcp_dsack_set(struct tcp_sock *tp, u32 seq, u32 end_seq)
3715+
static void tcp_dsack_set(struct sock *sk, u32 seq, u32 end_seq)
37153716
{
3717+
struct tcp_sock *tp = tcp_sk(sk);
3718+
37163719
if (tcp_is_sack(tp) && sysctl_tcp_dsack) {
37173720
int mib_idx;
37183721

@@ -3731,10 +3734,12 @@ static void tcp_dsack_set(struct tcp_sock *tp, u32 seq, u32 end_seq)
37313734
}
37323735
}
37333736

3734-
static void tcp_dsack_extend(struct tcp_sock *tp, u32 seq, u32 end_seq)
3737+
static void tcp_dsack_extend(struct sock *sk, u32 seq, u32 end_seq)
37353738
{
3739+
struct tcp_sock *tp = tcp_sk(sk);
3740+
37363741
if (!tp->rx_opt.dsack)
3737-
tcp_dsack_set(tp, seq, end_seq);
3742+
tcp_dsack_set(sk, seq, end_seq);
37383743
else
37393744
tcp_sack_extend(tp->duplicate_sack, seq, end_seq);
37403745
}
@@ -3753,7 +3758,7 @@ static void tcp_send_dupack(struct sock *sk, struct sk_buff *skb)
37533758

37543759
if (after(TCP_SKB_CB(skb)->end_seq, tp->rcv_nxt))
37553760
end_seq = tp->rcv_nxt;
3756-
tcp_dsack_set(tp, TCP_SKB_CB(skb)->seq, end_seq);
3761+
tcp_dsack_set(sk, TCP_SKB_CB(skb)->seq, end_seq);
37573762
}
37583763
}
37593764

@@ -3906,7 +3911,7 @@ static void tcp_ofo_queue(struct sock *sk)
39063911
__u32 dsack = dsack_high;
39073912
if (before(TCP_SKB_CB(skb)->end_seq, dsack_high))
39083913
dsack_high = TCP_SKB_CB(skb)->end_seq;
3909-
tcp_dsack_extend(tp, TCP_SKB_CB(skb)->seq, dsack);
3914+
tcp_dsack_extend(sk, TCP_SKB_CB(skb)->seq, dsack);
39103915
}
39113916

39123917
if (!after(TCP_SKB_CB(skb)->end_seq, tp->rcv_nxt)) {
@@ -4035,7 +4040,7 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
40354040
if (!after(TCP_SKB_CB(skb)->end_seq, tp->rcv_nxt)) {
40364041
/* A retransmit, 2nd most common case. Force an immediate ack. */
40374042
NET_INC_STATS_BH(LINUX_MIB_DELAYEDACKLOST);
4038-
tcp_dsack_set(tp, TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq);
4043+
tcp_dsack_set(sk, TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq);
40394044

40404045
out_of_window:
40414046
tcp_enter_quickack_mode(sk);
@@ -4057,7 +4062,7 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
40574062
tp->rcv_nxt, TCP_SKB_CB(skb)->seq,
40584063
TCP_SKB_CB(skb)->end_seq);
40594064

4060-
tcp_dsack_set(tp, TCP_SKB_CB(skb)->seq, tp->rcv_nxt);
4065+
tcp_dsack_set(sk, TCP_SKB_CB(skb)->seq, tp->rcv_nxt);
40614066

40624067
/* If window is closed, drop tail of packet. But after
40634068
* remembering D-SACK for its head made in previous line.
@@ -4122,12 +4127,12 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
41224127
if (!after(end_seq, TCP_SKB_CB(skb1)->end_seq)) {
41234128
/* All the bits are present. Drop. */
41244129
__kfree_skb(skb);
4125-
tcp_dsack_set(tp, seq, end_seq);
4130+
tcp_dsack_set(sk, seq, end_seq);
41264131
goto add_sack;
41274132
}
41284133
if (after(seq, TCP_SKB_CB(skb1)->seq)) {
41294134
/* Partial overlap. */
4130-
tcp_dsack_set(tp, seq,
4135+
tcp_dsack_set(sk, seq,
41314136
TCP_SKB_CB(skb1)->end_seq);
41324137
} else {
41334138
skb1 = skb1->prev;
@@ -4140,12 +4145,12 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
41404145
(struct sk_buff *)&tp->out_of_order_queue &&
41414146
after(end_seq, TCP_SKB_CB(skb1)->seq)) {
41424147
if (before(end_seq, TCP_SKB_CB(skb1)->end_seq)) {
4143-
tcp_dsack_extend(tp, TCP_SKB_CB(skb1)->seq,
4148+
tcp_dsack_extend(sk, TCP_SKB_CB(skb1)->seq,
41444149
end_seq);
41454150
break;
41464151
}
41474152
__skb_unlink(skb1, &tp->out_of_order_queue);
4148-
tcp_dsack_extend(tp, TCP_SKB_CB(skb1)->seq,
4153+
tcp_dsack_extend(sk, TCP_SKB_CB(skb1)->seq,
41494154
TCP_SKB_CB(skb1)->end_seq);
41504155
__kfree_skb(skb1);
41514156
}

0 commit comments

Comments
 (0)