diff options
Diffstat (limited to 'net/dccp/dccp.h')
-rw-r--r-- | net/dccp/dccp.h | 82 |
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 |
22 | extern int dccp_debug; | 23 | extern 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 | |||
363 | static 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 | ||
362 | extern void dccp_insert_options(struct sock *sk, struct sk_buff *skb); | 374 | extern void dccp_insert_options(struct sock *sk, struct sk_buff *skb); |
363 | extern void dccp_insert_option_elapsed_time(struct sock *sk, | 375 | extern 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 | ||
372 | extern struct socket *dccp_ctl_socket; | 384 | extern 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 | */ | ||
408 | struct 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 | |||
424 | extern struct dccp_ackpkts * | ||
425 | dccp_ackpkts_alloc(unsigned int len, | ||
426 | const unsigned int __nocast priority); | ||
427 | extern void dccp_ackpkts_free(struct dccp_ackpkts *ap); | ||
428 | extern int dccp_ackpkts_add(struct dccp_ackpkts *ap, const struct sock *sk, | ||
429 | u64 ackno, u8 state); | ||
430 | extern void dccp_ackpkts_check_rcv_ackno(struct dccp_ackpkts *ap, | ||
431 | struct sock *sk, u64 ackno); | ||
432 | |||
433 | extern void dccp_timestamp(const struct sock *sk, struct timeval *tv); | 386 | extern void dccp_timestamp(const struct sock *sk, struct timeval *tv); |
434 | 387 | ||
435 | static inline suseconds_t timeval_usecs(const struct timeval *tv) | 388 | static 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 | ||
474 | extern void dccp_ackvector_print(const u64 ackno, | ||
475 | const unsigned char *vector, int len); | ||
476 | extern void dccp_ackpkts_print(const struct dccp_ackpkts *ap); | ||
477 | #else | ||
478 | static inline void dccp_ackvector_print(const u64 ackno, | ||
479 | const unsigned char *vector, | ||
480 | int len) { } | ||
481 | static inline void dccp_ackpkts_print(const struct dccp_ackpkts *ap) { } | ||
482 | #endif | ||
483 | |||
484 | #endif /* _DCCP_H */ | 426 | #endif /* _DCCP_H */ |