* [PATCH 10/25]: Shorten statement for updating p
@ 2007-03-21 18:44 Gerrit Renker
2007-03-26 3:06 ` Ian McDonald
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Gerrit Renker @ 2007-03-21 18:44 UTC (permalink / raw)
To: dccp
[CCID 3]: Shorten statement for updating p
This shortens the statement for updating the loss event
rate p when a feedback packet is received.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
---
net/dccp/ccids/ccid3.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -466,12 +466,9 @@ static void ccid3_hc_tx_packet_recv(stru
hctx->ccid3hctx_x_recv = opt_recv->ccid3or_receive_rate;
hctx->ccid3hctx_x_recv <<= 6;
- /* Update loss event rate */
+ /* Update loss event rate (scaled by 1e6), cf. RFC 4342, 8.5 */
pinv = opt_recv->ccid3or_loss_event_rate;
- if (pinv = ~0U || pinv = 0) /* see RFC 4342, 8.5 */
- hctx->ccid3hctx_p = 0;
- else /* can not exceed 100% */
- hctx->ccid3hctx_p = 1000000 / pinv;
+ hctx->ccid3hctx_p = (pinv = ~0U || pinv = 0)? 0 : scaled_div(1, pinv);
/*
* Calculate new round trip sample as per [RFC 3448, 4.3] by
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 10/25]: Shorten statement for updating p
2007-03-21 18:44 [PATCH 10/25]: Shorten statement for updating p Gerrit Renker
@ 2007-03-26 3:06 ` Ian McDonald
2007-04-02 8:48 ` Gerrit Renker
2007-04-02 8:51 ` Ian McDonald
2 siblings, 0 replies; 4+ messages in thread
From: Ian McDonald @ 2007-03-26 3:06 UTC (permalink / raw)
To: dccp
On 3/22/07, Gerrit Renker <gerrit@erg.abdn.ac.uk> wrote:
> [CCID 3]: Shorten statement for updating p
>
> This shortens the statement for updating the loss event
> rate p when a feedback packet is received.
>
> Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
> ---
> net/dccp/ccids/ccid3.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> --- a/net/dccp/ccids/ccid3.c
> +++ b/net/dccp/ccids/ccid3.c
> @@ -466,12 +466,9 @@ static void ccid3_hc_tx_packet_recv(stru
> hctx->ccid3hctx_x_recv = opt_recv->ccid3or_receive_rate;
> hctx->ccid3hctx_x_recv <<= 6;
>
> - /* Update loss event rate */
> + /* Update loss event rate (scaled by 1e6), cf. RFC 4342, 8.5 */
> pinv = opt_recv->ccid3or_loss_event_rate;
> - if (pinv = ~0U || pinv = 0) /* see RFC 4342, 8.5 */
> - hctx->ccid3hctx_p = 0;
> - else /* can not exceed 100% */
> - hctx->ccid3hctx_p = 1000000 / pinv;
> + hctx->ccid3hctx_p = (pinv = ~0U || pinv = 0)? 0 : scaled_div(1, pinv);
>
Agree with the scaled_div bit but don't like removing if/then and
repalce withing ?: as harder to read and compiler can optimise just as
well. Matter of personal choice though so up to Arnaldo really.
Acked-by: Ian McDonald <ian.mcdonald@jandi.co.nz>
--
Web: http://wand.net.nz/~iam4
Blog: http://iansblog.jandi.co.nz
WAND Network Research Group
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 10/25]: Shorten statement for updating p
2007-03-21 18:44 [PATCH 10/25]: Shorten statement for updating p Gerrit Renker
2007-03-26 3:06 ` Ian McDonald
@ 2007-04-02 8:48 ` Gerrit Renker
2007-04-02 8:51 ` Ian McDonald
2 siblings, 0 replies; 4+ messages in thread
From: Gerrit Renker @ 2007-04-02 8:48 UTC (permalink / raw)
To: dccp
| > + /* Update loss event rate (scaled by 1e6), cf. RFC 4342, 8.5 */
| > pinv = opt_recv->ccid3or_loss_event_rate;
| > - if (pinv = ~0U || pinv = 0) /* see RFC 4342, 8.5 */
| > - hctx->ccid3hctx_p = 0;
| > - else /* can not exceed 100% */
| > - hctx->ccid3hctx_p = 1000000 / pinv;
| > + hctx->ccid3hctx_p = (pinv = ~0U || pinv = 0)? 0 : scaled_div(1, pinv);
| >
|
| Agree with the scaled_div bit but don't like removing if/then and
| repalce withing ?: as harder to read and compiler can optimise just as
| well. Matter of personal choice though so up to Arnaldo really.
|
I could take this patch out if you / Arnaldo think so, since it is overridden later
by another patch which uses only one socket field instead of two (p depends on pinv,
so having both is redundant).
Please let me be state this - I aim as best as possible to avoid overlap and overriding
in later patches. But this is not always possible and - having just spent almost two
days integrating away another patch set with my local changesets - can sometimes be
a real nightmare. It is not always avoidable when trying to split larger changes into
small and separate chunks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 10/25]: Shorten statement for updating p
2007-03-21 18:44 [PATCH 10/25]: Shorten statement for updating p Gerrit Renker
2007-03-26 3:06 ` Ian McDonald
2007-04-02 8:48 ` Gerrit Renker
@ 2007-04-02 8:51 ` Ian McDonald
2 siblings, 0 replies; 4+ messages in thread
From: Ian McDonald @ 2007-04-02 8:51 UTC (permalink / raw)
To: dccp
On 4/2/07, Gerrit Renker <gerrit@erg.abdn.ac.uk> wrote:
> | > + /* Update loss event rate (scaled by 1e6), cf. RFC 4342, 8.5 */
> | > pinv = opt_recv->ccid3or_loss_event_rate;
> | > - if (pinv = ~0U || pinv = 0) /* see RFC 4342, 8.5 */
> | > - hctx->ccid3hctx_p = 0;
> | > - else /* can not exceed 100% */
> | > - hctx->ccid3hctx_p = 1000000 / pinv;
> | > + hctx->ccid3hctx_p = (pinv = ~0U || pinv = 0)? 0 : scaled_div(1, pinv);
> | >
> |
> | Agree with the scaled_div bit but don't like removing if/then and
> | repalce withing ?: as harder to read and compiler can optimise just as
> | well. Matter of personal choice though so up to Arnaldo really.
> |
> I could take this patch out if you / Arnaldo think so, since it is overridden later
> by another patch which uses only one socket field instead of two (p depends on pinv,
> so having both is redundant).
No leave it in then - it's just a matter of style, not logic.
> Please let me be state this - I aim as best as possible to avoid overlap and overriding
> in later patches. But this is not always possible and - having just spent almost two
> days integrating away another patch set with my local changesets - can sometimes be
> a real nightmare. It is not always avoidable when trying to split larger changes into
> small and separate chunks.
Yes I understand your pain and hope I didn't cause too much of it...
--
Web: http://wand.net.nz/~iam4/
Blog: http://iansblog.jandi.co.nz
WAND Network Research Group
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-04-02 8:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-21 18:44 [PATCH 10/25]: Shorten statement for updating p Gerrit Renker
2007-03-26 3:06 ` Ian McDonald
2007-04-02 8:48 ` Gerrit Renker
2007-04-02 8:51 ` Ian McDonald
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.