]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/net/tcp.h
[IrDA]: Netlink layer.
[linux-2.6-omap-h63xx.git] / include / net / tcp.h
index 07f724e02f8482fea675816f0ef91f33a17a56a8..a8af9ae0017719bb7071ef5b34faa2c3f751a7b3 100644 (file)
@@ -254,6 +254,12 @@ static inline int between(__u32 seq1, __u32 seq2, __u32 seq3)
        return seq3 - seq2 >= seq1 - seq2;
 }
 
+static inline int tcp_too_many_orphans(struct sock *sk, int num)
+{
+       return (num > sysctl_tcp_max_orphans) ||
+               (sk->sk_wmem_queued > SOCK_MIN_SNDBUF &&
+                atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]);
+}
 
 extern struct proto tcp_prot;
 
@@ -420,9 +426,9 @@ extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb,
 
 /* tcp_output.c */
 
-extern void __tcp_push_pending_frames(struct sock *sk, struct tcp_sock *tp,
-                                     unsigned int cur_mss, int nonagle);
-extern int tcp_may_send_now(struct sock *sk, struct tcp_sock *tp);
+extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss,
+                                     int nonagle);
+extern int tcp_may_send_now(struct sock *sk);
 extern int tcp_retransmit_skb(struct sock *, struct sk_buff *);
 extern void tcp_xmit_retransmit_queue(struct sock *);
 extern void tcp_simple_retransmit(struct sock *);
@@ -479,8 +485,10 @@ static inline void tcp_fast_path_on(struct tcp_sock *tp)
        __tcp_fast_path_on(tp, tp->snd_wnd >> tp->rx_opt.snd_wscale);
 }
 
-static inline void tcp_fast_path_check(struct sock *sk, struct tcp_sock *tp)
+static inline void tcp_fast_path_check(struct sock *sk)
 {
+       struct tcp_sock *tp = tcp_sk(sk);
+
        if (skb_queue_empty(&tp->out_of_order_queue) &&
            tp->rcv_wnd &&
            atomic_read(&sk->sk_rmem_alloc) < sk->sk_rcvbuf &&
@@ -591,10 +599,10 @@ static inline void tcp_dec_pcount_approx(__u32 *count,
        }
 }
 
-static inline void tcp_packets_out_inc(struct sock *sk, 
-                                      struct tcp_sock *tp,
+static inline void tcp_packets_out_inc(struct sock *sk,
                                       const struct sk_buff *skb)
 {
+       struct tcp_sock *tp = tcp_sk(sk);
        int orig = tp->packets_out;
 
        tp->packets_out += tcp_skb_pcount(skb);
@@ -627,9 +635,12 @@ enum tcp_ca_event {
 #define TCP_CA_MAX     128
 #define TCP_CA_BUF_MAX (TCP_CA_NAME_MAX*TCP_CA_MAX)
 
+#define TCP_CONG_NON_RESTRICTED 0x1
+#define TCP_CONG_RTT_STAMP     0x2
+
 struct tcp_congestion_ops {
        struct list_head        list;
-       int     non_restricted;
+       unsigned long flags;
 
        /* initialize private data (optional) */
        void (*init)(struct sock *sk);
@@ -643,8 +654,6 @@ struct tcp_congestion_ops {
        /* do new cwnd calculation (required) */
        void (*cong_avoid)(struct sock *sk, u32 ack,
                           u32 rtt, u32 in_flight, int good_ack);
-       /* round trip time sample per acked packet (optional) */
-       void (*rtt_sample)(struct sock *sk, u32 usrtt);
        /* call before changing ca_state (optional) */
        void (*set_state)(struct sock *sk, u8 new_state);
        /* call when cwnd event occurs (optional) */
@@ -652,7 +661,7 @@ struct tcp_congestion_ops {
        /* new value of cwnd after loss (optional) */
        u32  (*undo_cwnd)(struct sock *sk);
        /* hook for packet ack accounting (optional) */
-       void (*pkts_acked)(struct sock *sk, u32 num_acked);
+       void (*pkts_acked)(struct sock *sk, u32 num_acked, ktime_t last);
        /* get info for inet_diag (optional) */
        void (*get_info)(struct sock *sk, u32 ext, struct sk_buff *skb);
 
@@ -733,9 +742,8 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk)
 
 static inline void tcp_sync_left_out(struct tcp_sock *tp)
 {
-       if (tp->rx_opt.sack_ok &&
-           (tp->sacked_out >= tp->packets_out - tp->lost_out))
-               tp->sacked_out = tp->packets_out - tp->lost_out;
+       BUG_ON(tp->rx_opt.sack_ok &&
+              (tp->sacked_out + tp->lost_out > tp->packets_out));
        tp->left_out = tp->sacked_out + tp->lost_out;
 }
 
@@ -778,18 +786,21 @@ static inline void tcp_minshall_update(struct tcp_sock *tp, int mss,
                tp->snd_sml = TCP_SKB_CB(skb)->end_seq;
 }
 
-static inline void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp)
+static inline void tcp_check_probe_timer(struct sock *sk)
 {
+       struct tcp_sock *tp = tcp_sk(sk);
        const struct inet_connection_sock *icsk = inet_csk(sk);
+
        if (!tp->packets_out && !icsk->icsk_pending)
                inet_csk_reset_xmit_timer(sk, ICSK_TIME_PROBE0,
                                          icsk->icsk_rto, TCP_RTO_MAX);
 }
 
-static inline void tcp_push_pending_frames(struct sock *sk,
-                                          struct tcp_sock *tp)
+static inline void tcp_push_pending_frames(struct sock *sk)
 {
-       __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk, 1), tp->nonagle);
+       struct tcp_sock *tp = tcp_sk(sk);
+
+       __tcp_push_pending_frames(sk, tcp_current_mss(sk, 1), tp->nonagle);
 }
 
 static inline void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq)
@@ -921,21 +932,7 @@ static inline void tcp_set_state(struct sock *sk, int state)
 #endif 
 }
 
-static inline void tcp_done(struct sock *sk)
-{
-       if(sk->sk_state == TCP_SYN_SENT || sk->sk_state == TCP_SYN_RECV)
-               TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS);
-
-       tcp_set_state(sk, TCP_CLOSE);
-       tcp_clear_xmit_timers(sk);
-
-       sk->sk_shutdown = SHUTDOWN_MASK;
-
-       if (!sock_flag(sk, SOCK_DEAD))
-               sk->sk_state_change(sk);
-       else
-               inet_csk_destroy_sock(sk);
-}
+extern void tcp_done(struct sock *sk);
 
 static inline void tcp_sack_reset(struct tcp_options_received *rx_opt)
 {
@@ -1209,9 +1206,14 @@ static inline struct sk_buff *tcp_send_head(struct sock *sk)
 
 static inline void tcp_advance_send_head(struct sock *sk, struct sk_buff *skb)
 {
+       struct tcp_sock *tp = tcp_sk(sk);
+
        sk->sk_send_head = skb->next;
        if (sk->sk_send_head == (struct sk_buff *)&sk->sk_write_queue)
                sk->sk_send_head = NULL;
+       /* Don't override Nagle indefinately with F-RTO */
+       if (tp->frto_counter == 2)
+               tp->frto_counter = 3;
 }
 
 static inline void tcp_check_send_head(struct sock *sk, struct sk_buff *skb_unlinked)