diff options
author | David S. Miller <davem@davemloft.net> | 2008-09-08 20:28:59 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-09-08 20:28:59 -0400 |
commit | 0a68a20cc3eafa73bb54097c28b921147d7d3685 (patch) | |
tree | 8e5f315226b618cb8e050a0c7653c8ec134501e3 /include | |
parent | 17dce5dfe38ae2fb359b61e855f5d8a3a8b7892b (diff) | |
parent | a3cbdde8e9c38b66b4f13ac5d6ff1939ded0ff20 (diff) |
Merge branch 'dccp' of git://eden-feed.erg.abdn.ac.uk/dccp_exp
Conflicts:
net/dccp/input.c
net/dccp/options.c
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/dccp.h | 122 | ||||
-rw-r--r-- | include/net/tcp.h | 15 |
2 files changed, 66 insertions, 71 deletions
diff --git a/include/linux/dccp.h b/include/linux/dccp.h index 6080449fbec9..010e2d87ed75 100644 --- a/include/linux/dccp.h +++ b/include/linux/dccp.h | |||
@@ -165,9 +165,13 @@ enum { | |||
165 | DCCPO_TIMESTAMP_ECHO = 42, | 165 | DCCPO_TIMESTAMP_ECHO = 42, |
166 | DCCPO_ELAPSED_TIME = 43, | 166 | DCCPO_ELAPSED_TIME = 43, |
167 | DCCPO_MAX = 45, | 167 | DCCPO_MAX = 45, |
168 | DCCPO_MIN_CCID_SPECIFIC = 128, | 168 | DCCPO_MIN_RX_CCID_SPECIFIC = 128, /* from sender to receiver */ |
169 | DCCPO_MAX_CCID_SPECIFIC = 255, | 169 | DCCPO_MAX_RX_CCID_SPECIFIC = 191, |
170 | DCCPO_MIN_TX_CCID_SPECIFIC = 192, /* from receiver to sender */ | ||
171 | DCCPO_MAX_TX_CCID_SPECIFIC = 255, | ||
170 | }; | 172 | }; |
173 | /* maximum size of a single TLV-encoded DCCP option (sans type/len bytes) */ | ||
174 | #define DCCP_SINGLE_OPT_MAXLEN 253 | ||
171 | 175 | ||
172 | /* DCCP CCIDS */ | 176 | /* DCCP CCIDS */ |
173 | enum { | 177 | enum { |
@@ -176,27 +180,36 @@ enum { | |||
176 | }; | 180 | }; |
177 | 181 | ||
178 | /* DCCP features (RFC 4340 section 6.4) */ | 182 | /* DCCP features (RFC 4340 section 6.4) */ |
179 | enum { | 183 | enum dccp_feature_numbers { |
180 | DCCPF_RESERVED = 0, | 184 | DCCPF_RESERVED = 0, |
181 | DCCPF_CCID = 1, | 185 | DCCPF_CCID = 1, |
182 | DCCPF_SHORT_SEQNOS = 2, /* XXX: not yet implemented */ | 186 | DCCPF_SHORT_SEQNOS = 2, |
183 | DCCPF_SEQUENCE_WINDOW = 3, | 187 | DCCPF_SEQUENCE_WINDOW = 3, |
184 | DCCPF_ECN_INCAPABLE = 4, /* XXX: not yet implemented */ | 188 | DCCPF_ECN_INCAPABLE = 4, |
185 | DCCPF_ACK_RATIO = 5, | 189 | DCCPF_ACK_RATIO = 5, |
186 | DCCPF_SEND_ACK_VECTOR = 6, | 190 | DCCPF_SEND_ACK_VECTOR = 6, |
187 | DCCPF_SEND_NDP_COUNT = 7, | 191 | DCCPF_SEND_NDP_COUNT = 7, |
188 | DCCPF_MIN_CSUM_COVER = 8, | 192 | DCCPF_MIN_CSUM_COVER = 8, |
189 | DCCPF_DATA_CHECKSUM = 9, /* XXX: not yet implemented */ | 193 | DCCPF_DATA_CHECKSUM = 9, |
190 | /* 10-127 reserved */ | 194 | /* 10-127 reserved */ |
191 | DCCPF_MIN_CCID_SPECIFIC = 128, | 195 | DCCPF_MIN_CCID_SPECIFIC = 128, |
196 | DCCPF_SEND_LEV_RATE = 192, /* RFC 4342, sec. 8.4 */ | ||
192 | DCCPF_MAX_CCID_SPECIFIC = 255, | 197 | DCCPF_MAX_CCID_SPECIFIC = 255, |
193 | }; | 198 | }; |
194 | 199 | ||
195 | /* this structure is argument to DCCP_SOCKOPT_CHANGE_X */ | 200 | /* DCCP socket control message types for cmsg */ |
196 | struct dccp_so_feat { | 201 | enum dccp_cmsg_type { |
197 | __u8 dccpsf_feat; | 202 | DCCP_SCM_PRIORITY = 1, |
198 | __u8 __user *dccpsf_val; | 203 | DCCP_SCM_QPOLICY_MAX = 0xFFFF, |
199 | __u8 dccpsf_len; | 204 | /* ^-- Up to here reserved exclusively for qpolicy parameters */ |
205 | DCCP_SCM_MAX | ||
206 | }; | ||
207 | |||
208 | /* DCCP priorities for outgoing/queued packets */ | ||
209 | enum dccp_packet_dequeueing_policy { | ||
210 | DCCPQ_POLICY_SIMPLE, | ||
211 | DCCPQ_POLICY_PRIO, | ||
212 | DCCPQ_POLICY_MAX | ||
200 | }; | 213 | }; |
201 | 214 | ||
202 | /* DCCP socket options */ | 215 | /* DCCP socket options */ |
@@ -208,6 +221,12 @@ struct dccp_so_feat { | |||
208 | #define DCCP_SOCKOPT_SERVER_TIMEWAIT 6 | 221 | #define DCCP_SOCKOPT_SERVER_TIMEWAIT 6 |
209 | #define DCCP_SOCKOPT_SEND_CSCOV 10 | 222 | #define DCCP_SOCKOPT_SEND_CSCOV 10 |
210 | #define DCCP_SOCKOPT_RECV_CSCOV 11 | 223 | #define DCCP_SOCKOPT_RECV_CSCOV 11 |
224 | #define DCCP_SOCKOPT_AVAILABLE_CCIDS 12 | ||
225 | #define DCCP_SOCKOPT_CCID 13 | ||
226 | #define DCCP_SOCKOPT_TX_CCID 14 | ||
227 | #define DCCP_SOCKOPT_RX_CCID 15 | ||
228 | #define DCCP_SOCKOPT_QPOLICY_ID 16 | ||
229 | #define DCCP_SOCKOPT_QPOLICY_TXQLEN 17 | ||
211 | #define DCCP_SOCKOPT_CCID_RX_INFO 128 | 230 | #define DCCP_SOCKOPT_CCID_RX_INFO 128 |
212 | #define DCCP_SOCKOPT_CCID_TX_INFO 192 | 231 | #define DCCP_SOCKOPT_CCID_TX_INFO 192 |
213 | 232 | ||
@@ -355,62 +374,13 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb) | |||
355 | return __dccp_hdr_len(dccp_hdr(skb)); | 374 | return __dccp_hdr_len(dccp_hdr(skb)); |
356 | } | 375 | } |
357 | 376 | ||
358 | |||
359 | /* initial values for each feature */ | ||
360 | #define DCCPF_INITIAL_SEQUENCE_WINDOW 100 | ||
361 | #define DCCPF_INITIAL_ACK_RATIO 2 | ||
362 | #define DCCPF_INITIAL_CCID DCCPC_CCID2 | ||
363 | #define DCCPF_INITIAL_SEND_ACK_VECTOR 1 | ||
364 | /* FIXME: for now we're default to 1 but it should really be 0 */ | ||
365 | #define DCCPF_INITIAL_SEND_NDP_COUNT 1 | ||
366 | |||
367 | /** | ||
368 | * struct dccp_minisock - Minimal DCCP connection representation | ||
369 | * | ||
370 | * Will be used to pass the state from dccp_request_sock to dccp_sock. | ||
371 | * | ||
372 | * @dccpms_sequence_window - Sequence Window Feature (section 7.5.2) | ||
373 | * @dccpms_ccid - Congestion Control Id (CCID) (section 10) | ||
374 | * @dccpms_send_ack_vector - Send Ack Vector Feature (section 11.5) | ||
375 | * @dccpms_send_ndp_count - Send NDP Count Feature (7.7.2) | ||
376 | * @dccpms_ack_ratio - Ack Ratio Feature (section 11.3) | ||
377 | * @dccpms_pending - List of features being negotiated | ||
378 | * @dccpms_conf - | ||
379 | */ | ||
380 | struct dccp_minisock { | ||
381 | __u64 dccpms_sequence_window; | ||
382 | __u8 dccpms_rx_ccid; | ||
383 | __u8 dccpms_tx_ccid; | ||
384 | __u8 dccpms_send_ack_vector; | ||
385 | __u8 dccpms_send_ndp_count; | ||
386 | __u8 dccpms_ack_ratio; | ||
387 | struct list_head dccpms_pending; | ||
388 | struct list_head dccpms_conf; | ||
389 | }; | ||
390 | |||
391 | struct dccp_opt_conf { | ||
392 | __u8 *dccpoc_val; | ||
393 | __u8 dccpoc_len; | ||
394 | }; | ||
395 | |||
396 | struct dccp_opt_pend { | ||
397 | struct list_head dccpop_node; | ||
398 | __u8 dccpop_type; | ||
399 | __u8 dccpop_feat; | ||
400 | __u8 *dccpop_val; | ||
401 | __u8 dccpop_len; | ||
402 | int dccpop_conf; | ||
403 | struct dccp_opt_conf *dccpop_sc; | ||
404 | }; | ||
405 | |||
406 | extern void dccp_minisock_init(struct dccp_minisock *dmsk); | ||
407 | |||
408 | /** | 377 | /** |
409 | * struct dccp_request_sock - represent DCCP-specific connection request | 378 | * struct dccp_request_sock - represent DCCP-specific connection request |
410 | * @dreq_inet_rsk: structure inherited from | 379 | * @dreq_inet_rsk: structure inherited from |
411 | * @dreq_iss: initial sequence number sent on the Response (RFC 4340, 7.1) | 380 | * @dreq_iss: initial sequence number sent on the Response (RFC 4340, 7.1) |
412 | * @dreq_isr: initial sequence number received on the Request | 381 | * @dreq_isr: initial sequence number received on the Request |
413 | * @dreq_service: service code present on the Request (there is just one) | 382 | * @dreq_service: service code present on the Request (there is just one) |
383 | * @dreq_featneg: feature negotiation options for this connection | ||
414 | * The following two fields are analogous to the ones in dccp_sock: | 384 | * The following two fields are analogous to the ones in dccp_sock: |
415 | * @dreq_timestamp_echo: last received timestamp to echo (13.1) | 385 | * @dreq_timestamp_echo: last received timestamp to echo (13.1) |
416 | * @dreq_timestamp_echo: the time of receiving the last @dreq_timestamp_echo | 386 | * @dreq_timestamp_echo: the time of receiving the last @dreq_timestamp_echo |
@@ -420,6 +390,7 @@ struct dccp_request_sock { | |||
420 | __u64 dreq_iss; | 390 | __u64 dreq_iss; |
421 | __u64 dreq_isr; | 391 | __u64 dreq_isr; |
422 | __be32 dreq_service; | 392 | __be32 dreq_service; |
393 | struct list_head dreq_featneg; | ||
423 | __u32 dreq_timestamp_echo; | 394 | __u32 dreq_timestamp_echo; |
424 | __u32 dreq_timestamp_time; | 395 | __u32 dreq_timestamp_time; |
425 | }; | 396 | }; |
@@ -491,21 +462,28 @@ struct dccp_ackvec; | |||
491 | * @dccps_timestamp_time - time of receiving latest @dccps_timestamp_echo | 462 | * @dccps_timestamp_time - time of receiving latest @dccps_timestamp_echo |
492 | * @dccps_l_ack_ratio - feature-local Ack Ratio | 463 | * @dccps_l_ack_ratio - feature-local Ack Ratio |
493 | * @dccps_r_ack_ratio - feature-remote Ack Ratio | 464 | * @dccps_r_ack_ratio - feature-remote Ack Ratio |
465 | * @dccps_l_seq_win - local Sequence Window (influences ack number validity) | ||
466 | * @dccps_r_seq_win - remote Sequence Window (influences seq number validity) | ||
494 | * @dccps_pcslen - sender partial checksum coverage (via sockopt) | 467 | * @dccps_pcslen - sender partial checksum coverage (via sockopt) |
495 | * @dccps_pcrlen - receiver partial checksum coverage (via sockopt) | 468 | * @dccps_pcrlen - receiver partial checksum coverage (via sockopt) |
469 | * @dccps_send_ndp_count - local Send NDP Count feature (7.7.2) | ||
496 | * @dccps_ndp_count - number of Non Data Packets since last data packet | 470 | * @dccps_ndp_count - number of Non Data Packets since last data packet |
497 | * @dccps_mss_cache - current value of MSS (path MTU minus header sizes) | 471 | * @dccps_mss_cache - current value of MSS (path MTU minus header sizes) |
498 | * @dccps_rate_last - timestamp for rate-limiting DCCP-Sync (RFC 4340, 7.5.4) | 472 | * @dccps_rate_last - timestamp for rate-limiting DCCP-Sync (RFC 4340, 7.5.4) |
499 | * @dccps_minisock - associated minisock (accessed via dccp_msk) | 473 | * @dccps_featneg - tracks feature-negotiation state (mostly during handshake) |
500 | * @dccps_hc_rx_ackvec - rx half connection ack vector | 474 | * @dccps_hc_rx_ackvec - rx half connection ack vector |
501 | * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection) | 475 | * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection) |
502 | * @dccps_hc_tx_ccid - CCID used for the sender (or sending half-connection) | 476 | * @dccps_hc_tx_ccid - CCID used for the sender (or sending half-connection) |
503 | * @dccps_options_received - parsed set of retrieved options | 477 | * @dccps_options_received - parsed set of retrieved options |
478 | * @dccps_qpolicy - TX dequeueing policy, one of %dccp_packet_dequeueing_policy | ||
479 | * @dccps_tx_qlen - maximum length of the TX queue | ||
504 | * @dccps_role - role of this sock, one of %dccp_role | 480 | * @dccps_role - role of this sock, one of %dccp_role |
505 | * @dccps_hc_rx_insert_options - receiver wants to add options when acking | 481 | * @dccps_hc_rx_insert_options - receiver wants to add options when acking |
506 | * @dccps_hc_tx_insert_options - sender wants to add options when sending | 482 | * @dccps_hc_tx_insert_options - sender wants to add options when sending |
507 | * @dccps_server_timewait - server holds timewait state on close (RFC 4340, 8.3) | 483 | * @dccps_server_timewait - server holds timewait state on close (RFC 4340, 8.3) |
508 | * @dccps_xmit_timer - timer for when CCID is not ready to send | 484 | * @dccps_sync_scheduled - flag which signals "send out-of-band message soon" |
485 | * @dccps_xmitlet - tasklet scheduled by the TX CCID to dequeue data packets | ||
486 | * @dccps_xmit_timer - used by the TX CCID to delay sending (rate-based pacing) | ||
509 | * @dccps_syn_rtt - RTT sample from Request/Response exchange (in usecs) | 487 | * @dccps_syn_rtt - RTT sample from Request/Response exchange (in usecs) |
510 | */ | 488 | */ |
511 | struct dccp_sock { | 489 | struct dccp_sock { |
@@ -529,19 +507,26 @@ struct dccp_sock { | |||
529 | __u32 dccps_timestamp_time; | 507 | __u32 dccps_timestamp_time; |
530 | __u16 dccps_l_ack_ratio; | 508 | __u16 dccps_l_ack_ratio; |
531 | __u16 dccps_r_ack_ratio; | 509 | __u16 dccps_r_ack_ratio; |
532 | __u16 dccps_pcslen; | 510 | __u64 dccps_l_seq_win:48; |
533 | __u16 dccps_pcrlen; | 511 | __u64 dccps_r_seq_win:48; |
512 | __u8 dccps_pcslen:4; | ||
513 | __u8 dccps_pcrlen:4; | ||
514 | __u8 dccps_send_ndp_count:1; | ||
534 | __u64 dccps_ndp_count:48; | 515 | __u64 dccps_ndp_count:48; |
535 | unsigned long dccps_rate_last; | 516 | unsigned long dccps_rate_last; |
536 | struct dccp_minisock dccps_minisock; | 517 | struct list_head dccps_featneg; |
537 | struct dccp_ackvec *dccps_hc_rx_ackvec; | 518 | struct dccp_ackvec *dccps_hc_rx_ackvec; |
538 | struct ccid *dccps_hc_rx_ccid; | 519 | struct ccid *dccps_hc_rx_ccid; |
539 | struct ccid *dccps_hc_tx_ccid; | 520 | struct ccid *dccps_hc_tx_ccid; |
540 | struct dccp_options_received dccps_options_received; | 521 | struct dccp_options_received dccps_options_received; |
522 | __u8 dccps_qpolicy; | ||
523 | __u32 dccps_tx_qlen; | ||
541 | enum dccp_role dccps_role:2; | 524 | enum dccp_role dccps_role:2; |
542 | __u8 dccps_hc_rx_insert_options:1; | 525 | __u8 dccps_hc_rx_insert_options:1; |
543 | __u8 dccps_hc_tx_insert_options:1; | 526 | __u8 dccps_hc_tx_insert_options:1; |
544 | __u8 dccps_server_timewait:1; | 527 | __u8 dccps_server_timewait:1; |
528 | __u8 dccps_sync_scheduled:1; | ||
529 | struct tasklet_struct dccps_xmitlet; | ||
545 | struct timer_list dccps_xmit_timer; | 530 | struct timer_list dccps_xmit_timer; |
546 | }; | 531 | }; |
547 | 532 | ||
@@ -550,11 +535,6 @@ static inline struct dccp_sock *dccp_sk(const struct sock *sk) | |||
550 | return (struct dccp_sock *)sk; | 535 | return (struct dccp_sock *)sk; |
551 | } | 536 | } |
552 | 537 | ||
553 | static inline struct dccp_minisock *dccp_msk(const struct sock *sk) | ||
554 | { | ||
555 | return (struct dccp_minisock *)&dccp_sk(sk)->dccps_minisock; | ||
556 | } | ||
557 | |||
558 | static inline const char *dccp_role(const struct sock *sk) | 538 | static inline const char *dccp_role(const struct sock *sk) |
559 | { | 539 | { |
560 | switch (dccp_sk(sk)->dccps_role) { | 540 | switch (dccp_sk(sk)->dccps_role) { |
diff --git a/include/net/tcp.h b/include/net/tcp.h index 8983386356a5..6bc4b8148ca0 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -782,6 +782,21 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk) | |||
782 | /* Use define here intentionally to get WARN_ON location shown at the caller */ | 782 | /* Use define here intentionally to get WARN_ON location shown at the caller */ |
783 | #define tcp_verify_left_out(tp) WARN_ON(tcp_left_out(tp) > tp->packets_out) | 783 | #define tcp_verify_left_out(tp) WARN_ON(tcp_left_out(tp) > tp->packets_out) |
784 | 784 | ||
785 | /* | ||
786 | * Convert RFC3390 larger initial windows into an equivalent number of packets. | ||
787 | * | ||
788 | * John Heffner states: | ||
789 | * | ||
790 | * The RFC specifies a window of no more than 4380 bytes | ||
791 | * unless 2*MSS > 4380. Reading the pseudocode in the RFC | ||
792 | * is a bit misleading because they use a clamp at 4380 bytes | ||
793 | * rather than a multiplier in the relevant range. | ||
794 | */ | ||
795 | static inline u32 rfc3390_bytes_to_packets(const u32 bytes) | ||
796 | { | ||
797 | return bytes <= 1095 ? 4 : (bytes > 1460 ? 2 : 3); | ||
798 | } | ||
799 | |||
785 | extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); | 800 | extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); |
786 | extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); | 801 | extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); |
787 | 802 | ||