All of lore.kernel.org
 help / color / mirror / Atom feed
* dccp test-tree [RFC] [Patch 1/1] dccp: Only activate NN values
@ 2011-02-28 11:25 ` Gerrit Renker
  0 siblings, 0 replies; 22+ messages in thread
From: Gerrit Renker @ 2011-02-28 11:25 UTC (permalink / raw)
  To: dccp

I am sending this as RFC since I have not yet deeply tested this. It makes
the exchange of NN options in established state conform to RFC 4340, 6.6.1
and thus actually is a bug fix.

>>>>>>>>>>>>>>>>>>>>>>>>> Patch <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
dccp: Only activate NN values after receiving the Confirm option

This defers changing local values using exchange of NN options in established
connection state by only activating the value after receiving the Confirm
option, as mandated by RFC 4340, 6.6.1.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
---
 net/dccp/ccids/ccid2.c |    7 ++-----
 net/dccp/feat.c        |   13 ++++---------
 2 files changed, 6 insertions(+), 14 deletions(-)

--- a/net/dccp/feat.c
+++ b/net/dccp/feat.c
@@ -775,12 +775,7 @@ int dccp_feat_register_sp(struct sock *s
  * @sk: DCCP socket of an established connection
  * @feat: NN feature number from %dccp_feature_numbers
  * @nn_val: the new value to use
- * This function is used to communicate NN updates out-of-band. The difference
- * to feature negotiation during connection setup is that values are activated
- * immediately after validation, i.e. we don't wait for the Confirm: either the
- * value is accepted by the peer (and then the waiting is futile), or it is not
- * (Reset or empty Confirm). We don't accept empty Confirms - transmitted values
- * are validated, and the peer "MUST accept any valid value" (RFC 4340, 6.3.2).
+ * This function is used to communicate NN updates out-of-band.
  */
 int dccp_feat_signal_nn_change(struct sock *sk, u8 feat, u64 nn_val)
 {
@@ -805,9 +800,6 @@ int dccp_feat_signal_nn_change(struct so
 		dccp_feat_list_pop(entry);
 	}
 
-	if (dccp_feat_activate(sk, feat, 1, &fval))
-		return -EADV;
-
 	inet_csk_schedule_ack(sk);
 	return dccp_feat_push_change(fn, feat, 1, 0, &fval);
 }
@@ -1356,6 +1348,9 @@ static u8 dccp_feat_handle_nn_establishe
 		if (fval.nn != entry->val.nn)
 			return 0;
 
+		/* Only activate after receiving the Confirm option (6.6.1). */
+		dccp_feat_activate(sk, feat, local, &fval);
+
 		/* It has been confirmed - so remove the entry */
 		dccp_feat_list_pop(entry);
 
--- a/net/dccp/ccids/ccid2.c
+++ b/net/dccp/ccids/ccid2.c
@@ -105,7 +105,6 @@ static void ccid2_change_l_ack_ratio(str
 		return;
 
 	ccid2_pr_debug("changing local ack ratio to %u\n", val);
-	dp->dccps_l_ack_ratio = val;
 	dccp_feat_signal_nn_change(sk, DCCPF_ACK_RATIO, val);
 }
 
@@ -117,11 +116,9 @@ static void ccid2_change_l_seq_window(st
 		val = DCCPF_SEQ_WMIN;
 	if (val > DCCPF_SEQ_WMAX)
 		val = DCCPF_SEQ_WMAX;
-	if (val = dp->dccps_l_seq_win)
-		return;
 
-	dp->dccps_l_seq_win = val;
-	dccp_feat_signal_nn_change(sk, DCCPF_SEQUENCE_WINDOW, val);
+	if (val != dp->dccps_l_seq_win)
+		dccp_feat_signal_nn_change(sk, DCCPF_SEQUENCE_WINDOW, val);
 }
 
 static void ccid2_hc_tx_rto_expire(unsigned long data)

-- 

^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: dccp test-tree [RFC] [Patch 2/2] dccp: CCID2 check ack ratio
  2011-03-11 11:30   ` dccp test-tree [RFC] [Patch 1/1] dccp: Only activate NN values after receiving the Confirm option Gerrit Renker
@ 2011-03-15  4:53 ` Samuel Jero
  -1 siblings, 0 replies; 22+ messages in thread
From: Samuel Jero @ 2011-03-15  4:53 UTC (permalink / raw)
  To: dccp

[-- Attachment #1: Type: text/plain, Size: 2541 bytes --]

This patch causes CCID2 to check the ack ratio after reducing the
congestion window. If the ack ratio is greater than the congestion
window, it is reduced. This prevents timeouts caused by an ack ratio
larger than the congestion window. 

In this situation, we choose to set the ack ratio to half the congestion
window (or one if that's zero) so that if we loose one ack we don't
trigger a timeout.

--- 
Signed-off-by: Samuel Jero
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c
index 1475ba3..b7f7dbd 100644
--- a/net/dccp/ccids/ccid2.c
+++ b/net/dccp/ccids/ccid2.c
@@ -118,4 +118,22 @@ static void ccid2_change_l_seq_window(struct sock *sk, u64 val)
 		dccp_feat_signal_nn_change(sk, DCCPF_SEQUENCE_WINDOW, val);
 }
+
+static void ccid2_check_l_ack_ratio(struct sock *sk)
+{
+	struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
+
+	/*
+	* After a loss, idle period, application limited period, or RTO we
+	* need tocheck that the ack ratio is still less than the congestion
+	* window. Otherwise, we will send an entire congestion window of
+	* packets and got no response because we haven't sent ack ratio
+	* packets yet.
+	* If the ack ratio does need to be reduced, we reduce it to half of
+	* the congestion window (or 1 if that's zero) instead of to the
+	* congestion window. This prevents problems if one ack is lost.
+	*/
+	if (dccp_feat_get_nn_next_val(sk, DCCPF_ACK_RATIO) > hc->tx_cwnd)
+		ccid2_change_l_ack_ratio(sk, hc->tx_cwnd/2 ? : 1U);
+}
 
 static void ccid2_hc_tx_rto_expire(unsigned long data)
@@ -203,6 +214,8 @@ static void ccid2_cwnd_application_limited(struct sock *sk, const u32 now)
 	}
 	hc->tx_cwnd_used  = 0;
 	hc->tx_cwnd_stamp = now;
+
+	ccid2_check_l_ack_ratio(sk);
 }
 
 /* This borrows the code of tcp_cwnd_restart() */
@@ -221,6 +234,8 @@ static void ccid2_cwnd_restart(struct sock *sk, const u32 now)
 
 	hc->tx_cwnd_stamp = now;
 	hc->tx_cwnd_used  = 0;
+
+	ccid2_check_l_ack_ratio(sk);
 }
 
 static void ccid2_hc_tx_packet_sent(struct sock *sk, unsigned int len)
@@ -490,9 +505,7 @@ static void ccid2_congestion_event(struct sock *sk, struct ccid2_seq *seqp)
 	hc->tx_cwnd      = hc->tx_cwnd / 2 ? : 1U;
 	hc->tx_ssthresh  = max(hc->tx_cwnd, 2U);
 
-	/* Avoid spurious timeouts resulting from Ack Ratio > cwnd */
-	if (dccp_sk(sk)->dccps_l_ack_ratio > hc->tx_cwnd)
-		ccid2_change_l_ack_ratio(sk, hc->tx_cwnd);
+	ccid2_check_l_ack_ratio(sk);
 }
 
 static int ccid2_hc_tx_parse_options(struct sock *sk, u8 packet_type,


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2011-03-25 11:39 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-28 11:25 dccp test-tree [RFC] [Patch 1/1] dccp: Only activate NN values Gerrit Renker
2011-02-28 11:25 ` dccp test-tree [RFC] [Patch 1/1] dccp: Only activate NN values after receiving the Confirm option Gerrit Renker
2011-03-08  4:50 ` dccp test-tree [RFC] [Patch 1/1] dccp: Only activate NN values Samuel Jero
2011-03-08  4:50   ` dccp test-tree [RFC] [Patch 1/1] dccp: Only activate NN values after receiving the Confirm option Samuel Jero
2011-03-11 11:30 ` dccp test-tree [RFC] [Patch 1/1] dccp: Only activate NN values Gerrit Renker
2011-03-11 11:30   ` dccp test-tree [RFC] [Patch 1/1] dccp: Only activate NN values after receiving the Confirm option Gerrit Renker
2011-03-13 20:34 ` dccp test-tree [RFC] [Patch 1/1] dccp: Only activate NN values Samuel Jero
2011-03-13 20:34   ` dccp test-tree [RFC] [Patch 1/1] dccp: Only activate NN values after receiving the Confirm option Samuel Jero
2011-03-14 11:55 ` dccp test-tree [RFC] [Patch 1/1] dccp: Only activate NN values Gerrit Renker
2011-03-14 11:55   ` dccp test-tree [RFC] [Patch 1/1] dccp: Only activate NN values after receiving the Confirm option Gerrit Renker
2011-03-15  4:53 ` dccp test-tree [RFC] [Patch 1/1] dccp: Only activate NN values Samuel Jero
2011-03-15  4:53   ` dccp test-tree [RFC] [Patch 1/1] dccp: Only activate NN values after receiving the Confirm option Samuel Jero
2011-03-18 11:30 ` dccp test-tree [RFC] [Patch 1/1] dccp: Only activate NN values Gerrit Renker
2011-03-18 11:30   ` dccp test-tree [RFC] [Patch 1/1] dccp: Only activate NN values after receiving the Confirm option Gerrit Renker
2011-03-22  1:49 ` dccp test-tree [RFC] [Patch 1/1] dccp: Only activate NN values Samuel Jero
2011-03-22  1:49   ` dccp test-tree [RFC] [Patch 1/1] dccp: Only activate NN values after receiving the Confirm option Samuel Jero
2011-03-25 11:39 ` dccp test-tree [RFC] [Patch 1/1] dccp: Only activate NN values Gerrit Renker
2011-03-25 11:39   ` dccp test-tree [RFC] [Patch 1/1] dccp: Only activate NN values after receiving the Confirm option Gerrit Renker
  -- strict thread matches above, loose matches on Subject: below --
2011-03-15  4:53 dccp test-tree [RFC] [Patch 2/2] dccp: CCID2 check ack ratio Samuel Jero
2011-03-15  4:53 ` dccp test-tree [RFC] [Patch 2/2] dccp: CCID2 check ack ratio when reducing cwnd Samuel Jero
2011-03-18 11:33 ` dccp test-tree [RFC] [Patch 2/2] dccp: CCID2 check ack ratio Gerrit Renker
2011-03-18 11:33   ` dccp test-tree [RFC] [Patch 2/2] dccp: CCID2 check ack ratio when reducing cwnd Gerrit Renker

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.