Skip to contentSkip to conversation

CCID4: Replaces the hard-coded 1460 nominal packet size by a #define

PATCH In review ツ Leandro Sales 3 participants 6 messages Sep 20, 2007 – Sep 22, 2007 Networking

lore
Share & tools
lore

ツ Leandro Sales

#0 lore raw

PATCH 4/4 CCID4: Replaces the hard-coded 1460 nominal packet size by a #define

It replaces the hard-coded 1460 nominal packet size by a #define in the ccid4.h and adjust the ccid4.c for the applied changes.

diff -uprN dccp-ccid4.base/net/dccp/ccids/ccid4.c
dccp-ccid4/net/dccp/ccids/ccid4.c

net/dccp/ccids/ccid4.c +2 -2
@@ -493,7 +493,7 @@ static void ccid4_hc_tx_packet_recv(stru
 	}
 	/* perform step (4) of draft rfc3448bis, section 4.3 */
 	if (hctx->ccid4hctx_p > 0)
-		hctx->ccid4hctx_x_calc = tfrc_calc_x(1460,
+		hctx->ccid4hctx_x_calc = tfrc_calc_x(NOM_PACKET_SIZE,
 						     hctx->ccid4hctx_rtt,
 						     hctx->ccid4hctx_p);
 	ccid4_hc_tx_update_x(sk, &now);
@@ -804,7 +804,7 @@ static u32 ccid4_first_li(struct sock *s
 		}
 	}
 
-	fval = scaled_div(1460, hcrx->ccid4hcrx_rtt);
+	fval = scaled_div(NOM_PACKET_SIZE, hcrx->ccid4hcrx_rtt);
 	fval = scaled_div32(fval, x_recv);
 	p = tfrc_calc_x_reverse_lookup(fval);
 

diff -uprN dccp-ccid4.base/net/dccp/ccids/ccid4.h
dccp-ccid4/net/dccp/ccids/ccid4.h

net/dccp/ccids/ccid4.h +3 -0
@@ -65,6 +65,9 @@
 /* Parameter t_mbi from [RFC 3448, 4.3]: backoff interval in seconds */
 #define TFRC_T_MBI		   64
 
+/* The nominal packet size to be used into TFRC equation  as per CCID-4 draft*/
+#define NOM_PACKET_SIZE		   1460
+
 enum ccid4_options {
 	TFRC_OPT_LOSS_EVENT_RATE = 192,
 	TFRC_OPT_LOSS_INTERVALS	 = 193,
#1 lore raw

Re: [PATCH 4/4] CCID4: Replaces the hard-coded 1460 nominal packet

Quoted 3 lines · ツ Leandro Sales

diff -uprN dccp-ccid4.base/net/dccp/ccids/ccid4.h

+#define NOM_PACKET_SIZE 1460

Agreed, using a define for hardcoded value is the way to go. I think nominal packet size is somewhat private information to ccid4.c, so I'd rather put the define in the c-file. What does the Linux-kernel coding convention (or common sense) say about this?

#2 lore raw
In reply to ツ Leandro Sales

2007/9/20, Tommi Saviranta <[email protected]>:

Quoted 11 lines · ツ Leandro Sales
Quoted 3 lines

diff -uprN dccp-ccid4.base/net/dccp/ccids/ccid4.h

+#define NOM_PACKET_SIZE 1460

Agreed, using a define for hardcoded value is the way to go. I think nominal packet size is somewhat private information to ccid4.c, so I'd rather put the define in the c-file. What does the Linux-kernel coding convention (or common sense) say about this?

Put NOM_PACKET_SIZE into ccid4.h follows the other definition, similar to #define TFRC_T_MBI 64
that goes into ccid4.h too.

Leandro.

#3 lore raw
In reply to ツ Leandro Sales

2007/9/20, Tommi Saviranta <[email protected]>:

Quoted 11 lines · ツ Leandro Sales
Quoted 3 lines

diff -uprN dccp-ccid4.base/net/dccp/ccids/ccid4.h

+#define NOM_PACKET_SIZE 1460

Agreed, using a define for hardcoded value is the way to go. I think nominal packet size is somewhat private information to ccid4.c, so I'd rather put the define in the c-file. What does the Linux-kernel coding convention (or common sense) say about this?

Adjust patch #4 to be cleanly applied without generate "hunk" due to patch #3 update.

diff -uprN dccp-ccid4.base/net/dccp/ccids/ccid4.c
dccp-ccid4/net/dccp/ccids/ccid4.c

net/dccp/ccids/ccid4.c +2 -2
@@ -494,7 +494,7 @@ static void ccid4_hc_tx_packet_recv(stru
 	}
 	/* perform step (4) of draft rfc3448bis, section 4.3 */
 	if (hctx->ccid4hctx_p > 0)
-		hctx->ccid4hctx_x_calc = tfrc_calc_x(1460,
+		hctx->ccid4hctx_x_calc = tfrc_calc_x(NOM_PACKET_SIZE,
 						     hctx->ccid4hctx_rtt,
 						     hctx->ccid4hctx_p);
 	ccid4_hc_tx_update_x(sk, &now);
@@ -805,7 +805,7 @@ static u32 ccid4_first_li(struct sock *s
 		}
 	}
 
-	fval = scaled_div(1460, hcrx->ccid4hcrx_rtt);
+	fval = scaled_div(NOM_PACKET_SIZE, hcrx->ccid4hcrx_rtt);
 	fval = scaled_div32(fval, x_recv);
 	p = tfrc_calc_x_reverse_lookup(fval);
 

diff -uprN dccp-ccid4.base/net/dccp/ccids/ccid4.h
dccp-ccid4/net/dccp/ccids/ccid4.h

net/dccp/ccids/ccid4.h +3 -0
@@ -65,6 +65,9 @@
 /* Parameter t_mbi from [RFC 3448, 4.3]: backoff interval in seconds */
 #define TFRC_T_MBI		   64
 
+/* The nominal packet size to be used into TFRC equation as per CCID-4 draft*/
+#define NOM_PACKET_SIZE                   1460
+
 enum ccid4_options {
 	TFRC_OPT_LOSS_EVENT_RATE = 192,
 	TFRC_OPT_LOSS_INTERVALS	 = 193,
#5 lore raw
In reply to ツ Leandro Sales
Quoted 9 lines · Tommi Saviranta
Quoted 4 lines · ツ Leandro Sales

Put NOM_PACKET_SIZE into ccid4.h follows the other definition, similar to
#define TFRC_T_MBI 64
that goes into ccid4.h too.

Fair enough.

(although I think there should be just one merged patch for this)

Signature · 3 lines
Web1: http://wand.net.nz/~iam4/
Web2: http://www.jandi.co.nz
Blog: http://iansblog.jandi.co.nz