aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/dccp.h
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@mandriva.com>2005-09-18 03:17:51 -0400
committerDavid S. Miller <davem@davemloft.net>2005-09-18 03:17:51 -0400
commitae31c3399d17b1f7bc1742724f70476b5417744f (patch)
treec34099afb228936672e6e589f0af7d81f1f62443 /net/dccp/dccp.h
parent21f130a2370ba837cdfc5204ebe52e7c664fec3d (diff)
[DCCP]: Move the ack vector code to net/dccp/ackvec.[ch]
Isolating it, that will be used when we introduce a CCID2 (TCP-Like) implementation. Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/dccp.h')
-rw-r--r--net/dccp/dccp.h82
1 files changed, 12 insertions, 70 deletions
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index be7a660b6b24..5871c027f9dc 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -17,6 +17,7 @@
17#include <net/snmp.h> 17#include <net/snmp.h>
18#include <net/sock.h> 18#include <net/sock.h>
19#include <net/tcp.h> 19#include <net/tcp.h>
20#include "ackvec.h"
20 21
21#ifdef CONFIG_IP_DCCP_DEBUG 22#ifdef CONFIG_IP_DCCP_DEBUG
22extern int dccp_debug; 23extern int dccp_debug;
@@ -358,6 +359,17 @@ static inline void dccp_update_gss(struct sock *sk, u64 seq)
358 (dp->dccps_gss - 359 (dp->dccps_gss -
359 dp->dccps_options.dccpo_sequence_window + 1)); 360 dp->dccps_options.dccpo_sequence_window + 1));
360} 361}
362
363static inline int dccp_ack_pending(const struct sock *sk)
364{
365 const struct dccp_sock *dp = dccp_sk(sk);
366 return dp->dccps_timestamp_echo != 0 ||
367#ifdef CONFIG_IP_DCCP_ACKVEC
368 (dp->dccps_options.dccpo_send_ack_vector &&
369 dccp_ackvec_pending(dp->dccps_hc_rx_ackvec)) ||
370#endif
371 inet_csk_ack_scheduled(sk);
372}
361 373
362extern void dccp_insert_options(struct sock *sk, struct sk_buff *skb); 374extern void dccp_insert_options(struct sock *sk, struct sk_buff *skb);
363extern void dccp_insert_option_elapsed_time(struct sock *sk, 375extern void dccp_insert_option_elapsed_time(struct sock *sk,
@@ -371,65 +383,6 @@ extern void dccp_insert_option(struct sock *sk, struct sk_buff *skb,
371 383
372extern struct socket *dccp_ctl_socket; 384extern struct socket *dccp_ctl_socket;
373 385
374#define DCCP_ACKPKTS_STATE_RECEIVED 0
375#define DCCP_ACKPKTS_STATE_ECN_MARKED (1 << 6)
376#define DCCP_ACKPKTS_STATE_NOT_RECEIVED (3 << 6)
377
378#define DCCP_ACKPKTS_STATE_MASK 0xC0 /* 11000000 */
379#define DCCP_ACKPKTS_LEN_MASK 0x3F /* 00111111 */
380
381/** struct dccp_ackpkts - acknowledgeable packets
382 *
383 * This data structure is the one defined in the DCCP draft
384 * Appendix A.
385 *
386 * @dccpap_buf_head - circular buffer head
387 * @dccpap_buf_tail - circular buffer tail
388 * @dccpap_buf_ackno - ack # of the most recent packet acknowledgeable in the
389 * buffer (i.e. %dccpap_buf_head)
390 * @dccpap_buf_nonce - the one-bit sum of the ECN Nonces on all packets acked
391 * by the buffer with State 0
392 *
393 * Additionally, the HC-Receiver must keep some information about the
394 * Ack Vectors it has recently sent. For each packet sent carrying an
395 * Ack Vector, it remembers four variables:
396 *
397 * @dccpap_ack_seqno - the Sequence Number used for the packet
398 * (HC-Receiver seqno)
399 * @dccpap_ack_ptr - the value of buf_head at the time of acknowledgement.
400 * @dccpap_ack_ackno - the Acknowledgement Number used for the packet
401 * (HC-Sender seqno)
402 * @dccpap_ack_nonce - the one-bit sum of the ECN Nonces for all State 0.
403 *
404 * @dccpap_buf_len - circular buffer length
405 * @dccpap_time - the time in usecs
406 * @dccpap_buf - circular buffer of acknowledgeable packets
407 */
408struct dccp_ackpkts {
409 unsigned int dccpap_buf_head;
410 unsigned int dccpap_buf_tail;
411 u64 dccpap_buf_ackno;
412 u64 dccpap_ack_seqno;
413 u64 dccpap_ack_ackno;
414 unsigned int dccpap_ack_ptr;
415 unsigned int dccpap_buf_vector_len;
416 unsigned int dccpap_ack_vector_len;
417 unsigned int dccpap_buf_len;
418 struct timeval dccpap_time;
419 u8 dccpap_buf_nonce;
420 u8 dccpap_ack_nonce;
421 u8 dccpap_buf[0];
422};
423
424extern struct dccp_ackpkts *
425 dccp_ackpkts_alloc(unsigned int len,
426 const unsigned int __nocast priority);
427extern void dccp_ackpkts_free(struct dccp_ackpkts *ap);
428extern int dccp_ackpkts_add(struct dccp_ackpkts *ap, const struct sock *sk,
429 u64 ackno, u8 state);
430extern void dccp_ackpkts_check_rcv_ackno(struct dccp_ackpkts *ap,
431 struct sock *sk, u64 ackno);
432
433extern void dccp_timestamp(const struct sock *sk, struct timeval *tv); 386extern void dccp_timestamp(const struct sock *sk, struct timeval *tv);
434 387
435static inline suseconds_t timeval_usecs(const struct timeval *tv) 388static inline suseconds_t timeval_usecs(const struct timeval *tv)
@@ -470,15 +423,4 @@ static inline void timeval_sub_usecs(struct timeval *tv,
470 } 423 }
471} 424}
472 425
473#ifdef CONFIG_IP_DCCP_DEBUG
474extern void dccp_ackvector_print(const u64 ackno,
475 const unsigned char *vector, int len);
476extern void dccp_ackpkts_print(const struct dccp_ackpkts *ap);
477#else
478static inline void dccp_ackvector_print(const u64 ackno,
479 const unsigned char *vector,
480 int len) { }
481static inline void dccp_ackpkts_print(const struct dccp_ackpkts *ap) { }
482#endif
483
484#endif /* _DCCP_H */ 426#endif /* _DCCP_H */