aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/tcp.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r--include/net/tcp.h52
1 files changed, 22 insertions, 30 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 8983386356a5..438014d57610 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -472,6 +472,8 @@ extern void tcp_send_delayed_ack(struct sock *sk);
472 472
473/* tcp_input.c */ 473/* tcp_input.c */
474extern void tcp_cwnd_application_limited(struct sock *sk); 474extern void tcp_cwnd_application_limited(struct sock *sk);
475extern void tcp_skb_mark_lost_uncond_verify(struct tcp_sock *tp,
476 struct sk_buff *skb);
475 477
476/* tcp_timer.c */ 478/* tcp_timer.c */
477extern void tcp_init_xmit_timers(struct sock *); 479extern void tcp_init_xmit_timers(struct sock *);
@@ -894,7 +896,7 @@ static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb)
894 BUG_ON(sock_owned_by_user(sk)); 896 BUG_ON(sock_owned_by_user(sk));
895 897
896 while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) { 898 while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) {
897 sk->sk_backlog_rcv(sk, skb1); 899 sk_backlog_rcv(sk, skb1);
898 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPPREQUEUEDROPPED); 900 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPPREQUEUEDROPPED);
899 } 901 }
900 902
@@ -974,6 +976,7 @@ static inline void tcp_openreq_init(struct request_sock *req,
974 ireq->acked = 0; 976 ireq->acked = 0;
975 ireq->ecn_ok = 0; 977 ireq->ecn_ok = 0;
976 ireq->rmt_port = tcp_hdr(skb)->source; 978 ireq->rmt_port = tcp_hdr(skb)->source;
979 ireq->loc_port = tcp_hdr(skb)->dest;
977} 980}
978 981
979extern void tcp_enter_memory_pressure(struct sock *sk); 982extern void tcp_enter_memory_pressure(struct sock *sk);
@@ -1039,13 +1042,12 @@ static inline void tcp_clear_retrans_hints_partial(struct tcp_sock *tp)
1039{ 1042{
1040 tp->lost_skb_hint = NULL; 1043 tp->lost_skb_hint = NULL;
1041 tp->scoreboard_skb_hint = NULL; 1044 tp->scoreboard_skb_hint = NULL;
1042 tp->retransmit_skb_hint = NULL;
1043 tp->forward_skb_hint = NULL;
1044} 1045}
1045 1046
1046static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp) 1047static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp)
1047{ 1048{
1048 tcp_clear_retrans_hints_partial(tp); 1049 tcp_clear_retrans_hints_partial(tp);
1050 tp->retransmit_skb_hint = NULL;
1049} 1051}
1050 1052
1051/* MD5 Signature */ 1053/* MD5 Signature */
@@ -1180,49 +1182,45 @@ static inline void tcp_write_queue_purge(struct sock *sk)
1180 1182
1181static inline struct sk_buff *tcp_write_queue_head(struct sock *sk) 1183static inline struct sk_buff *tcp_write_queue_head(struct sock *sk)
1182{ 1184{
1183 struct sk_buff *skb = sk->sk_write_queue.next; 1185 return skb_peek(&sk->sk_write_queue);
1184 if (skb == (struct sk_buff *) &sk->sk_write_queue)
1185 return NULL;
1186 return skb;
1187} 1186}
1188 1187
1189static inline struct sk_buff *tcp_write_queue_tail(struct sock *sk) 1188static inline struct sk_buff *tcp_write_queue_tail(struct sock *sk)
1190{ 1189{
1191 struct sk_buff *skb = sk->sk_write_queue.prev; 1190 return skb_peek_tail(&sk->sk_write_queue);
1192 if (skb == (struct sk_buff *) &sk->sk_write_queue)
1193 return NULL;
1194 return skb;
1195} 1191}
1196 1192
1197static inline struct sk_buff *tcp_write_queue_next(struct sock *sk, struct sk_buff *skb) 1193static inline struct sk_buff *tcp_write_queue_next(struct sock *sk, struct sk_buff *skb)
1198{ 1194{
1199 return skb->next; 1195 return skb_queue_next(&sk->sk_write_queue, skb);
1200} 1196}
1201 1197
1202#define tcp_for_write_queue(skb, sk) \ 1198#define tcp_for_write_queue(skb, sk) \
1203 for (skb = (sk)->sk_write_queue.next; \ 1199 skb_queue_walk(&(sk)->sk_write_queue, skb)
1204 (skb != (struct sk_buff *)&(sk)->sk_write_queue); \
1205 skb = skb->next)
1206 1200
1207#define tcp_for_write_queue_from(skb, sk) \ 1201#define tcp_for_write_queue_from(skb, sk) \
1208 for (; (skb != (struct sk_buff *)&(sk)->sk_write_queue);\ 1202 skb_queue_walk_from(&(sk)->sk_write_queue, skb)
1209 skb = skb->next)
1210 1203
1211#define tcp_for_write_queue_from_safe(skb, tmp, sk) \ 1204#define tcp_for_write_queue_from_safe(skb, tmp, sk) \
1212 for (tmp = skb->next; \ 1205 skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp)
1213 (skb != (struct sk_buff *)&(sk)->sk_write_queue); \
1214 skb = tmp, tmp = skb->next)
1215 1206
1216static inline struct sk_buff *tcp_send_head(struct sock *sk) 1207static inline struct sk_buff *tcp_send_head(struct sock *sk)
1217{ 1208{
1218 return sk->sk_send_head; 1209 return sk->sk_send_head;
1219} 1210}
1220 1211
1212static inline bool tcp_skb_is_last(const struct sock *sk,
1213 const struct sk_buff *skb)
1214{
1215 return skb_queue_is_last(&sk->sk_write_queue, skb);
1216}
1217
1221static inline void tcp_advance_send_head(struct sock *sk, struct sk_buff *skb) 1218static inline void tcp_advance_send_head(struct sock *sk, struct sk_buff *skb)
1222{ 1219{
1223 sk->sk_send_head = skb->next; 1220 if (tcp_skb_is_last(sk, skb))
1224 if (sk->sk_send_head == (struct sk_buff *)&sk->sk_write_queue)
1225 sk->sk_send_head = NULL; 1221 sk->sk_send_head = NULL;
1222 else
1223 sk->sk_send_head = tcp_write_queue_next(sk, skb);
1226} 1224}
1227 1225
1228static inline void tcp_check_send_head(struct sock *sk, struct sk_buff *skb_unlinked) 1226static inline void tcp_check_send_head(struct sock *sk, struct sk_buff *skb_unlinked)
@@ -1267,12 +1265,12 @@ static inline void tcp_insert_write_queue_after(struct sk_buff *skb,
1267 __skb_queue_after(&sk->sk_write_queue, skb, buff); 1265 __skb_queue_after(&sk->sk_write_queue, skb, buff);
1268} 1266}
1269 1267
1270/* Insert skb between prev and next on the write queue of sk. */ 1268/* Insert new before skb on the write queue of sk. */
1271static inline void tcp_insert_write_queue_before(struct sk_buff *new, 1269static inline void tcp_insert_write_queue_before(struct sk_buff *new,
1272 struct sk_buff *skb, 1270 struct sk_buff *skb,
1273 struct sock *sk) 1271 struct sock *sk)
1274{ 1272{
1275 __skb_insert(new, skb->prev, skb, &sk->sk_write_queue); 1273 __skb_queue_before(&sk->sk_write_queue, skb, new);
1276 1274
1277 if (sk->sk_send_head == skb) 1275 if (sk->sk_send_head == skb)
1278 sk->sk_send_head = new; 1276 sk->sk_send_head = new;
@@ -1283,12 +1281,6 @@ static inline void tcp_unlink_write_queue(struct sk_buff *skb, struct sock *sk)
1283 __skb_unlink(skb, &sk->sk_write_queue); 1281 __skb_unlink(skb, &sk->sk_write_queue);
1284} 1282}
1285 1283
1286static inline int tcp_skb_is_last(const struct sock *sk,
1287 const struct sk_buff *skb)
1288{
1289 return skb->next == (struct sk_buff *)&sk->sk_write_queue;
1290}
1291
1292static inline int tcp_write_queue_empty(struct sock *sk) 1284static inline int tcp_write_queue_empty(struct sock *sk)
1293{ 1285{
1294 return skb_queue_empty(&sk->sk_write_queue); 1286 return skb_queue_empty(&sk->sk_write_queue);