]> err.no Git - linux-2.6/blobdiff - net/dccp/dccp.h
[NET] NETFILTER: Fix whitespace errors.
[linux-2.6] / net / dccp / dccp.h
index afb313ff216e107e5e1fca38f3dd67382a65b86c..e2d74cd7eeeb3557423d3284225146bd6aae1deb 100644 (file)
                                              __stringify(cond));          \
                             } while (0)
 
-#ifdef MODULE
 #define DCCP_PRINTK(enable, fmt, args...)      do { if (enable)             \
                                                        printk(fmt, ##args); \
                                                } while(0)
-#else
-#define DCCP_PRINTK(enable, fmt, args...)      printk(fmt, ##args)
-#endif
 #define DCCP_PR_DEBUG(enable, fmt, a...)       DCCP_PRINTK(enable, KERN_DEBUG \
                                                  "%s: " fmt, __FUNCTION__, ##a)
 
@@ -75,11 +71,15 @@ extern void dccp_time_wait(struct sock *sk, int state, int timeo);
 /* RFC 1122, 4.2.3.1 initial RTO value */
 #define DCCP_TIMEOUT_INIT ((unsigned)(3 * HZ))
 
+#define DCCP_RTO_MAX ((unsigned)(120 * HZ)) /* FIXME: using TCP value */
+
+/* bounds for sampled RTT values from packet exchanges (in usec) */
+#define DCCP_SANE_RTT_MIN      100
+#define DCCP_SANE_RTT_MAX      (4 * USEC_PER_SEC)
+
 /* Maximal interval between probes for local resources.  */
 #define DCCP_RESOURCE_PROBE_INTERVAL ((unsigned)(HZ / 2U))
 
-#define DCCP_RTO_MAX ((unsigned)(120 * HZ)) /* FIXME: using TCP value */
-
 /* sysctl variables for DCCP */
 extern int  sysctl_dccp_request_retries;
 extern int  sysctl_dccp_retries1;
@@ -124,14 +124,11 @@ static inline s64 dccp_delta_seqno(const u64 seqno1, const u64 seqno2)
 /* is seq1 < seq2 ? */
 static inline int before48(const u64 seq1, const u64 seq2)
 {
-       return (s64)((seq1 << 16) - (seq2 << 16)) < 0;
+       return (s64)((seq2 << 16) - (seq1 << 16)) > 0;
 }
 
 /* is seq1 > seq2 ? */
-static inline int after48(const u64 seq1, const u64 seq2)
-{
-       return (s64)((seq2 << 16) - (seq1 << 16)) < 0;
-}
+#define after48(seq1, seq2)    before48(seq2, seq1)
 
 /* is seq2 <= seq1 <= seq3 ? */
 static inline int between48(const u64 seq1, const u64 seq2, const u64 seq3)
@@ -147,9 +144,7 @@ static inline u64 max48(const u64 seq1, const u64 seq2)
 /* is seq1 next seqno after seq2 */
 static inline int follows48(const u64 seq1, const u64 seq2)
 {
-       int diff = (seq1 & 0xFFFF) - (seq2 & 0xFFFF);
-
-       return diff==1;
+       return dccp_delta_seqno(seq2, seq1) == 1;
 }
 
 enum {
@@ -189,7 +184,7 @@ DECLARE_SNMP_STAT(struct dccp_mib, dccp_statistics);
 /*
  *     Checksumming routines
  */
-static inline int dccp_csum_coverage(const struct sk_buff *skb)
+static inline unsigned int dccp_csum_coverage(const struct sk_buff *skb)
 {
        const struct dccp_hdr* dh = dccp_hdr(skb);
 
@@ -200,7 +195,7 @@ static inline int dccp_csum_coverage(const struct sk_buff *skb)
 
 static inline void dccp_csum_outgoing(struct sk_buff *skb)
 {
-       int cov = dccp_csum_coverage(skb);
+       unsigned int cov = dccp_csum_coverage(skb);
 
        if (cov >= skb->len)
                dccp_hdr(skb)->dccph_cscov = 0;
@@ -301,6 +296,8 @@ extern int     dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr,
 extern int        dccp_send_reset(struct sock *sk, enum dccp_reset_codes code);
 extern void       dccp_send_close(struct sock *sk, const int active);
 extern int        dccp_invalid_packet(struct sk_buff *skb);
+extern u32        dccp_sample_rtt(struct sock *sk, struct timeval *t_recv,
+                                                   struct timeval *t_history);
 
 static inline int dccp_bad_service_code(const struct sock *sk,
                                        const __be32 service)