Commit 8109b02b authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by David S. Miller

[DCCP]: Whitespace cleanups

That accumulated over the last months hackaton, shame on me for not
using git-apply whitespace helping hand, will do that from now on.
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@mandriva.com>
parent 1fba78b6
...@@ -176,20 +176,20 @@ enum { ...@@ -176,20 +176,20 @@ enum {
}; };
/* DCCP features (RFC 4340 section 6.4) */ /* DCCP features (RFC 4340 section 6.4) */
enum { enum {
DCCPF_RESERVED = 0, DCCPF_RESERVED = 0,
DCCPF_CCID = 1, DCCPF_CCID = 1,
DCCPF_SHORT_SEQNOS = 2, /* XXX: not yet implemented */ DCCPF_SHORT_SEQNOS = 2, /* XXX: not yet implemented */
DCCPF_SEQUENCE_WINDOW = 3, DCCPF_SEQUENCE_WINDOW = 3,
DCCPF_ECN_INCAPABLE = 4, /* XXX: not yet implemented */ DCCPF_ECN_INCAPABLE = 4, /* XXX: not yet implemented */
DCCPF_ACK_RATIO = 5, DCCPF_ACK_RATIO = 5,
DCCPF_SEND_ACK_VECTOR = 6, DCCPF_SEND_ACK_VECTOR = 6,
DCCPF_SEND_NDP_COUNT = 7, DCCPF_SEND_NDP_COUNT = 7,
DCCPF_MIN_CSUM_COVER = 8, DCCPF_MIN_CSUM_COVER = 8,
DCCPF_DATA_CHECKSUM = 9, /* XXX: not yet implemented */ DCCPF_DATA_CHECKSUM = 9, /* XXX: not yet implemented */
/* 10-127 reserved */ /* 10-127 reserved */
DCCPF_MIN_CCID_SPECIFIC = 128, DCCPF_MIN_CCID_SPECIFIC = 128,
DCCPF_MAX_CCID_SPECIFIC = 255, DCCPF_MAX_CCID_SPECIFIC = 255,
}; };
/* this structure is argument to DCCP_SOCKOPT_CHANGE_X */ /* this structure is argument to DCCP_SOCKOPT_CHANGE_X */
...@@ -427,7 +427,7 @@ struct dccp_service_list { ...@@ -427,7 +427,7 @@ struct dccp_service_list {
}; };
#define DCCP_SERVICE_INVALID_VALUE htonl((__u32)-1) #define DCCP_SERVICE_INVALID_VALUE htonl((__u32)-1)
#define DCCP_SERVICE_CODE_IS_ABSENT 0 #define DCCP_SERVICE_CODE_IS_ABSENT 0
static inline int dccp_list_has_service(const struct dccp_service_list *sl, static inline int dccp_list_has_service(const struct dccp_service_list *sl,
const __be32 service) const __be32 service)
...@@ -436,7 +436,7 @@ static inline int dccp_list_has_service(const struct dccp_service_list *sl, ...@@ -436,7 +436,7 @@ static inline int dccp_list_has_service(const struct dccp_service_list *sl,
u32 i = sl->dccpsl_nr; u32 i = sl->dccpsl_nr;
while (i--) while (i--)
if (sl->dccpsl_list[i] == service) if (sl->dccpsl_list[i] == service)
return 1; return 1;
} }
return 0; return 0;
} }
...@@ -511,7 +511,7 @@ struct dccp_sock { ...@@ -511,7 +511,7 @@ struct dccp_sock {
__u8 dccps_hc_tx_insert_options:1; __u8 dccps_hc_tx_insert_options:1;
struct timer_list dccps_xmit_timer; struct timer_list dccps_xmit_timer;
}; };
static inline struct dccp_sock *dccp_sk(const struct sock *sk) static inline struct dccp_sock *dccp_sk(const struct sock *sk)
{ {
return (struct dccp_sock *)sk; return (struct dccp_sock *)sk;
......
...@@ -223,7 +223,7 @@ static inline int dccp_ackvec_set_buf_head_state(struct dccp_ackvec *av, ...@@ -223,7 +223,7 @@ static inline int dccp_ackvec_set_buf_head_state(struct dccp_ackvec *av,
gap = -new_head; gap = -new_head;
} }
new_head += DCCP_MAX_ACKVEC_LEN; new_head += DCCP_MAX_ACKVEC_LEN;
} }
av->dccpav_buf_head = new_head; av->dccpav_buf_head = new_head;
...@@ -336,7 +336,7 @@ out_duplicate: ...@@ -336,7 +336,7 @@ out_duplicate:
void dccp_ackvector_print(const u64 ackno, const unsigned char *vector, int len) void dccp_ackvector_print(const u64 ackno, const unsigned char *vector, int len)
{ {
dccp_pr_debug_cat("ACK vector len=%d, ackno=%llu |", len, dccp_pr_debug_cat("ACK vector len=%d, ackno=%llu |", len,
(unsigned long long)ackno); (unsigned long long)ackno);
while (len--) { while (len--) {
const u8 state = (*vector & DCCP_ACKVEC_STATE_MASK) >> 6; const u8 state = (*vector & DCCP_ACKVEC_STATE_MASK) >> 6;
......
...@@ -351,7 +351,7 @@ static void ccid2_hc_tx_packet_sent(struct sock *sk, int more, unsigned int len) ...@@ -351,7 +351,7 @@ static void ccid2_hc_tx_packet_sent(struct sock *sk, int more, unsigned int len)
while (seqp != hctx->ccid2hctx_seqh) { while (seqp != hctx->ccid2hctx_seqh) {
ccid2_pr_debug("out seq=%llu acked=%d time=%lu\n", ccid2_pr_debug("out seq=%llu acked=%d time=%lu\n",
(unsigned long long)seqp->ccid2s_seq, (unsigned long long)seqp->ccid2s_seq,
seqp->ccid2s_acked, seqp->ccid2s_sent); seqp->ccid2s_acked, seqp->ccid2s_sent);
seqp = seqp->ccid2s_next; seqp = seqp->ccid2s_next;
} }
...@@ -473,7 +473,7 @@ static inline void ccid2_new_ack(struct sock *sk, ...@@ -473,7 +473,7 @@ static inline void ccid2_new_ack(struct sock *sk,
/* first measurement */ /* first measurement */
if (hctx->ccid2hctx_srtt == -1) { if (hctx->ccid2hctx_srtt == -1) {
ccid2_pr_debug("R: %lu Time=%lu seq=%llu\n", ccid2_pr_debug("R: %lu Time=%lu seq=%llu\n",
r, jiffies, r, jiffies,
(unsigned long long)seqp->ccid2s_seq); (unsigned long long)seqp->ccid2s_seq);
ccid2_change_srtt(hctx, r); ccid2_change_srtt(hctx, r);
hctx->ccid2hctx_rttvar = r >> 1; hctx->ccid2hctx_rttvar = r >> 1;
...@@ -518,8 +518,8 @@ static inline void ccid2_new_ack(struct sock *sk, ...@@ -518,8 +518,8 @@ static inline void ccid2_new_ack(struct sock *sk,
hctx->ccid2hctx_lastrtt = jiffies; hctx->ccid2hctx_lastrtt = jiffies;
ccid2_pr_debug("srtt: %ld rttvar: %ld rto: %ld (HZ=%d) R=%lu\n", ccid2_pr_debug("srtt: %ld rttvar: %ld rto: %ld (HZ=%d) R=%lu\n",
hctx->ccid2hctx_srtt, hctx->ccid2hctx_rttvar, hctx->ccid2hctx_srtt, hctx->ccid2hctx_rttvar,
hctx->ccid2hctx_rto, HZ, r); hctx->ccid2hctx_rto, HZ, r);
hctx->ccid2hctx_sent = 0; hctx->ccid2hctx_sent = 0;
} }
...@@ -667,9 +667,9 @@ static void ccid2_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) ...@@ -667,9 +667,9 @@ static void ccid2_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
/* new packet received or marked */ /* new packet received or marked */
if (state != DCCP_ACKVEC_STATE_NOT_RECEIVED && if (state != DCCP_ACKVEC_STATE_NOT_RECEIVED &&
!seqp->ccid2s_acked) { !seqp->ccid2s_acked) {
if (state == if (state ==
DCCP_ACKVEC_STATE_ECN_MARKED) { DCCP_ACKVEC_STATE_ECN_MARKED) {
ccid2_congestion_event(hctx, ccid2_congestion_event(hctx,
seqp); seqp);
} else } else
ccid2_new_ack(sk, seqp, ccid2_new_ack(sk, seqp,
......
...@@ -124,18 +124,18 @@ static void ccid3_hc_tx_update_x(struct sock *sk, struct timeval *now) ...@@ -124,18 +124,18 @@ static void ccid3_hc_tx_update_x(struct sock *sk, struct timeval *now)
if (hctx->ccid3hctx_p > 0) { if (hctx->ccid3hctx_p > 0) {
hctx->ccid3hctx_x = min(((__u64)hctx->ccid3hctx_x_calc) << 6, hctx->ccid3hctx_x = min(((__u64)hctx->ccid3hctx_x_calc) << 6,
hctx->ccid3hctx_x_recv * 2 ); hctx->ccid3hctx_x_recv * 2);
hctx->ccid3hctx_x = max(hctx->ccid3hctx_x, hctx->ccid3hctx_x = max(hctx->ccid3hctx_x,
(((__u64)hctx->ccid3hctx_s) << 6) / (((__u64)hctx->ccid3hctx_s) << 6) /
TFRC_T_MBI); TFRC_T_MBI);
} else if (timeval_delta(now, &hctx->ccid3hctx_t_ld) - } else if (timeval_delta(now, &hctx->ccid3hctx_t_ld) -
(suseconds_t)hctx->ccid3hctx_rtt >= 0 ) { (suseconds_t)hctx->ccid3hctx_rtt >= 0) {
hctx->ccid3hctx_x = hctx->ccid3hctx_x =
max(2 * min(hctx->ccid3hctx_x, hctx->ccid3hctx_x_recv), max(2 * min(hctx->ccid3hctx_x, hctx->ccid3hctx_x_recv),
scaled_div(((__u64)hctx->ccid3hctx_s) << 6, scaled_div(((__u64)hctx->ccid3hctx_s) << 6,
hctx->ccid3hctx_rtt ) ); hctx->ccid3hctx_rtt));
hctx->ccid3hctx_t_ld = *now; hctx->ccid3hctx_t_ld = *now;
} }
...@@ -144,8 +144,8 @@ static void ccid3_hc_tx_update_x(struct sock *sk, struct timeval *now) ...@@ -144,8 +144,8 @@ static void ccid3_hc_tx_update_x(struct sock *sk, struct timeval *now)
} }
/* /*
* Track the mean packet size `s' (cf. RFC 4342, 5.3 and RFC 3448, 4.1) * Track the mean packet size `s' (cf. RFC 4342, 5.3 and RFC 3448, 4.1)
* @len: DCCP packet payload size in bytes * @len: DCCP packet payload size in bytes
*/ */
static inline void ccid3_hc_tx_update_s(struct ccid3_hc_tx_sock *hctx, int len) static inline void ccid3_hc_tx_update_s(struct ccid3_hc_tx_sock *hctx, int len)
{ {
...@@ -163,8 +163,8 @@ static inline void ccid3_hc_tx_update_s(struct ccid3_hc_tx_sock *hctx, int len) ...@@ -163,8 +163,8 @@ static inline void ccid3_hc_tx_update_s(struct ccid3_hc_tx_sock *hctx, int len)
} }
/* /*
* Update Window Counter using the algorithm from [RFC 4342, 8.1]. * Update Window Counter using the algorithm from [RFC 4342, 8.1].
* The algorithm is not applicable if RTT < 4 microseconds. * The algorithm is not applicable if RTT < 4 microseconds.
*/ */
static inline void ccid3_hc_tx_update_win_count(struct ccid3_hc_tx_sock *hctx, static inline void ccid3_hc_tx_update_win_count(struct ccid3_hc_tx_sock *hctx,
struct timeval *now) struct timeval *now)
...@@ -228,12 +228,13 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data) ...@@ -228,12 +228,13 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data)
*/ */
if (!hctx->ccid3hctx_idle || if (!hctx->ccid3hctx_idle ||
(hctx->ccid3hctx_x_recv >= 4 * (hctx->ccid3hctx_x_recv >= 4 *
scaled_div(((__u64)hctx->ccid3hctx_s) << 6, hctx->ccid3hctx_rtt))) { scaled_div(((__u64)hctx->ccid3hctx_s) << 6,
hctx->ccid3hctx_rtt))) {
struct timeval now; struct timeval now;
ccid3_pr_debug("%s(%p, state=%s), not idle\n", ccid3_pr_debug("%s(%p, state=%s), not idle\n",
dccp_role(sk), sk, dccp_role(sk), sk,
ccid3_tx_state_name(hctx->ccid3hctx_state)); ccid3_tx_state_name(hctx->ccid3hctx_state));
/* /*
* Modify the cached value of X_recv [RFC 3448, 4.4] * Modify the cached value of X_recv [RFC 3448, 4.4]
...@@ -248,12 +249,13 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data) ...@@ -248,12 +249,13 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data)
BUG_ON(hctx->ccid3hctx_p && !hctx->ccid3hctx_x_calc); BUG_ON(hctx->ccid3hctx_p && !hctx->ccid3hctx_x_calc);
if (hctx->ccid3hctx_p == 0 || if (hctx->ccid3hctx_p == 0 ||
hctx->ccid3hctx_x_calc > (hctx->ccid3hctx_x_recv >> 5)) { (hctx->ccid3hctx_x_calc >
(hctx->ccid3hctx_x_recv >> 5))) {
hctx->ccid3hctx_x_recv = hctx->ccid3hctx_x_recv =
max(hctx->ccid3hctx_x_recv / 2, max(hctx->ccid3hctx_x_recv / 2,
(((__u64)hctx->ccid3hctx_s) << 6) / (((__u64)hctx->ccid3hctx_s) << 6) /
(2*TFRC_T_MBI)); (2 * TFRC_T_MBI));
if (hctx->ccid3hctx_p == 0) if (hctx->ccid3hctx_p == 0)
dccp_timestamp(sk, &now); dccp_timestamp(sk, &now);
...@@ -316,7 +318,8 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb) ...@@ -316,7 +318,8 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb)
switch (hctx->ccid3hctx_state) { switch (hctx->ccid3hctx_state) {
case TFRC_SSTATE_NO_SENT: case TFRC_SSTATE_NO_SENT:
sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer, sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer,
jiffies + usecs_to_jiffies(TFRC_INITIAL_TIMEOUT)); (jiffies +
usecs_to_jiffies(TFRC_INITIAL_TIMEOUT)));
hctx->ccid3hctx_last_win_count = 0; hctx->ccid3hctx_last_win_count = 0;
hctx->ccid3hctx_t_last_win_count = now; hctx->ccid3hctx_t_last_win_count = now;
ccid3_hc_tx_set_state(sk, TFRC_SSTATE_NO_FBACK); ccid3_hc_tx_set_state(sk, TFRC_SSTATE_NO_FBACK);
...@@ -338,7 +341,7 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb) ...@@ -338,7 +341,7 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb)
case TFRC_SSTATE_FBACK: case TFRC_SSTATE_FBACK:
delay = timeval_delta(&hctx->ccid3hctx_t_nom, &now); delay = timeval_delta(&hctx->ccid3hctx_t_nom, &now);
/* /*
* Scheduling of packet transmissions [RFC 3448, 4.6] * Scheduling of packet transmissions [RFC 3448, 4.6]
* *
* if (t_now > t_nom - delta) * if (t_now > t_nom - delta)
* // send the packet now * // send the packet now
...@@ -365,7 +368,8 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb) ...@@ -365,7 +368,8 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb)
return 0; return 0;
} }
static void ccid3_hc_tx_packet_sent(struct sock *sk, int more, unsigned int len) static void ccid3_hc_tx_packet_sent(struct sock *sk, int more,
unsigned int len)
{ {
struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
struct timeval now; struct timeval now;
...@@ -415,12 +419,12 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) ...@@ -415,12 +419,12 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
case TFRC_SSTATE_FBACK: case TFRC_SSTATE_FBACK:
/* get packet from history to look up t_recvdata */ /* get packet from history to look up t_recvdata */
packet = dccp_tx_hist_find_entry(&hctx->ccid3hctx_hist, packet = dccp_tx_hist_find_entry(&hctx->ccid3hctx_hist,
DCCP_SKB_CB(skb)->dccpd_ack_seq); DCCP_SKB_CB(skb)->dccpd_ack_seq);
if (unlikely(packet == NULL)) { if (unlikely(packet == NULL)) {
DCCP_WARN("%s(%p), seqno %llu(%s) doesn't exist " DCCP_WARN("%s(%p), seqno %llu(%s) doesn't exist "
"in history!\n", dccp_role(sk), sk, "in history!\n", dccp_role(sk), sk,
(unsigned long long)DCCP_SKB_CB(skb)->dccpd_ack_seq, (unsigned long long)DCCP_SKB_CB(skb)->dccpd_ack_seq,
dccp_packet_name(DCCP_SKB_CB(skb)->dccpd_type)); dccp_packet_name(DCCP_SKB_CB(skb)->dccpd_type));
return; return;
} }
...@@ -433,13 +437,13 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) ...@@ -433,13 +437,13 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
if (pinv == ~0U || pinv == 0) /* see RFC 4342, 8.5 */ if (pinv == ~0U || pinv == 0) /* see RFC 4342, 8.5 */
hctx->ccid3hctx_p = 0; hctx->ccid3hctx_p = 0;
else /* can not exceed 100% */ else /* can not exceed 100% */
hctx->ccid3hctx_p = 1000000 / pinv; hctx->ccid3hctx_p = 1000000 / pinv;
dccp_timestamp(sk, &now); dccp_timestamp(sk, &now);
/* /*
* Calculate new round trip sample as per [RFC 3448, 4.3] by * Calculate new round trip sample as per [RFC 3448, 4.3] by
* R_sample = (now - t_recvdata) - t_elapsed * R_sample = (now - t_recvdata) - t_elapsed
*/ */
r_sample = timeval_delta(&now, &packet->dccphtx_tstamp); r_sample = timeval_delta(&now, &packet->dccphtx_tstamp);
t_elapsed = dp->dccps_options_received.dccpor_elapsed_time * 10; t_elapsed = dp->dccps_options_received.dccpor_elapsed_time * 10;
...@@ -465,7 +469,7 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) ...@@ -465,7 +469,7 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
* Larger Initial Windows [RFC 4342, sec. 5] * Larger Initial Windows [RFC 4342, sec. 5]
* We deviate in that we use `s' instead of `MSS'. * We deviate in that we use `s' instead of `MSS'.
*/ */
__u64 w_init = min( 4 * hctx->ccid3hctx_s, __u64 w_init = min(4 * hctx->ccid3hctx_s,
max(2 * hctx->ccid3hctx_s, 4380)); max(2 * hctx->ccid3hctx_s, 4380));
hctx->ccid3hctx_rtt = r_sample; hctx->ccid3hctx_rtt = r_sample;
hctx->ccid3hctx_x = scaled_div(w_init << 6, r_sample); hctx->ccid3hctx_x = scaled_div(w_init << 6, r_sample);
...@@ -475,13 +479,14 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) ...@@ -475,13 +479,14 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
ccid3_pr_debug("%s(%p), s=%u, w_init=%llu, " ccid3_pr_debug("%s(%p), s=%u, w_init=%llu, "
"R_sample=%dus, X=%u\n", dccp_role(sk), "R_sample=%dus, X=%u\n", dccp_role(sk),
sk, hctx->ccid3hctx_s, w_init, (int)r_sample, sk, hctx->ccid3hctx_s, w_init,
(int)r_sample,
(unsigned)(hctx->ccid3hctx_x >> 6)); (unsigned)(hctx->ccid3hctx_x >> 6));
ccid3_hc_tx_set_state(sk, TFRC_SSTATE_FBACK); ccid3_hc_tx_set_state(sk, TFRC_SSTATE_FBACK);
} else { } else {
hctx->ccid3hctx_rtt = (9 * hctx->ccid3hctx_rtt + hctx->ccid3hctx_rtt = (9 * hctx->ccid3hctx_rtt +
(u32)r_sample ) / 10; (u32)r_sample) / 10;
/* Update sending rate (step 4 of [RFC 3448, 4.3]) */ /* Update sending rate (step 4 of [RFC 3448, 4.3]) */
if (hctx->ccid3hctx_p > 0) if (hctx->ccid3hctx_p > 0)
...@@ -492,12 +497,13 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) ...@@ -492,12 +497,13 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
ccid3_hc_tx_update_x(sk, &now); ccid3_hc_tx_update_x(sk, &now);
ccid3_pr_debug("%s(%p), RTT=%uus (sample=%dus), s=%u, " ccid3_pr_debug("%s(%p), RTT=%uus (sample=%dus), s=%u, "
"p=%u, X_calc=%u, X_recv=%u, X=%u\n", dccp_role(sk), "p=%u, X_calc=%u, X_recv=%u, X=%u\n",
dccp_role(sk),
sk, hctx->ccid3hctx_rtt, (int)r_sample, sk, hctx->ccid3hctx_rtt, (int)r_sample,
hctx->ccid3hctx_s, hctx->ccid3hctx_p, hctx->ccid3hctx_s, hctx->ccid3hctx_p,
hctx->ccid3hctx_x_calc, hctx->ccid3hctx_x_calc,
(unsigned)(hctx->ccid3hctx_x_recv >> 6), (unsigned)(hctx->ccid3hctx_x_recv >> 6),
(unsigned)(hctx->ccid3hctx_x >> 6) ); (unsigned)(hctx->ccid3hctx_x >> 6));
} }
/* unschedule no feedback timer */ /* unschedule no feedback timer */
...@@ -507,20 +513,20 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) ...@@ -507,20 +513,20 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
dccp_tx_hist_purge_older(ccid3_tx_hist, dccp_tx_hist_purge_older(ccid3_tx_hist,
&hctx->ccid3hctx_hist, packet); &hctx->ccid3hctx_hist, packet);
/* /*
* As we have calculated new ipi, delta, t_nom it is possible that * As we have calculated new ipi, delta, t_nom it is possible
* we now can send a packet, so wake up dccp_wait_for_ccid * that we now can send a packet, so wake up dccp_wait_for_ccid
*/ */
sk->sk_write_space(sk); sk->sk_write_space(sk);
/* /*
* Update timeout interval for the nofeedback timer. * Update timeout interval for the nofeedback timer.
* We use a configuration option to increase the lower bound. * We use a configuration option to increase the lower bound.
* This can help avoid triggering the nofeedback timer too often * This can help avoid triggering the nofeedback timer too
* ('spinning') on LANs with small RTTs. * often ('spinning') on LANs with small RTTs.
*/ */
hctx->ccid3hctx_t_rto = max_t(u32, 4 * hctx->ccid3hctx_rtt, hctx->ccid3hctx_t_rto = max_t(u32, 4 * hctx->ccid3hctx_rtt,
CONFIG_IP_DCCP_CCID3_RTO * CONFIG_IP_DCCP_CCID3_RTO *
(USEC_PER_SEC/1000) ); (USEC_PER_SEC/1000));
/* /*
* Schedule no feedback timer to expire in * Schedule no feedback timer to expire in
* max(t_RTO, 2 * s/X) = max(t_RTO, 2 * t_ipi) * max(t_RTO, 2 * s/X) = max(t_RTO, 2 * t_ipi)
...@@ -528,7 +534,8 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) ...@@ -528,7 +534,8 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
t_nfb = max(hctx->ccid3hctx_t_rto, 2 * hctx->ccid3hctx_t_ipi); t_nfb = max(hctx->ccid3hctx_t_rto, 2 * hctx->ccid3hctx_t_ipi);
ccid3_pr_debug("%s(%p), Scheduled no feedback timer to " ccid3_pr_debug("%s(%p), Scheduled no feedback timer to "
"expire in %lu jiffies (%luus)\n", dccp_role(sk), "expire in %lu jiffies (%luus)\n",
dccp_role(sk),
sk, usecs_to_jiffies(t_nfb), t_nfb); sk, usecs_to_jiffies(t_nfb), t_nfb);
sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer, sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer,
...@@ -538,7 +545,9 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) ...@@ -538,7 +545,9 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
hctx->ccid3hctx_idle = 1; hctx->ccid3hctx_idle = 1;
break; break;
case TFRC_SSTATE_NO_SENT: case TFRC_SSTATE_NO_SENT:
/* XXX when implementing bidirectional rx/tx check this again */ /*
* XXX when implementing bidirectional rx/tx check this again
*/
DCCP_WARN("Illegal ACK received - no packet sent\n"); DCCP_WARN("Illegal ACK received - no packet sent\n");
/* fall through */ /* fall through */
case TFRC_SSTATE_TERM: /* ignore feedback when closing */ case TFRC_SSTATE_TERM: /* ignore feedback when closing */
...@@ -575,7 +584,8 @@ static int ccid3_hc_tx_parse_options(struct sock *sk, unsigned char option, ...@@ -575,7 +584,8 @@ static int ccid3_hc_tx_parse_options(struct sock *sk, unsigned char option,
dccp_role(sk), sk, len); dccp_role(sk), sk, len);
rc = -EINVAL; rc = -EINVAL;
} else { } else {
opt_recv->ccid3or_loss_event_rate = ntohl(*(__be32 *)value); opt_recv->ccid3or_loss_event_rate =
ntohl(*(__be32 *)value);
ccid3_pr_debug("%s(%p), LOSS_EVENT_RATE=%u\n", ccid3_pr_debug("%s(%p), LOSS_EVENT_RATE=%u\n",
dccp_role(sk), sk, dccp_role(sk), sk,
opt_recv->ccid3or_loss_event_rate); opt_recv->ccid3or_loss_event_rate);
...@@ -596,7 +606,8 @@ static int ccid3_hc_tx_parse_options(struct sock *sk, unsigned char option, ...@@ -596,7 +606,8 @@ static int ccid3_hc_tx_parse_options(struct sock *sk, unsigned char option,
dccp_role(sk), sk, len); dccp_role(sk), sk, len);
rc = -EINVAL; rc = -EINVAL;
} else { } else {
opt_recv->ccid3or_receive_rate = ntohl(*(__be32 *)value); opt_recv->ccid3or_receive_rate =
ntohl(*(__be32 *)value);
ccid3_pr_debug("%s(%p), RECEIVE_RATE=%u\n", ccid3_pr_debug("%s(%p), RECEIVE_RATE=%u\n",
dccp_role(sk), sk, dccp_role(sk), sk,
opt_recv->ccid3or_receive_rate); opt_recv->ccid3or_receive_rate);
...@@ -616,7 +627,8 @@ static int ccid3_hc_tx_init(struct ccid *ccid, struct sock *sk) ...@@ -616,7 +627,8 @@ static int ccid3_hc_tx_init(struct ccid *ccid, struct sock *sk)
hctx->ccid3hctx_state = TFRC_SSTATE_NO_SENT; hctx->ccid3hctx_state = TFRC_SSTATE_NO_SENT;
INIT_LIST_HEAD(&hctx->ccid3hctx_hist); INIT_LIST_HEAD(&hctx->ccid3hctx_hist);
hctx->ccid3hctx_no_feedback_timer.function = ccid3_hc_tx_no_feedback_timer; hctx->ccid3hctx_no_feedback_timer.function =
ccid3_hc_tx_no_feedback_timer;
hctx->ccid3hctx_no_feedback_timer.data = (unsigned long)sk; hctx->ccid3hctx_no_feedback_timer.data = (unsigned long)sk;
init_timer(&hctx->ccid3hctx_no_feedback_timer); init_timer(&hctx->ccid3hctx_no_feedback_timer);
...@@ -754,9 +766,9 @@ static int ccid3_hc_rx_insert_options(struct sock *sk, struct sk_buff *skb) ...@@ -754,9 +766,9 @@ static int ccid3_hc_rx_insert_options(struct sock *sk, struct sk_buff *skb)
hcrx->ccid3hcrx_elapsed_time)) || hcrx->ccid3hcrx_elapsed_time)) ||
dccp_insert_option_timestamp(sk, skb) || dccp_insert_option_timestamp(sk, skb) ||
dccp_insert_option(sk, skb, TFRC_OPT_LOSS_EVENT_RATE, dccp_insert_option(sk, skb, TFRC_OPT_LOSS_EVENT_RATE,
&pinv, sizeof(pinv)) || &pinv, sizeof(pinv)) ||
dccp_insert_option(sk, skb, TFRC_OPT_RECEIVE_RATE, dccp_insert_option(sk, skb, TFRC_OPT_RECEIVE_RATE,
&x_recv, sizeof(x_recv))) &x_recv, sizeof(x_recv)))
return -1; return -1;
return 0; return 0;
...@@ -827,9 +839,9 @@ found: ...@@ -827,9 +839,9 @@ found:
/* /*
* Determine the length of the first loss interval via inverse lookup. * Determine the length of the first loss interval via inverse lookup.
* Assume that X_recv can be computed by the throughput equation * Assume that X_recv can be computed by the throughput equation
* s * s
* X_recv = -------- * X_recv = --------
* R * fval * R * fval
* Find some p such that f(p) = fval; return 1/p [RFC 3448, 6.3.1]. * Find some p such that f(p) = fval; return 1/p [RFC 3448, 6.3.1].
*/ */
if (rtt == 0) { /* would result in divide-by-zero */ if (rtt == 0) { /* would result in divide-by-zero */
...@@ -860,7 +872,7 @@ found: ...@@ -860,7 +872,7 @@ found:
if (p == 0) if (p == 0)
return ~0; return ~0;
else else
return 1000000 / p; return 1000000 / p;
} }
static void ccid3_hc_rx_update_li(struct sock *sk, u64 seq_loss, u8 win_loss) static void ccid3_hc_rx_update_li(struct sock *sk, u64 seq_loss, u8 win_loss)
...@@ -914,7 +926,8 @@ static int ccid3_hc_rx_detect_loss(struct sock *sk, ...@@ -914,7 +926,8 @@ static int ccid3_hc_rx_detect_loss(struct sock *sk,
struct dccp_rx_hist_entry *packet) struct dccp_rx_hist_entry *packet)
{ {
struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk);
struct dccp_rx_hist_entry *rx_hist = dccp_rx_hist_head(&hcrx->ccid3hcrx_hist); struct dccp_rx_hist_entry *rx_hist =
dccp_rx_hist_head(&hcrx->ccid3hcrx_hist);
u64 seqno = packet->dccphrx_seqno; u64 seqno = packet->dccphrx_seqno;
u64 tmp_seqno; u64 tmp_seqno;
int loss = 0; int loss = 0;
...@@ -942,7 +955,7 @@ static int ccid3_hc_rx_detect_loss(struct sock *sk, ...@@ -942,7 +955,7 @@ static int ccid3_hc_rx_detect_loss(struct sock *sk,
dccp_inc_seqno(&tmp_seqno); dccp_inc_seqno(&tmp_seqno);
while (dccp_rx_hist_find_entry(&hcrx->ccid3hcrx_hist, while (dccp_rx_hist_find_entry(&hcrx->ccid3hcrx_hist,
tmp_seqno, &ccval)) { tmp_seqno, &ccval)) {
hcrx->ccid3hcrx_seqno_nonloss = tmp_seqno; hcrx->ccid3hcrx_seqno_nonloss = tmp_seqno;
hcrx->ccid3hcrx_ccval_nonloss = ccval; hcrx->ccid3hcrx_ccval_nonloss = ccval;
dccp_inc_seqno(&tmp_seqno); dccp_inc_seqno(&tmp_seqno);
} }
...@@ -1044,8 +1057,8 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb) ...@@ -1044,8 +1057,8 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb)
break; break;
dccp_timestamp(sk, &now); dccp_timestamp(sk, &now);
if (timeval_delta(&now, &hcrx->ccid3hcrx_tstamp_last_ack) - if ((timeval_delta(&now, &hcrx->ccid3hcrx_tstamp_last_ack) -
(suseconds_t)hcrx->ccid3hcrx_rtt >= 0) { (suseconds_t)hcrx->ccid3hcrx_rtt) >= 0) {
hcrx->ccid3hcrx_tstamp_last_ack = now; hcrx->ccid3hcrx_tstamp_last_ack = now;
ccid3_hc_rx_send_feedback(sk); ccid3_hc_rx_send_feedback(sk);
} }
...@@ -1118,9 +1131,9 @@ static void ccid3_hc_rx_get_info(struct sock *sk, struct tcp_info *info) ...@@ -1118,9 +1131,9 @@ static void ccid3_hc_rx_get_info(struct sock *sk, struct tcp_info *info)
BUG_ON(hcrx == NULL); BUG_ON(hcrx == NULL);
info->tcpi_ca_state = hcrx->ccid3hcrx_state; info->tcpi_ca_state = hcrx->ccid3hcrx_state;
info->tcpi_options |= TCPI_OPT_TIMESTAMPS; info->tcpi_options |= TCPI_OPT_TIMESTAMPS;
info->tcpi_rcv_rtt = hcrx->ccid3hcrx_rtt; info->tcpi_rcv_rtt = hcrx->ccid3hcrx_rtt;
} }
static void ccid3_hc_tx_get_info(struct sock *sk, struct tcp_info *info) static void ccid3_hc_tx_get_info(struct sock *sk, struct tcp_info *info)
...@@ -1212,7 +1225,7 @@ static struct ccid_operations ccid3 = { ...@@ -1212,7 +1225,7 @@ static struct ccid_operations ccid3 = {
.ccid_hc_rx_getsockopt = ccid3_hc_rx_getsockopt, .ccid_hc_rx_getsockopt = ccid3_hc_rx_getsockopt,
.ccid_hc_tx_getsockopt = ccid3_hc_tx_getsockopt, .ccid_hc_tx_getsockopt = ccid3_hc_tx_getsockopt,
}; };
#ifdef CONFIG_IP_DCCP_CCID3_DEBUG #ifdef CONFIG_IP_DCCP_CCID3_DEBUG
module_param(ccid3_debug, int, 0444); module_param(ccid3_debug, int, 0444);
MODULE_PARM_DESC(ccid3_debug, "Enable debug messages"); MODULE_PARM_DESC(ccid3_debug, "Enable debug messages");
...@@ -1235,7 +1248,7 @@ static __init int ccid3_module_init(void) ...@@ -1235,7 +1248,7 @@ static __init int ccid3_module_init(void)
goto out_free_tx; goto out_free_tx;
rc = ccid_register(&ccid3); rc = ccid_register(&ccid3);
if (rc != 0) if (rc != 0)
goto out_free_loss_interval_history; goto out_free_loss_interval_history;
out: out:
return rc; return rc;
......
...@@ -77,7 +77,7 @@ struct ccid3_options_received { ...@@ -77,7 +77,7 @@ struct ccid3_options_received {
/* TFRC sender states */ /* TFRC sender states */
enum ccid3_hc_tx_states { enum ccid3_hc_tx_states {
TFRC_SSTATE_NO_SENT = 1, TFRC_SSTATE_NO_SENT = 1,
TFRC_SSTATE_NO_FBACK, TFRC_SSTATE_NO_FBACK,
TFRC_SSTATE_FBACK, TFRC_SSTATE_FBACK,
TFRC_SSTATE_TERM, TFRC_SSTATE_TERM,
...@@ -96,7 +96,7 @@ enum ccid3_hc_tx_states { ...@@ -96,7 +96,7 @@ enum ccid3_hc_tx_states {
* @ccid3hctx_state - Sender state, one of %ccid3_hc_tx_states * @ccid3hctx_state - Sender state, one of %ccid3_hc_tx_states
* @ccid3hctx_last_win_count - Last window counter sent * @ccid3hctx_last_win_count - Last window counter sent
* @ccid3hctx_t_last_win_count - Timestamp of earliest packet * @ccid3hctx_t_last_win_count - Timestamp of earliest packet
* with last_win_count value sent * with last_win_count value sent
* @ccid3hctx_no_feedback_timer - Handle to no feedback timer * @ccid3hctx_no_feedback_timer - Handle to no feedback timer
* @ccid3hctx_idle - Flag indicating that sender is idling * @ccid3hctx_idle - Flag indicating that sender is idling
* @ccid3hctx_t_ld - Time last doubled during slow start * @ccid3hctx_t_ld - Time last doubled during slow start
...@@ -115,7 +115,7 @@ struct ccid3_hc_tx_sock { ...@@ -115,7 +115,7 @@ struct ccid3_hc_tx_sock {
#define ccid3hctx_t_rto ccid3hctx_tfrc.tfrctx_rto #define ccid3hctx_t_rto ccid3hctx_tfrc.tfrctx_rto
#define ccid3hctx_t_ipi ccid3hctx_tfrc.tfrctx_ipi #define ccid3hctx_t_ipi ccid3hctx_tfrc.tfrctx_ipi
u16 ccid3hctx_s; u16 ccid3hctx_s;
enum ccid3_hc_tx_states ccid3hctx_state:8; enum ccid3_hc_tx_states ccid3hctx_state:8;
u8 ccid3hctx_last_win_count; u8 ccid3hctx_last_win_count;
u8 ccid3hctx_idle; u8 ccid3hctx_idle;
struct timeval ccid3hctx_t_last_win_count; struct timeval ccid3hctx_t_last_win_count;
...@@ -129,7 +129,7 @@ struct ccid3_hc_tx_sock { ...@@ -129,7 +129,7 @@ struct ccid3_hc_tx_sock {
/* TFRC receiver states */ /* TFRC receiver states */
enum ccid3_hc_rx_states { enum ccid3_hc_rx_states {
TFRC_RSTATE_NO_DATA = 1, TFRC_RSTATE_NO_DATA = 1,
TFRC_RSTATE_DATA, TFRC_RSTATE_DATA,
TFRC_RSTATE_TERM = 127, TFRC_RSTATE_TERM = 127,
}; };
...@@ -157,18 +157,18 @@ struct ccid3_hc_rx_sock { ...@@ -157,18 +157,18 @@ struct ccid3_hc_rx_sock {
#define ccid3hcrx_x_recv ccid3hcrx_tfrc.tfrcrx_x_recv #define ccid3hcrx_x_recv ccid3hcrx_tfrc.tfrcrx_x_recv
#define ccid3hcrx_rtt ccid3hcrx_tfrc.tfrcrx_rtt #define ccid3hcrx_rtt ccid3hcrx_tfrc.tfrcrx_rtt
#define ccid3hcrx_p ccid3hcrx_tfrc.tfrcrx_p #define ccid3hcrx_p ccid3hcrx_tfrc.tfrcrx_p
u64 ccid3hcrx_seqno_nonloss:48, u64 ccid3hcrx_seqno_nonloss:48,
ccid3hcrx_ccval_nonloss:4, ccid3hcrx_ccval_nonloss:4,
ccid3hcrx_ccval_last_counter:4; ccid3hcrx_ccval_last_counter:4;
enum ccid3_hc_rx_states ccid3hcrx_state:8; enum ccid3_hc_rx_states ccid3hcrx_state:8;
u32 ccid3hcrx_bytes_recv; u32 ccid3hcrx_bytes_recv;
struct timeval ccid3hcrx_tstamp_last_feedback; struct timeval ccid3hcrx_tstamp_last_feedback;
struct timeval ccid3hcrx_tstamp_last_ack; struct timeval ccid3hcrx_tstamp_last_ack;
struct list_head ccid3hcrx_hist; struct list_head ccid3hcrx_hist;
struct list_head ccid3hcrx_li_hist; struct list_head ccid3hcrx_li_hist;
u16 ccid3hcrx_s; u16 ccid3hcrx_s;
u32 ccid3hcrx_pinv; u32 ccid3hcrx_pinv;
u32 ccid3hcrx_elapsed_time; u32 ccid3hcrx_elapsed_time;
}; };
static inline struct ccid3_hc_tx_sock *ccid3_hc_tx_sk(const struct sock *sk) static inline struct ccid3_hc_tx_sock *ccid3_hc_tx_sk(const struct sock *sk)
......
...@@ -329,7 +329,7 @@ static void dccp_feat_empty_confirm(struct dccp_minisock *dmsk, ...@@ -329,7 +329,7 @@ static void dccp_feat_empty_confirm(struct dccp_minisock *dmsk,
switch (type) { switch (type) {
case DCCPO_CHANGE_L: opt->dccpop_type = DCCPO_CONFIRM_R; break; case DCCPO_CHANGE_L: opt->dccpop_type = DCCPO_CONFIRM_R; break;
case DCCPO_CHANGE_R: opt->dccpop_type = DCCPO_CONFIRM_L; break; case DCCPO_CHANGE_R: opt->dccpop_type = DCCPO_CONFIRM_L; break;
default: DCCP_WARN("invalid type %d\n", type); return; default: DCCP_WARN("invalid type %d\n", type); return;
} }
opt->dccpop_feat = feature; opt->dccpop_feat = feature;
...@@ -427,7 +427,7 @@ int dccp_feat_confirm_recv(struct sock *sk, u8 type, u8 feature, ...@@ -427,7 +427,7 @@ int dccp_feat_confirm_recv(struct sock *sk, u8 type, u8 feature,
switch (type) { switch (type) {
case DCCPO_CONFIRM_L: t = DCCPO_CHANGE_R; break; case DCCPO_CONFIRM_L: t = DCCPO_CHANGE_R; break;
case DCCPO_CONFIRM_R: t = DCCPO_CHANGE_L; break; case DCCPO_CONFIRM_R: t = DCCPO_CHANGE_L; break;
default: DCCP_WARN("invalid type %d\n", type); default: DCCP_WARN("invalid type %d\n", type);
return 1; return 1;
} }
...@@ -610,7 +610,7 @@ const char *dccp_feat_typename(const u8 type) ...@@ -610,7 +610,7 @@ const char *dccp_feat_typename(const u8 type)
case DCCPO_CHANGE_R: return("ChangeR"); case DCCPO_CHANGE_R: return("ChangeR");
case DCCPO_CONFIRM_R: return("ConfirmR"); case DCCPO_CONFIRM_R: return("ConfirmR");
/* the following case must not appear in feature negotation */ /* the following case must not appear in feature negotation */
default: dccp_pr_debug("unknown type %d [BUG!]\n", type); default: dccp_pr_debug("unknown type %d [BUG!]\n", type);
} }
return NULL; return NULL;
} }
......
/* /*
* net/dccp/input.c * net/dccp/input.c
* *
* An implementation of the DCCP protocol * An implementation of the DCCP protocol
* Arnaldo Carvalho de Melo <acme@conectiva.com.br> * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* *
...@@ -82,7 +82,7 @@ static int dccp_check_seqno(struct sock *sk, struct sk_buff *skb) ...@@ -82,7 +82,7 @@ static int dccp_check_seqno(struct sock *sk, struct sk_buff *skb)
* Otherwise, * Otherwise,
* Drop packet and return * Drop packet and return
*/ */
if (dh->dccph_type == DCCP_PKT_SYNC || if (dh->dccph_type == DCCP_PKT_SYNC ||
dh->dccph_type == DCCP_PKT_SYNCACK) { dh->dccph_type == DCCP_PKT_SYNCACK) {
if (between48(DCCP_SKB_CB(skb)->dccpd_ack_seq, if (between48(DCCP_SKB_CB(skb)->dccpd_ack_seq,
dp->dccps_awl, dp->dccps_awh) && dp->dccps_awl, dp->dccps_awh) &&
...@@ -185,8 +185,8 @@ static int __dccp_rcv_established(struct sock *sk, struct sk_buff *skb, ...@@ -185,8 +185,8 @@ static int __dccp_rcv_established(struct sock *sk, struct sk_buff *skb,
dccp_rcv_close(sk, skb); dccp_rcv_close(sk, skb);
return 0; return 0;
case DCCP_PKT_REQUEST: case DCCP_PKT_REQUEST:
/* Step 7 /* Step 7
* or (S.is_server and P.type == Response) * or (S.is_server and P.type == Response)
* or (S.is_client and P.type == Request) * or (S.is_client and P.type == Request)
* or (S.state >= OPEN and P.type == Request * or (S.state >= OPEN and P.type == Request
* and P.seqno >= S.OSR) * and P.seqno >= S.OSR)
...@@ -274,7 +274,7 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk, ...@@ -274,7 +274,7 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
const struct dccp_hdr *dh, const struct dccp_hdr *dh,
const unsigned len) const unsigned len)
{ {
/* /*
* Step 4: Prepare sequence numbers in REQUEST * Step 4: Prepare sequence numbers in REQUEST
* If S.state == REQUEST, * If S.state == REQUEST,
* If (P.type == Response or P.type == Reset) * If (P.type == Response or P.type == Reset)
...@@ -342,7 +342,7 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk, ...@@ -342,7 +342,7 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
* from the Response * / * from the Response * /
* S.state := PARTOPEN * S.state := PARTOPEN
* Set PARTOPEN timer * Set PARTOPEN timer
* Continue with S.state == PARTOPEN * Continue with S.state == PARTOPEN
* / * Step 12 will send the Ack completing the * / * Step 12 will send the Ack completing the
* three-way handshake * / * three-way handshake * /
*/ */
...@@ -373,7 +373,7 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk, ...@@ -373,7 +373,7 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
*/ */
__kfree_skb(skb); __kfree_skb(skb);
return 0; return 0;
} }
dccp_send_ack(sk); dccp_send_ack(sk);
return -1; return -1;
} }
...@@ -381,7 +381,7 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk, ...@@ -381,7 +381,7 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
out_invalid_packet: out_invalid_packet:
/* dccp_v4_do_rcv will send a reset */ /* dccp_v4_do_rcv will send a reset */
DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_PACKET_ERROR; DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_PACKET_ERROR;
return 1; return 1;
} }
static int dccp_rcv_respond_partopen_state_process(struct sock *sk, static int dccp_rcv_respond_partopen_state_process(struct sock *sk,
...@@ -488,11 +488,11 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb, ...@@ -488,11 +488,11 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
if (dcb->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ) if (dcb->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ)
dccp_event_ack_recv(sk, skb); dccp_event_ack_recv(sk, skb);
if (dccp_msk(sk)->dccpms_send_ack_vector && if (dccp_msk(sk)->dccpms_send_ack_vector &&
dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk, dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk,
DCCP_SKB_CB(skb)->dccpd_seq, DCCP_SKB_CB(skb)->dccpd_seq,
DCCP_ACKVEC_STATE_RECEIVED)) DCCP_ACKVEC_STATE_RECEIVED))
goto discard; goto discard;
/* XXX see the comments in dccp_rcv_established about this */ /* XXX see the comments in dccp_rcv_established about this */
if (dccp_sk(sk)->dccps_role == DCCP_ROLE_SERVER) if (dccp_sk(sk)->dccps_role == DCCP_ROLE_SERVER)
...@@ -580,7 +580,7 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb, ...@@ -580,7 +580,7 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
} }
} }
if (!queued) { if (!queued) {
discard: discard:
__kfree_skb(skb); __kfree_skb(skb);
} }
......
...@@ -157,7 +157,7 @@ static inline void dccp_do_pmtu_discovery(struct sock *sk, ...@@ -157,7 +157,7 @@ static inline void dccp_do_pmtu_discovery(struct sock *sk,
/* We don't check in the destentry if pmtu discovery is forbidden /* We don't check in the destentry if pmtu discovery is forbidden
* on this route. We just assume that no packet_to_big packets * on this route. We just assume that no packet_to_big packets
* are send back when pmtu discovery is not active. * are send back when pmtu discovery is not active.
* There is a small race when the user changes this flag in the * There is a small race when the user changes this flag in the
* route, but I think that's acceptable. * route, but I think that's acceptable.
*/ */
if ((dst = __sk_dst_check(sk, 0)) == NULL) if ((dst = __sk_dst_check(sk, 0)) == NULL)
...@@ -467,7 +467,7 @@ static struct dst_entry* dccp_v4_route_skb(struct sock *sk, ...@@ -467,7 +467,7 @@ static struct dst_entry* dccp_v4_route_skb(struct sock *sk,
.uli_u = { .ports = .uli_u = { .ports =
{ .sport = dccp_hdr(skb)->dccph_dport, { .sport = dccp_hdr(skb)->dccph_dport,
.dport = dccp_hdr(skb)->dccph_sport } .dport = dccp_hdr(skb)->dccph_sport }
} }
}; };
security_skb_classify_flow(skb, &fl); security_skb_classify_flow(skb, &fl);
...@@ -595,7 +595,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) ...@@ -595,7 +595,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
struct inet_request_sock *ireq; struct inet_request_sock *ireq;
struct request_sock *req; struct request_sock *req;
struct dccp_request_sock *dreq; struct dccp_request_sock *dreq;
const __be32 service = dccp_hdr_request(skb)->dccph_req_service; const __be32 service = dccp_hdr_request(skb)->dccph_req_service;
struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb); struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb);
__u8 reset_code = DCCP_RESET_CODE_TOO_BUSY; __u8 reset_code = DCCP_RESET_CODE_TOO_BUSY;
...@@ -609,7 +609,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) ...@@ -609,7 +609,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
if (dccp_bad_service_code(sk, service)) { if (dccp_bad_service_code(sk, service)) {
reset_code = DCCP_RESET_CODE_BAD_SERVICE_CODE; reset_code = DCCP_RESET_CODE_BAD_SERVICE_CODE;
goto drop; goto drop;
} }
/* /*
* TW buckets are converted to open requests without * TW buckets are converted to open requests without
* limitations, they conserve resources and peer is * limitations, they conserve resources and peer is
...@@ -644,7 +644,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) ...@@ -644,7 +644,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
ireq->rmt_addr = skb->nh.iph->saddr; ireq->rmt_addr = skb->nh.iph->saddr;
ireq->opt = NULL; ireq->opt = NULL;
/* /*
* Step 3: Process LISTEN state * Step 3: Process LISTEN state
* *
* Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init Cookie * Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init Cookie
...@@ -846,15 +846,15 @@ static int dccp_v4_rcv(struct sk_buff *skb) ...@@ -846,15 +846,15 @@ static int dccp_v4_rcv(struct sk_buff *skb)
} }
/* Step 2: /* Step 2:
* Look up flow ID in table and get corresponding socket */ * Look up flow ID in table and get corresponding socket */
sk = __inet_lookup(&dccp_hashinfo, sk = __inet_lookup(&dccp_hashinfo,
skb->nh.iph->saddr, dh->dccph_sport, skb->nh.iph->saddr, dh->dccph_sport,
skb->nh.iph->daddr, dh->dccph_dport, skb->nh.iph->daddr, dh->dccph_dport,
inet_iif(skb)); inet_iif(skb));
/* /*
* Step 2: * Step 2:
* If no socket ... * If no socket ...
*/ */
if (sk == NULL) { if (sk == NULL) {
dccp_pr_debug("failed to look up flow ID in table and " dccp_pr_debug("failed to look up flow ID in table and "
...@@ -862,9 +862,9 @@ static int dccp_v4_rcv(struct sk_buff *skb) ...@@ -862,9 +862,9 @@ static int dccp_v4_rcv(struct sk_buff *skb)
goto no_dccp_socket; goto no_dccp_socket;
} }
/* /*
* Step 2: * Step 2:
* ... or S.state == TIMEWAIT, * ... or S.state == TIMEWAIT,
* Generate Reset(No Connection) unless P.type == Reset * Generate Reset(No Connection) unless P.type == Reset
* Drop packet and return * Drop packet and return
*/ */
...@@ -876,8 +876,8 @@ static int dccp_v4_rcv(struct sk_buff *skb) ...@@ -876,8 +876,8 @@ static int dccp_v4_rcv(struct sk_buff *skb)
/* /*
* RFC 4340, sec. 9.2.1: Minimum Checksum Coverage * RFC 4340, sec. 9.2.1: Minimum Checksum Coverage
* o if MinCsCov = 0, only packets with CsCov = 0 are accepted * o if MinCsCov = 0, only packets with CsCov = 0 are accepted
* o if MinCsCov > 0, also accept packets with CsCov >= MinCsCov * o if MinCsCov > 0, also accept packets with CsCov >= MinCsCov
*/ */
min_cov = dccp_sk(sk)->dccps_pcrlen; min_cov = dccp_sk(sk)->dccps_pcrlen;
if (dh->dccph_cscov && (min_cov == 0 || dh->dccph_cscov < min_cov)) { if (dh->dccph_cscov && (min_cov == 0 || dh->dccph_cscov < min_cov)) {
...@@ -900,7 +900,7 @@ no_dccp_socket: ...@@ -900,7 +900,7 @@ no_dccp_socket:
goto discard_it; goto discard_it;
/* /*
* Step 2: * Step 2:
* If no socket ... * If no socket ...
* Generate Reset(No Connection) unless P.type == Reset * Generate Reset(No Connection) unless P.type == Reset
* Drop packet and return * Drop packet and return
*/ */
......
...@@ -77,7 +77,7 @@ static inline void dccp_v6_send_check(struct sock *sk, int unused_value, ...@@ -77,7 +77,7 @@ static inline void dccp_v6_send_check(struct sock *sk, int unused_value,
} }
static inline __u32 secure_dccpv6_sequence_number(__be32 *saddr, __be32 *daddr, static inline __u32 secure_dccpv6_sequence_number(__be32 *saddr, __be32 *daddr,
__be16 sport, __be16 dport ) __be16 sport, __be16 dport )
{ {
return secure_tcpv6_sequence_number(saddr, daddr, sport, dport); return secure_tcpv6_sequence_number(saddr, daddr, sport, dport);
} }
...@@ -329,7 +329,7 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb) ...@@ -329,7 +329,7 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
skb = alloc_skb(dccp_v6_ctl_socket->sk->sk_prot->max_header, skb = alloc_skb(dccp_v6_ctl_socket->sk->sk_prot->max_header,
GFP_ATOMIC); GFP_ATOMIC);
if (skb == NULL) if (skb == NULL)
return; return;
skb_reserve(skb, dccp_v6_ctl_socket->sk->sk_prot->max_header); skb_reserve(skb, dccp_v6_ctl_socket->sk->sk_prot->max_header);
...@@ -353,7 +353,7 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb) ...@@ -353,7 +353,7 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
dccp_csum_outgoing(skb); dccp_csum_outgoing(skb);
dh->dccph_checksum = dccp_v6_csum_finish(skb, &rxskb->nh.ipv6h->saddr, dh->dccph_checksum = dccp_v6_csum_finish(skb, &rxskb->nh.ipv6h->saddr,
&rxskb->nh.ipv6h->daddr); &rxskb->nh.ipv6h->daddr);
memset(&fl, 0, sizeof(fl)); memset(&fl, 0, sizeof(fl));
ipv6_addr_copy(&fl.fl6_dst, &rxskb->nh.ipv6h->saddr); ipv6_addr_copy(&fl.fl6_dst, &rxskb->nh.ipv6h->saddr);
...@@ -424,7 +424,7 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb) ...@@ -424,7 +424,7 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
struct dccp_request_sock *dreq; struct dccp_request_sock *dreq;
struct inet6_request_sock *ireq6; struct inet6_request_sock *ireq6;
struct ipv6_pinfo *np = inet6_sk(sk); struct ipv6_pinfo *np = inet6_sk(sk);
const __be32 service = dccp_hdr_request(skb)->dccph_req_service; const __be32 service = dccp_hdr_request(skb)->dccph_req_service;
struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb); struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb);
__u8 reset_code = DCCP_RESET_CODE_TOO_BUSY; __u8 reset_code = DCCP_RESET_CODE_TOO_BUSY;
...@@ -437,7 +437,7 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb) ...@@ -437,7 +437,7 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
if (dccp_bad_service_code(sk, service)) { if (dccp_bad_service_code(sk, service)) {
reset_code = DCCP_RESET_CODE_BAD_SERVICE_CODE; reset_code = DCCP_RESET_CODE_BAD_SERVICE_CODE;
goto drop; goto drop;
} }
/* /*
* There are no SYN attacks on IPv6, yet... * There are no SYN attacks on IPv6, yet...
*/ */
...@@ -787,7 +787,7 @@ static int dccp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) ...@@ -787,7 +787,7 @@ static int dccp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
* otherwise we just shortcircuit this and continue with * otherwise we just shortcircuit this and continue with
* the new socket.. * the new socket..
*/ */
if (nsk != sk) { if (nsk != sk) {
if (dccp_child_process(sk, nsk, skb)) if (dccp_child_process(sk, nsk, skb))
goto reset; goto reset;
if (opt_skb != NULL) if (opt_skb != NULL)
...@@ -843,14 +843,14 @@ static int dccp_v6_rcv(struct sk_buff **pskb) ...@@ -843,14 +843,14 @@ static int dccp_v6_rcv(struct sk_buff **pskb)
DCCP_SKB_CB(skb)->dccpd_ack_seq = dccp_hdr_ack_seq(skb); DCCP_SKB_CB(skb)->dccpd_ack_seq = dccp_hdr_ack_seq(skb);
/* Step 2: /* Step 2:
* Look up flow ID in table and get corresponding socket */ * Look up flow ID in table and get corresponding socket */
sk = __inet6_lookup(&dccp_hashinfo, &skb->nh.ipv6h->saddr, sk = __inet6_lookup(&dccp_hashinfo, &skb->nh.ipv6h->saddr,
dh->dccph_sport, dh->dccph_sport,
&skb->nh.ipv6h->daddr, ntohs(dh->dccph_dport), &skb->nh.ipv6h->daddr, ntohs(dh->dccph_dport),
inet6_iif(skb)); inet6_iif(skb));
/* /*
* Step 2: * Step 2:
* If no socket ... * If no socket ...
*/ */
if (sk == NULL) { if (sk == NULL) {
dccp_pr_debug("failed to look up flow ID in table and " dccp_pr_debug("failed to look up flow ID in table and "
...@@ -860,7 +860,7 @@ static int dccp_v6_rcv(struct sk_buff **pskb) ...@@ -860,7 +860,7 @@ static int dccp_v6_rcv(struct sk_buff **pskb)
/* /*
* Step 2: * Step 2:
* ... or S.state == TIMEWAIT, * ... or S.state == TIMEWAIT,
* Generate Reset(No Connection) unless P.type == Reset * Generate Reset(No Connection) unless P.type == Reset
* Drop packet and return * Drop packet and return
*/ */
...@@ -872,8 +872,8 @@ static int dccp_v6_rcv(struct sk_buff **pskb) ...@@ -872,8 +872,8 @@ static int dccp_v6_rcv(struct sk_buff **pskb)
/* /*
* RFC 4340, sec. 9.2.1: Minimum Checksum Coverage * RFC 4340, sec. 9.2.1: Minimum Checksum Coverage
* o if MinCsCov = 0, only packets with CsCov = 0 are accepted * o if MinCsCov = 0, only packets with CsCov = 0 are accepted
* o if MinCsCov > 0, also accept packets with CsCov >= MinCsCov * o if MinCsCov > 0, also accept packets with CsCov >= MinCsCov
*/ */
min_cov = dccp_sk(sk)->dccps_pcrlen; min_cov = dccp_sk(sk)->dccps_pcrlen;
if (dh->dccph_cscov && (min_cov == 0 || dh->dccph_cscov < min_cov)) { if (dh->dccph_cscov && (min_cov == 0 || dh->dccph_cscov < min_cov)) {
...@@ -893,7 +893,7 @@ no_dccp_socket: ...@@ -893,7 +893,7 @@ no_dccp_socket:
goto discard_it; goto discard_it;
/* /*
* Step 2: * Step 2:
* If no socket ... * If no socket ...
* Generate Reset(No Connection) unless P.type == Reset * Generate Reset(No Connection) unless P.type == Reset
* Drop packet and return * Drop packet and return
*/ */
......
...@@ -182,7 +182,7 @@ out_free: ...@@ -182,7 +182,7 @@ out_free:
EXPORT_SYMBOL_GPL(dccp_create_openreq_child); EXPORT_SYMBOL_GPL(dccp_create_openreq_child);
/* /*
* Process an incoming packet for RESPOND sockets represented * Process an incoming packet for RESPOND sockets represented
* as an request_sock. * as an request_sock.
*/ */
......
/* /*
* net/dccp/output.c * net/dccp/output.c
* *
* An implementation of the DCCP protocol * An implementation of the DCCP protocol
* Arnaldo Carvalho de Melo <acme@conectiva.com.br> * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* *
...@@ -338,7 +338,6 @@ EXPORT_SYMBOL_GPL(dccp_make_response); ...@@ -338,7 +338,6 @@ EXPORT_SYMBOL_GPL(dccp_make_response);
static struct sk_buff *dccp_make_reset(struct sock *sk, struct dst_entry *dst, static struct sk_buff *dccp_make_reset(struct sock *sk, struct dst_entry *dst,
const enum dccp_reset_codes code) const enum dccp_reset_codes code)
{ {
struct dccp_hdr *dh; struct dccp_hdr *dh;
struct dccp_sock *dp = dccp_sk(sk); struct dccp_sock *dp = dccp_sk(sk);
...@@ -419,14 +418,14 @@ static inline void dccp_connect_init(struct sock *sk) ...@@ -419,14 +418,14 @@ static inline void dccp_connect_init(struct sock *sk)
dccp_sync_mss(sk, dst_mtu(dst)); dccp_sync_mss(sk, dst_mtu(dst));
/* /*
* SWL and AWL are initially adjusted so that they are not less than * SWL and AWL are initially adjusted so that they are not less than
* the initial Sequence Numbers received and sent, respectively: * the initial Sequence Numbers received and sent, respectively:
* SWL := max(GSR + 1 - floor(W/4), ISR), * SWL := max(GSR + 1 - floor(W/4), ISR),
* AWL := max(GSS - W' + 1, ISS). * AWL := max(GSS - W' + 1, ISS).
* These adjustments MUST be applied only at the beginning of the * These adjustments MUST be applied only at the beginning of the
* connection. * connection.
*/ */
dccp_update_gss(sk, dp->dccps_iss); dccp_update_gss(sk, dp->dccps_iss);
dccp_set_seqno(&dp->dccps_awl, max48(dp->dccps_awl, dp->dccps_iss)); dccp_set_seqno(&dp->dccps_awl, max48(dp->dccps_awl, dp->dccps_iss));
......
...@@ -196,7 +196,7 @@ int dccp_init_sock(struct sock *sk, const __u8 ctl_sock_initialized) ...@@ -196,7 +196,7 @@ int dccp_init_sock(struct sock *sk, const __u8 ctl_sock_initialized)
sk, GFP_KERNEL); sk, GFP_KERNEL);
dp->dccps_hc_tx_ccid = ccid_hc_tx_new(dmsk->dccpms_tx_ccid, dp->dccps_hc_tx_ccid = ccid_hc_tx_new(dmsk->dccpms_tx_ccid,
sk, GFP_KERNEL); sk, GFP_KERNEL);
if (unlikely(dp->dccps_hc_rx_ccid == NULL || if (unlikely(dp->dccps_hc_rx_ccid == NULL ||
dp->dccps_hc_tx_ccid == NULL)) { dp->dccps_hc_tx_ccid == NULL)) {
ccid_hc_rx_delete(dp->dccps_hc_rx_ccid, sk); ccid_hc_rx_delete(dp->dccps_hc_rx_ccid, sk);
ccid_hc_tx_delete(dp->dccps_hc_tx_ccid, sk); ccid_hc_tx_delete(dp->dccps_hc_tx_ccid, sk);
...@@ -390,7 +390,7 @@ static int dccp_setsockopt_service(struct sock *sk, const __be32 service, ...@@ -390,7 +390,7 @@ static int dccp_setsockopt_service(struct sock *sk, const __be32 service,
struct dccp_sock *dp = dccp_sk(sk); struct dccp_sock *dp = dccp_sk(sk);
struct dccp_service_list *sl = NULL; struct dccp_service_list *sl = NULL;
if (service == DCCP_SERVICE_INVALID_VALUE || if (service == DCCP_SERVICE_INVALID_VALUE ||
optlen > DCCP_SERVICE_LIST_MAX_LEN * sizeof(u32)) optlen > DCCP_SERVICE_LIST_MAX_LEN * sizeof(u32))
return -EINVAL; return -EINVAL;
...@@ -830,7 +830,7 @@ EXPORT_SYMBOL_GPL(inet_dccp_listen); ...@@ -830,7 +830,7 @@ EXPORT_SYMBOL_GPL(inet_dccp_listen);
static const unsigned char dccp_new_state[] = { static const unsigned char dccp_new_state[] = {
/* current state: new state: action: */ /* current state: new state: action: */
[0] = DCCP_CLOSED, [0] = DCCP_CLOSED,
[DCCP_OPEN] = DCCP_CLOSING | DCCP_ACTION_FIN, [DCCP_OPEN] = DCCP_CLOSING | DCCP_ACTION_FIN,
[DCCP_REQUESTING] = DCCP_CLOSED, [DCCP_REQUESTING] = DCCP_CLOSED,
[DCCP_PARTOPEN] = DCCP_CLOSING | DCCP_ACTION_FIN, [DCCP_PARTOPEN] = DCCP_CLOSING | DCCP_ACTION_FIN,
[DCCP_LISTEN] = DCCP_CLOSED, [DCCP_LISTEN] = DCCP_CLOSED,
......
/* /*
* net/dccp/timer.c * net/dccp/timer.c
* *
* An implementation of the DCCP protocol * An implementation of the DCCP protocol
* Arnaldo Carvalho de Melo <acme@conectiva.com.br> * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* *
...@@ -102,13 +102,13 @@ static void dccp_retransmit_timer(struct sock *sk) ...@@ -102,13 +102,13 @@ static void dccp_retransmit_timer(struct sock *sk)
* sk->sk_send_head has to have one skb with * sk->sk_send_head has to have one skb with
* DCCP_SKB_CB(skb)->dccpd_type set to one of the retransmittable DCCP * DCCP_SKB_CB(skb)->dccpd_type set to one of the retransmittable DCCP
* packet types. The only packets eligible for retransmission are: * packet types. The only packets eligible for retransmission are:
* -- Requests in client-REQUEST state (sec. 8.1.1) * -- Requests in client-REQUEST state (sec. 8.1.1)
* -- Acks in client-PARTOPEN state (sec. 8.1.5) * -- Acks in client-PARTOPEN state (sec. 8.1.5)
* -- CloseReq in server-CLOSEREQ state (sec. 8.3) * -- CloseReq in server-CLOSEREQ state (sec. 8.3)
* -- Close in node-CLOSING state (sec. 8.3) */ * -- Close in node-CLOSING state (sec. 8.3) */
BUG_TRAP(sk->sk_send_head != NULL); BUG_TRAP(sk->sk_send_head != NULL);
/* /*
* More than than 4MSL (8 minutes) has passed, a RESET(aborted) was * More than than 4MSL (8 minutes) has passed, a RESET(aborted) was
* sent, no need to retransmit, this sock is dead. * sent, no need to retransmit, this sock is dead.
*/ */
...@@ -200,7 +200,7 @@ static void dccp_keepalive_timer(unsigned long data) ...@@ -200,7 +200,7 @@ static void dccp_keepalive_timer(unsigned long data)
/* Only process if socket is not in use. */ /* Only process if socket is not in use. */
bh_lock_sock(sk); bh_lock_sock(sk);
if (sock_owned_by_user(sk)) { if (sock_owned_by_user(sk)) {
/* Try again later. */ /* Try again later. */
inet_csk_reset_keepalive_timer(sk, HZ / 20); inet_csk_reset_keepalive_timer(sk, HZ / 20);
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment