: Shorten statement for updating p
PATCH 1/5 : Shorten statement for updating p
[CCID 3]: Shorten statement for updating p
This shortens the statement for updating the loss event rate p when a feedback packet is received.
--- net/dccp/ccids/ccid3.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
net/dccp/ccids/ccid3.c +2 -5
@@ -436,12 +436,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 RTT sample and update moving average
Quoted 6 lines · Gerrit Renker
[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 <[email protected]>
Arnaldo - this is a standalone patch that could easily go into your tree.
Ian
Signature · 3 lines
Web: http://wand.net.nz/~iam4/ Blog: http://iansblog.jandi.co.nz WAND Network Research Group
Quoted 17 lines · Gerrit Renker
[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 <[email protected]>--- net/dccp/ccids/ccid3.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)net/dccp/ccids/ccid3.c +0
-1@@ -436,12 +436,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 */
net/dccp/ccids/ccid3.c static void ccid3_hc_tx_packet_recv(stru · line 444
Quoted 10 lines
net/dccp/ccids/ccid3.c +2
-4+/* 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 RTT sample and update moving average
I love '?:', but not when things get complex. I think this should be kept as if+else.
I'll pick the conversion to scaled_div tho, looks right.
- Arnaldo