All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 11/25] Share TFRC sender states via tfrc_ccids
@ 2007-11-01  0:31 Leandro
  2007-11-01 12:27 ` Tommi Saviranta
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Leandro @ 2007-11-01  0:31 UTC (permalink / raw)
  To: dccp

[CCID-3/4] Share TFRC sender states via tfrc_ccids

Signed-off-by: Leandro Melo de Sales <leandro@embedded.ufcg.edu.br>

Index: leandro.new/net/dccp/ccids/ccid3.c
=================================--- leandro.new.orig/net/dccp/ccids/ccid3.c
+++ leandro.new/net/dccp/ccids/ccid3.c
@@ -52,7 +52,7 @@ DECLARE_TFRC_TX_CACHE(ccid3_tx_hist);
  *	Transmitter Half-Connection Routines
  */
 #ifdef CONFIG_IP_DCCP_CCID3_DEBUG
-static const char *ccid3_tx_state_name(enum ccid3_hc_tx_states state)
+static const char *ccid3_tx_state_name(enum tfrc_hc_tx_states state)
 {
 	static char *ccid3_state_names[] = {
 	[TFRC_SSTATE_NO_SENT]  = "NO_SENT",
@@ -66,16 +66,16 @@ static const char *ccid3_tx_state_name(e
 #endif
 
 static void ccid3_hc_tx_set_state(struct sock *sk,
-				  enum ccid3_hc_tx_states state)
+				  enum tfrc_hc_tx_states state)
 {
 	struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
-	enum ccid3_hc_tx_states oldstate = hctx->ccid3hctx_state;
+	enum tfrc_hc_tx_states oldstate = hctx->tfrchctx_state;
 
 	ccid3_pr_debug("%s(%p) %-8.8s -> %s\n",
 		       dccp_role(sk), sk, ccid3_tx_state_name(oldstate),
 		       ccid3_tx_state_name(state));
 	WARN_ON(state = oldstate);
-	hctx->ccid3hctx_state = state;
+	hctx->tfrchctx_state = state;
 }
 
 /*
@@ -229,11 +229,11 @@ static void ccid3_hc_tx_no_feedback_time
 	}
 
 	ccid3_pr_debug("%s(%p, state=%s) - entry \n", dccp_role(sk), sk,
-		       ccid3_tx_state_name(hctx->ccid3hctx_state));
+		       ccid3_tx_state_name(hctx->tfrchctx_state));
 
-	if (hctx->ccid3hctx_state = TFRC_SSTATE_FBACK)
+	if (hctx->tfrchctx_state = TFRC_SSTATE_FBACK)
 		ccid3_hc_tx_set_state(sk, TFRC_SSTATE_NO_FBACK);
-	else if (hctx->ccid3hctx_state != TFRC_SSTATE_NO_FBACK)
+	else if (hctx->tfrchctx_state != TFRC_SSTATE_NO_FBACK)
 		goto out;
 
 	/*
@@ -312,7 +312,7 @@ static int ccid3_hc_tx_send_packet(struc
 	if (unlikely(skb->len = 0))
 		return -EBADMSG;
 
-	switch (hctx->ccid3hctx_state) {
+	switch (hctx->tfrchctx_state) {
 	case TFRC_SSTATE_NO_SENT:
 		sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer,
 			       (jiffies +
@@ -401,7 +401,7 @@ static void ccid3_hc_tx_packet_recv(stru
 		return;
 
 	/* ... and only in the established state */
-	switch (hctx->ccid3hctx_state) {
+	switch (hctx->tfrchctx_state) {
 	case TFRC_SSTATE_NO_FBACK:	/* fall through */
 	case TFRC_SSTATE_FBACK:		break;
 	default:			return;
@@ -439,7 +439,7 @@ static void ccid3_hc_tx_packet_recv(stru
 	/*
 	 *	Update allowed sending rate X as per draft rfc3448bis-00, 4.2/3
 	 */
-	if (hctx->ccid3hctx_state = TFRC_SSTATE_NO_FBACK) {
+	if (hctx->tfrchctx_state = TFRC_SSTATE_NO_FBACK) {
 
 		ccid3_hc_tx_set_state(sk, TFRC_SSTATE_FBACK);
 
@@ -573,7 +573,7 @@ static int ccid3_hc_tx_init(struct ccid 
 {
 	struct ccid3_hc_tx_sock *hctx = ccid_priv(ccid);
 
-	hctx->ccid3hctx_state = TFRC_SSTATE_NO_SENT;
+	hctx->tfrchctx_state = TFRC_SSTATE_NO_SENT;
 	tfrc_tx_hist_init(&hctx->ccid3hctx_hist, ccid3_tx_hist);
 
 	hctx->ccid3hctx_no_feedback_timer.function Index: leandro.new/net/dccp/ccids/ccid3.h
=================================--- leandro.new.orig/net/dccp/ccids/ccid3.h
+++ leandro.new/net/dccp/ccids/ccid3.h
@@ -39,14 +39,6 @@
 #include "lib/tfrc_ccids.h"
 #include "../ccid.h"
 
-/* TFRC sender states */
-enum ccid3_hc_tx_states {
-	TFRC_SSTATE_NO_SENT = 1,
-	TFRC_SSTATE_NO_FBACK,
-	TFRC_SSTATE_FBACK,
-	TFRC_SSTATE_TERM,
-};
-
 /** struct ccid3_hc_tx_sock - CCID3 sender half-connection socket
  *
  * @ccid3hctx_x - Current sending rate in 64 * bytes per second
@@ -57,7 +49,7 @@ enum ccid3_hc_tx_states {
  * @ccid3hctx_s - Packet size in bytes
  * @ccid3hctx_t_rto - Nofeedback Timer setting in usecs
  * @ccid3hctx_t_ipi - Interpacket (send) interval (RFC 3448, 4.6) in usecs
- * @ccid3hctx_state - Sender state, one of %ccid3_hc_tx_states
+ * @tfrchctx_state - Sender state, one of %tfrc_hc_tx_states
  * @ccid3hctx_last_win_count - Last window counter sent
  * @ccid3hctx_t_last_win_count - Timestamp of earliest packet
  *				 with last_win_count value sent
@@ -78,7 +70,7 @@ struct ccid3_hc_tx_sock {
 #define ccid3hctx_t_rto			ccid3hctx_tfrc.tfrctx_rto
 #define ccid3hctx_t_ipi			ccid3hctx_tfrc.tfrctx_ipi
 	u16				ccid3hctx_s;
-	enum ccid3_hc_tx_states		ccid3hctx_state:8;
+	enum tfrc_hc_tx_states	tfrchctx_state:8;
 	u8				ccid3hctx_last_win_count;
 	ktime_t				ccid3hctx_t_last_win_count;
 	struct timer_list		ccid3hctx_no_feedback_timer;
Index: leandro.new/net/dccp/ccids/ccid4.c
=================================--- leandro.new.orig/net/dccp/ccids/ccid4.c
+++ leandro.new/net/dccp/ccids/ccid4.c
@@ -62,7 +62,7 @@ DECLARE_TFRC_TX_CACHE(ccid4_tx_hist);
  *	Transmitter Half-Connection Routines
  */
 #ifdef CONFIG_IP_DCCP_CCID4_DEBUG
-static const char *ccid4_tx_state_name(enum ccid4_hc_tx_states state)
+static const char *ccid4_tx_state_name(enum tfrc_hc_tx_states state)
 {
 	static char *ccid4_state_names[] = {
 	[TFRC_SSTATE_NO_SENT]  = "NO_SENT",
@@ -76,16 +76,16 @@ static const char *ccid4_tx_state_name(e
 #endif
 
 static void ccid4_hc_tx_set_state(struct sock *sk,
-				  enum ccid4_hc_tx_states state)
+				  enum tfrc_hc_tx_states state)
 {
 	struct ccid4_hc_tx_sock *hctx = ccid4_hc_tx_sk(sk);
-	enum ccid4_hc_tx_states oldstate = hctx->ccid4hctx_state;
+	enum tfrc_hc_tx_states oldstate = hctx->tfrchctx_state;
 
 	ccid4_pr_debug("%s(%p) %-8.8s -> %s\n",
 		       dccp_role(sk), sk, ccid4_tx_state_name(oldstate),
 		       ccid4_tx_state_name(state));
 	WARN_ON(state = oldstate);
-	hctx->ccid4hctx_state = state;
+	hctx->tfrchctx_state = state;
 }
 
 /*
@@ -255,11 +255,11 @@ static void ccid4_hc_tx_no_feedback_time
 	}
 
 	ccid4_pr_debug("%s(%p, state=%s) - entry \n", dccp_role(sk), sk,
-		       ccid4_tx_state_name(hctx->ccid4hctx_state));
+		       ccid4_tx_state_name(hctx->tfrchctx_state));
 
-	if (hctx->ccid4hctx_state = TFRC_SSTATE_FBACK)
+	if (hctx->tfrchctx_state = TFRC_SSTATE_FBACK)
 		ccid4_hc_tx_set_state(sk, TFRC_SSTATE_NO_FBACK);
-	else if (hctx->ccid4hctx_state != TFRC_SSTATE_NO_FBACK)
+	else if (hctx->tfrchctx_state != TFRC_SSTATE_NO_FBACK)
 		goto out;
 
 	/*
@@ -338,7 +338,7 @@ static int ccid4_hc_tx_send_packet(struc
 	if (unlikely(skb->len = 0))
 		return -EBADMSG;
 
-	switch (hctx->ccid4hctx_state) {
+	switch (hctx->tfrchctx_state) {
 	case TFRC_SSTATE_NO_SENT:
 		sk_reset_timer(sk, &hctx->ccid4hctx_no_feedback_timer,
 			       (jiffies +
@@ -427,7 +427,7 @@ static void ccid4_hc_tx_packet_recv(stru
 		return;
 
 	/* ... and only in the established state */
-	switch (hctx->ccid4hctx_state) {
+	switch (hctx->tfrchctx_state) {
 	case TFRC_SSTATE_NO_FBACK:	/* fall through */
 	case TFRC_SSTATE_FBACK:		break;
 	default:			return;
@@ -465,7 +465,7 @@ static void ccid4_hc_tx_packet_recv(stru
 	/*
 	 *	Update allowed sending rate X as per draft rfc3448bis-00, 4.2/3
 	 */
-	if (hctx->ccid4hctx_state = TFRC_SSTATE_NO_FBACK) {
+	if (hctx->tfrchctx_state = TFRC_SSTATE_NO_FBACK) {
 
 		ccid4_hc_tx_set_state(sk, TFRC_SSTATE_FBACK);
 
@@ -599,7 +599,7 @@ static int ccid4_hc_tx_init(struct ccid 
 {
 	struct ccid4_hc_tx_sock *hctx = ccid_priv(ccid);
 
-	hctx->ccid4hctx_state = TFRC_SSTATE_NO_SENT;
+	hctx->tfrchctx_state = TFRC_SSTATE_NO_SENT;
 	tfrc_tx_hist_init(&hctx->ccid4hctx_hist, ccid4_tx_hist);
 
 	hctx->ccid4hctx_no_feedback_timer.function Index: leandro.new/net/dccp/ccids/ccid4.h
=================================--- leandro.new.orig/net/dccp/ccids/ccid4.h
+++ leandro.new/net/dccp/ccids/ccid4.h
@@ -62,14 +62,6 @@
  */
 #define CCID4HCTX_H    36
 
-/* TFRC sender states */
-enum ccid4_hc_tx_states {
-	TFRC_SSTATE_NO_SENT = 1,
-	TFRC_SSTATE_NO_FBACK,
-	TFRC_SSTATE_FBACK,
-	TFRC_SSTATE_TERM,
-};
-
 /** struct ccid4_hc_tx_sock - CCID4 sender half-connection socket
  *
  * @ccid4hctx_x - Current sending rate in 64 * bytes per second
@@ -80,7 +72,7 @@ enum ccid4_hc_tx_states {
  * @ccid4hctx_s - Packet size in bytes
  * @ccid4hctx_t_rto - Nofeedback Timer setting in usecs
  * @ccid4hctx_t_ipi - Interpacket (send) interval (RFC 3448, 4.6) in usecs
- * @ccid4hctx_state - Sender state, one of %ccid4_hc_tx_states
+ * @tfrchctx_state - Sender state, one of %tfrc_hc_tx_states
  * @ccid4hctx_last_win_count - Last window counter sent
  * @ccid4hctx_t_last_win_count - Timestamp of earliest packet
  *				 with last_win_count value sent
@@ -101,7 +93,7 @@ struct ccid4_hc_tx_sock {
 #define ccid4hctx_t_rto			ccid4hctx_tfrc.tfrctx_rto
 #define ccid4hctx_t_ipi			ccid4hctx_tfrc.tfrctx_ipi
 	u16				ccid4hctx_s;
-	enum ccid4_hc_tx_states		ccid4hctx_state:8;
+	enum tfrc_hc_tx_states	tfrchctx_state:8;
 	u8				ccid4hctx_last_win_count;
 	ktime_t				ccid4hctx_t_last_win_count;
 	struct timer_list		ccid4hctx_no_feedback_timer;
Index: leandro.new/net/dccp/ccids/lib/tfrc_ccids.h
=================================--- leandro.new.orig/net/dccp/ccids/lib/tfrc_ccids.h
+++ leandro.new/net/dccp/ccids/lib/tfrc_ccids.h
@@ -45,3 +45,12 @@ struct tfrc_options_received {
 	u32 tfrcor_loss_event_rate;
 	u32 tfrcor_receive_rate;
 };
+
+/* TFRC sender states */
+enum tfrc_hc_tx_states {
+	TFRC_SSTATE_NO_SENT = 1,
+	TFRC_SSTATE_NO_FBACK,
+	TFRC_SSTATE_FBACK,
+	TFRC_SSTATE_TERM,
+};
+

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

* Re: [PATCH 11/25] Share TFRC sender states via tfrc_ccids
  2007-11-01  0:31 [PATCH 11/25] Share TFRC sender states via tfrc_ccids Leandro
@ 2007-11-01 12:27 ` Tommi Saviranta
  2007-11-04 17:39 ` Ian McDonald
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Tommi Saviranta @ 2007-11-01 12:27 UTC (permalink / raw)
  To: dccp

On Wed, Oct 31, 2007 at 21:31:02 -0300, Leandro wrote:
> [CCID-3/4] Share TFRC sender states via tfrc_ccids
> 
> Signed-off-by: Leandro Melo de Sales <leandro@embedded.ufcg.edu.br>

Acked-by: Tommi Saviranta <wnd@iki.fi>


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

* Re: [PATCH 11/25] Share TFRC sender states via tfrc_ccids
  2007-11-01  0:31 [PATCH 11/25] Share TFRC sender states via tfrc_ccids Leandro
  2007-11-01 12:27 ` Tommi Saviranta
@ 2007-11-04 17:39 ` Ian McDonald
  2007-11-04 17:39 ` Ian McDonald
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ian McDonald @ 2007-11-04 17:39 UTC (permalink / raw)
  To: dccp

On 11/1/07, Leandro <leandroal@gmail.com> wrote:
> [CCID-3/4] Share TFRC sender states via tfrc_ccids
>
> Signed-off-by: Leandro Melo de Sales <leandro@embedded.ufcg.edu.br>
>
Again you should make changes to ccid3.c before it is copied over to
reduce the size of this patch/make more sense

Ian

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

* Re: [PATCH 11/25] Share TFRC sender states via tfrc_ccids
  2007-11-01  0:31 [PATCH 11/25] Share TFRC sender states via tfrc_ccids Leandro
  2007-11-01 12:27 ` Tommi Saviranta
  2007-11-04 17:39 ` Ian McDonald
@ 2007-11-04 17:39 ` Ian McDonald
  2007-11-08 10:21 ` Gerrit Renker
  2007-11-13 16:33 ` Łeandro Sales
  4 siblings, 0 replies; 6+ messages in thread
From: Ian McDonald @ 2007-11-04 17:39 UTC (permalink / raw)
  To: dccp

On 11/2/07, Tommi Saviranta <wnd@iki.fi> wrote:
> On Wed, Oct 31, 2007 at 21:31:02 -0300, Leandro wrote:
> > [CCID-3/4] Share TFRC sender states via tfrc_ccids
> >
> > Signed-off-by: Leandro Melo de Sales <leandro@embedded.ufcg.edu.br>
>
> Acked-by: Tommi Saviranta <wnd@iki.fi>
>
> -
> To unsubscribe from this list: send the line "unsubscribe dccp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


-- 
Web1: http://wand.net.nz/~iam4/
Web2: http://www.jandi.co.nz
Blog: http://iansblog.jandi.co.nz

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

* Re: [PATCH 11/25] Share TFRC sender states via tfrc_ccids
  2007-11-01  0:31 [PATCH 11/25] Share TFRC sender states via tfrc_ccids Leandro
                   ` (2 preceding siblings ...)
  2007-11-04 17:39 ` Ian McDonald
@ 2007-11-08 10:21 ` Gerrit Renker
  2007-11-13 16:33 ` Łeandro Sales
  4 siblings, 0 replies; 6+ messages in thread
From: Gerrit Renker @ 2007-11-08 10:21 UTC (permalink / raw)
  To: dccp

| @@ -76,16 +76,16 @@ static const char *ccid4_tx_state_name(e
|  #endif
|  
|  static void ccid4_hc_tx_set_state(struct sock *sk,
| -				  enum ccid4_hc_tx_states state)
| +				  enum tfrc_hc_tx_states state)
|  {
|  	struct ccid4_hc_tx_sock *hctx = ccid4_hc_tx_sk(sk);
| -	enum ccid4_hc_tx_states oldstate = hctx->ccid4hctx_state;
| +	enum tfrc_hc_tx_states oldstate = hctx->tfrchctx_state;
|  
|  	ccid4_pr_debug("%s(%p) %-8.8s -> %s\n",
|  		       dccp_role(sk), sk, ccid4_tx_state_name(oldstate),
|  		       ccid4_tx_state_name(state));
|  	WARN_ON(state = oldstate);
| -	hctx->ccid4hctx_state = state;
| +	hctx->tfrchctx_state = state;
|  }
|  
I think this function is a candidate for sharing: no need to keep
this function separate for CCID3/4 when both use the same enum of
states; i.e. the function could be written tfrc_hc_tx_set_state().

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

* Re: [PATCH 11/25] Share TFRC sender states via tfrc_ccids
  2007-11-01  0:31 [PATCH 11/25] Share TFRC sender states via tfrc_ccids Leandro
                   ` (3 preceding siblings ...)
  2007-11-08 10:21 ` Gerrit Renker
@ 2007-11-13 16:33 ` Łeandro Sales
  4 siblings, 0 replies; 6+ messages in thread
From: Łeandro Sales @ 2007-11-13 16:33 UTC (permalink / raw)
  To: dccp

2007/11/8, Gerrit Renker <gerrit@erg.abdn.ac.uk>:
> | @@ -76,16 +76,16 @@ static const char *ccid4_tx_state_name(e
> |  #endif
> |
> |  static void ccid4_hc_tx_set_state(struct sock *sk,
> | -                               enum ccid4_hc_tx_states state)
> | +                               enum tfrc_hc_tx_states state)
> |  {
> |       struct ccid4_hc_tx_sock *hctx = ccid4_hc_tx_sk(sk);
> | -     enum ccid4_hc_tx_states oldstate = hctx->ccid4hctx_state;
> | +     enum tfrc_hc_tx_states oldstate = hctx->tfrchctx_state;
> |
> |       ccid4_pr_debug("%s(%p) %-8.8s -> %s\n",
> |                      dccp_role(sk), sk, ccid4_tx_state_name(oldstate),
> |                      ccid4_tx_state_name(state));
> |       WARN_ON(state = oldstate);
> | -     hctx->ccid4hctx_state = state;
> | +     hctx->tfrchctx_state = state;
> |  }
> |
> I think this function is a candidate for sharing: no need to keep
> this function separate for CCID3/4 when both use the same enum of
> states; i.e. the function could be written tfrc_hc_tx_set_state().
> -
> To unsubscribe from this list: send the line "unsubscribe dccp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

Yes, I already have a patch to share this function.

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

end of thread, other threads:[~2007-11-13 16:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-01  0:31 [PATCH 11/25] Share TFRC sender states via tfrc_ccids Leandro
2007-11-01 12:27 ` Tommi Saviranta
2007-11-04 17:39 ` Ian McDonald
2007-11-04 17:39 ` Ian McDonald
2007-11-08 10:21 ` Gerrit Renker
2007-11-13 16:33 ` Łeandro Sales

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.