[DCCP]: Simplify skb_set_owner_w semantics
[pandora-kernel.git] / net / dccp / dccp.h
index 33456c0..f97b85d 100644 (file)
@@ -17,6 +17,7 @@
 #include <net/snmp.h>
 #include <net/sock.h>
 #include <net/tcp.h>
+#include "ackvec.h"
 
 #ifdef CONFIG_IP_DCCP_DEBUG
 extern int dccp_debug;
@@ -117,7 +118,6 @@ DECLARE_SNMP_STAT(struct dccp_mib, dccp_statistics);
 #define DCCP_ADD_STATS_USER(field, val)        \
                        SNMP_ADD_STATS_USER(dccp_statistics, field, val)
 
-extern int  dccp_transmit_skb(struct sock *sk, struct sk_buff *skb);
 extern int  dccp_retransmit_skb(struct sock *sk, struct sk_buff *skb);
 
 extern int dccp_send_response(struct sock *sk);
@@ -258,13 +258,12 @@ extern int           dccp_v4_send_reset(struct sock *sk,
 extern void       dccp_send_close(struct sock *sk, const int active);
 
 struct dccp_skb_cb {
-       __u8 dccpd_type;
-       __u8 dccpd_reset_code;
-       __u8 dccpd_service;
-       __u8 dccpd_ccval;
+       __u8  dccpd_type:4;
+       __u8  dccpd_ccval:4;
+       __u8  dccpd_reset_code;
+       __u16 dccpd_opt_len;
        __u64 dccpd_seq;
        __u64 dccpd_ack_seq;
-       int  dccpd_opt_len;
 };
 
 #define DCCP_SKB_CB(__skb) ((struct dccp_skb_cb *)&((__skb)->cb[0]))
@@ -359,6 +358,17 @@ static inline void dccp_update_gss(struct sock *sk, u64 seq)
                       (dp->dccps_gss -
                        dp->dccps_options.dccpo_sequence_window + 1));
 }
+                               
+static inline int dccp_ack_pending(const struct sock *sk)
+{
+       const struct dccp_sock *dp = dccp_sk(sk);
+       return dp->dccps_timestamp_echo != 0 ||
+#ifdef CONFIG_IP_DCCP_ACKVEC
+              (dp->dccps_options.dccpo_send_ack_vector &&
+               dccp_ackvec_pending(dp->dccps_hc_rx_ackvec)) ||
+#endif
+              inet_csk_ack_scheduled(sk);
+}
 
 extern void dccp_insert_options(struct sock *sk, struct sk_buff *skb);
 extern void dccp_insert_option_elapsed_time(struct sock *sk,
@@ -372,63 +382,7 @@ extern void dccp_insert_option(struct sock *sk, struct sk_buff *skb,
 
 extern struct socket *dccp_ctl_socket;
 
-#define DCCP_ACKPKTS_STATE_RECEIVED    0
-#define DCCP_ACKPKTS_STATE_ECN_MARKED  (1 << 6)
-#define DCCP_ACKPKTS_STATE_NOT_RECEIVED        (3 << 6)
-
-#define DCCP_ACKPKTS_STATE_MASK                0xC0 /* 11000000 */
-#define DCCP_ACKPKTS_LEN_MASK          0x3F /* 00111111 */
-
-/** struct dccp_ackpkts - acknowledgeable packets
- *
- * This data structure is the one defined in the DCCP draft
- * Appendix A.
- *
- * @dccpap_buf_head - circular buffer head
- * @dccpap_buf_tail - circular buffer tail
- * @dccpap_buf_ackno - ack # of the most recent packet acknowledgeable in the
- *                    buffer (i.e. %dccpap_buf_head)
- * @dccpap_buf_nonce - the one-bit sum of the ECN Nonces on all packets acked
- *                    by the buffer with State 0
- *
- * Additionally, the HC-Receiver must keep some information about the
- * Ack Vectors it has recently sent. For each packet sent carrying an
- * Ack Vector, it remembers four variables:
- *
- * @dccpap_ack_seqno - the Sequence Number used for the packet
- *                    (HC-Receiver seqno)
- * @dccpap_ack_ptr - the value of buf_head at the time of acknowledgement.
- * @dccpap_ack_ackno - the Acknowledgement Number used for the packet
- *                    (HC-Sender seqno)
- * @dccpap_ack_nonce - the one-bit sum of the ECN Nonces for all State 0.
- *
- * @dccpap_buf_len - circular buffer length
- * @dccpap_time                - the time in usecs
- * @dccpap_buf - circular buffer of acknowledgeable packets
- */
-struct dccp_ackpkts {
-       unsigned int            dccpap_buf_head;
-       unsigned int            dccpap_buf_tail;
-       u64                     dccpap_buf_ackno;
-       u64                     dccpap_ack_seqno;
-       u64                     dccpap_ack_ackno;
-       unsigned int            dccpap_ack_ptr;
-       unsigned int            dccpap_buf_vector_len;
-       unsigned int            dccpap_ack_vector_len;
-       unsigned int            dccpap_buf_len;
-       struct timeval          dccpap_time;
-       u8                      dccpap_buf_nonce;
-       u8                      dccpap_ack_nonce;
-       u8                      dccpap_buf[0];
-};
-
-extern struct dccp_ackpkts *
-               dccp_ackpkts_alloc(unsigned int len,
-                                 const unsigned int __nocast priority);
-extern void dccp_ackpkts_free(struct dccp_ackpkts *ap);
-extern int dccp_ackpkts_add(struct dccp_ackpkts *ap, u64 ackno, u8 state);
-extern void dccp_ackpkts_check_rcv_ackno(struct dccp_ackpkts *ap,
-                                        struct sock *sk, u64 ackno);
+extern void dccp_timestamp(const struct sock *sk, struct timeval *tv);
 
 static inline suseconds_t timeval_usecs(const struct timeval *tv)
 {
@@ -468,26 +422,4 @@ static inline void timeval_sub_usecs(struct timeval *tv,
        }
 }
 
-/*
- * Returns the difference in usecs between timeval
- * passed in and current time
- */
-static inline suseconds_t timeval_now_delta(const struct timeval *tv)
-{
-       struct timeval now;
-       do_gettimeofday(&now);
-       return timeval_delta(&now, tv);
-}
-
-#ifdef CONFIG_IP_DCCP_DEBUG
-extern void dccp_ackvector_print(const u64 ackno,
-                                const unsigned char *vector, int len);
-extern void dccp_ackpkts_print(const struct dccp_ackpkts *ap);
-#else
-static inline void dccp_ackvector_print(const u64 ackno,
-                                       const unsigned char *vector,
-                                       int len) { }
-static inline void dccp_ackpkts_print(const struct dccp_ackpkts *ap) { }
-#endif
-
 #endif /* _DCCP_H */