All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5/25] Enforces a minimum interval of 10 milliseconds as per CCID-4 draft
@ 2007-11-01  0:30 Leandro
  2007-11-03  1:00 ` Ian McDonald
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Leandro @ 2007-11-01  0:30 UTC (permalink / raw)
  To: dccp

[CCID-4] Enforces a minimum interval of 10 milliseconds as per CCID-4 draft

Signed-off-by: Leandro Melo de Sales <leandro@embedded.ufcg.edu.br>
Signed-off-by: Tommi Saviranta <wnd@iki.fi>

Index: leandro.new/net/dccp/ccids/ccid4.c
=================================--- leandro.new.orig/net/dccp/ccids/ccid4.c
+++ leandro.new/net/dccp/ccids/ccid4.c
@@ -111,9 +111,11 @@ static inline u64 rfc3390_initial_rate(s
  */
 static inline void ccid4_update_send_interval(struct ccid4_hc_tx_sock *hctx)
 {
-	/* Calculate new t_ipi = s / X_inst (X_inst is in 64 * bytes/second) */
-	hctx->ccid4hctx_t_ipi = scaled_div32(((u64)hctx->ccid4hctx_s) << 6,
-					     hctx->ccid4hctx_x);
+        /* Calculate new t_ipi = s / X_inst (X_inst is in 64 * bytes/second).
+         * TFRC-SP enforces a minimum interval of 10 milliseconds. */
+        hctx->ccid4hctx_t_ipi +              max_t(u32, scaled_div32(((u64)hctx->ccid4hctx_s) << 6,
+                                      hctx->ccid4hctx_x), MIN_SEND_RATE);
 
 	/* Calculate new delta by delta = min(t_ipi / 2, t_gran / 2) */
 	hctx->ccid4hctx_delta = min_t(u32, hctx->ccid4hctx_t_ipi / 2,
Index: leandro.new/net/dccp/ccids/ccid4.h
=================================--- leandro.new.orig/net/dccp/ccids/ccid4.h
+++ leandro.new/net/dccp/ccids/ccid4.h
@@ -68,6 +68,9 @@
 /* The nominal packet size to be used into TFRC equation as per CCID-4 draft*/
 #define NOM_PACKET_SIZE            1460
 
+/* Mininum sending rate as per CCID-4 draft */
+#define MIN_SEND_RATE              10000
+
 enum ccid4_options {
 	TFRC_OPT_LOSS_EVENT_RATE = 192,
 	TFRC_OPT_LOSS_INTERVALS	 = 193,

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

* Re: [PATCH 5/25] Enforces a minimum interval of 10 milliseconds as per CCID-4 draft
  2007-11-01  0:30 [PATCH 5/25] Enforces a minimum interval of 10 milliseconds as per CCID-4 draft Leandro
@ 2007-11-03  1:00 ` Ian McDonald
  2007-11-08 11:18 ` Gerrit Renker
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Ian McDonald @ 2007-11-03  1:00 UTC (permalink / raw)
  To: dccp

On 11/1/07, Leandro <leandroal@gmail.com> wrote:
> [CCID-4] Enforces a minimum interval of 10 milliseconds as per CCID-4 draft
>
> Signed-off-by: Leandro Melo de Sales <leandro@embedded.ufcg.edu.br>
> Signed-off-by: Tommi Saviranta <wnd@iki.fi>
>
Acked-by: Ian McDonald <ian.mcdonald@jandi.co.nz>

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

* Re: [PATCH 5/25] Enforces a minimum interval of 10 milliseconds as per CCID-4 draft
  2007-11-01  0:30 [PATCH 5/25] Enforces a minimum interval of 10 milliseconds as per CCID-4 draft Leandro
  2007-11-03  1:00 ` Ian McDonald
@ 2007-11-08 11:18 ` Gerrit Renker
  2007-11-09 21:11 ` [PATCH 5/25] Enforces a minimum interval of 10 milliseconds as Tommi Saviranta
  2007-11-13 16:19 ` [PATCH 5/25] Enforces a minimum interval of 10 milliseconds as per CCID-4 draft Łeandro Sales
  3 siblings, 0 replies; 5+ messages in thread
From: Gerrit Renker @ 2007-11-08 11:18 UTC (permalink / raw)
  To: dccp

| @@ -111,9 +111,11 @@ static inline u64 rfc3390_initial_rate(s
|   */
|  static inline void ccid4_update_send_interval(struct ccid4_hc_tx_sock *hctx)
|  {
| -	/* Calculate new t_ipi = s / X_inst (X_inst is in 64 * bytes/second) */
| -	hctx->ccid4hctx_t_ipi = scaled_div32(((u64)hctx->ccid4hctx_s) << 6,
| -					     hctx->ccid4hctx_x);
| +        /* Calculate new t_ipi = s / X_inst (X_inst is in 64 * bytes/second).
| +         * TFRC-SP enforces a minimum interval of 10 milliseconds. */
| +        hctx->ccid4hctx_t_ipi | +              max_t(u32, scaled_div32(((u64)hctx->ccid4hctx_s) << 6,
| +                                      hctx->ccid4hctx_x), MIN_SEND_RATE);
Whitespace - I have taken the liberty of replacing the above blanks with
tabs. Also a comment regarding comments: as far as I know the accepted
practice for multiline comments is

	/*
	 * comment text which extends over one line
	 * and another
	 */

While at it, I've done this also. Maybe the code would be clearer to read this way:

	hctx->ccid4hctx_t_ipi = scaled_div32(((u64)hctx->ccid4hctx_s) << 6,
					     hctx->ccid4hctx_x));
	if (hctx->ccid4hctx_t_ipi <  MIN_SEND_RATE)
		hctx->ccid4hctx_t_ipi = MIN_SEND_RATE;

This is one of the cases where the overly long tags `ccid4hctx_' are in	the way.
If we had c4tx, the above reads	

	hctx->c4tx_t_ipi = scaled_div32(((u64)hctx->c4tx_s) <<6, hctx->c4tx_x));
	if (hctx->c4tx_t_ipi <  MIN_SEND_RATE)
		hctx->c4tx_t_ipi = MIN_SEND_RATE;

So the problem is not your code, it is again these long identifiers. I
am overhauling the old CCID3 patch set, maybe this should be kept on the
todo list -- comments?

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

* Re: [PATCH 5/25] Enforces a minimum interval of 10 milliseconds as
  2007-11-01  0:30 [PATCH 5/25] Enforces a minimum interval of 10 milliseconds as per CCID-4 draft Leandro
  2007-11-03  1:00 ` Ian McDonald
  2007-11-08 11:18 ` Gerrit Renker
@ 2007-11-09 21:11 ` Tommi Saviranta
  2007-11-13 16:19 ` [PATCH 5/25] Enforces a minimum interval of 10 milliseconds as per CCID-4 draft Łeandro Sales
  3 siblings, 0 replies; 5+ messages in thread
From: Tommi Saviranta @ 2007-11-09 21:11 UTC (permalink / raw)
  To: dccp

On Thu, Nov 08, 2007 at 11:18:30 +0000, Gerrit Renker wrote:
> Maybe the code would be clearer to read this way:
> 
> 	hctx->ccid4hctx_t_ipi = scaled_div32(((u64)hctx->ccid4hctx_s) << 6,
> 					     hctx->ccid4hctx_x));
> 	if (hctx->ccid4hctx_t_ipi <  MIN_SEND_RATE)
> 		hctx->ccid4hctx_t_ipi = MIN_SEND_RATE;

Yes, it would. I was going to ask whether one of them would be
considered more effective, but I then realised this is probably one of
those cases where you should write readable code and let the compiler to
worry about the rest.


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

* Re: [PATCH 5/25] Enforces a minimum interval of 10 milliseconds as per CCID-4 draft
  2007-11-01  0:30 [PATCH 5/25] Enforces a minimum interval of 10 milliseconds as per CCID-4 draft Leandro
                   ` (2 preceding siblings ...)
  2007-11-09 21:11 ` [PATCH 5/25] Enforces a minimum interval of 10 milliseconds as Tommi Saviranta
@ 2007-11-13 16:19 ` Łeandro Sales
  3 siblings, 0 replies; 5+ messages in thread
From: Łeandro Sales @ 2007-11-13 16:19 UTC (permalink / raw)
  To: dccp

2007/11/9, Tommi Saviranta <wnd@iki.fi>:
> On Thu, Nov 08, 2007 at 11:18:30 +0000, Gerrit Renker wrote:
> > Maybe the code would be clearer to read this way:
> >
> >       hctx->ccid4hctx_t_ipi = scaled_div32(((u64)hctx->ccid4hctx_s) << 6,
> >                                            hctx->ccid4hctx_x));
> >       if (hctx->ccid4hctx_t_ipi <  MIN_SEND_RATE)
> >               hctx->ccid4hctx_t_ipi = MIN_SEND_RATE;
>
> Yes, it would. I was going to ask whether one of them would be
> considered more effective, but I then realised this is probably one of
> those cases where you should write readable code and let the compiler to
> worry about the rest.
>
> -
> 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 also agree with this.

Leandro.

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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-01  0:30 [PATCH 5/25] Enforces a minimum interval of 10 milliseconds as per CCID-4 draft Leandro
2007-11-03  1:00 ` Ian McDonald
2007-11-08 11:18 ` Gerrit Renker
2007-11-09 21:11 ` [PATCH 5/25] Enforces a minimum interval of 10 milliseconds as Tommi Saviranta
2007-11-13 16:19 ` [PATCH 5/25] Enforces a minimum interval of 10 milliseconds as per CCID-4 draft Ł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.