Skip to contentSkip to conversation

: Introduce macro for incrementing modulo-48

PATCH In review Gerrit Renker 2 participants 2 messages Jan 3, 2007 – Jan 4, 2007 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 5/5 : Introduce macro for incrementing modulo-48

[DCCP]: Introduce macro for incrementing modulo-48

Problem: DCCP sequence numbers are mostly stored in 48-bit bitfields
which are acommodated within an u64 number. For these fields, dccp_inc_seqno() can not be used since it takes a u64 pointer.

Fix:     Solved by introducing an INC48() macro to increment modulo-2^48.
Note:    This macro can be used in several places within the ccid3 code.

However, these changes affect others in turn and therefore require a separate patch.

---
 net/dccp/dccp.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/dccp/dccp.h +2 -1
@@ -102,6 +102,7 @@ extern int  sysctl_dccp_tx_qlen;
 #define TO_UNSIGNED48(x) (((x) >= 0)?	       (x) :  COMPLEMENT48(-(x)))
 #define ADD48(a, b)	 (((a) + (b)) & DCCP_MAX_SEQNO)
 #define SUB48(a, b)	 ADD48((a), COMPLEMENT48(b))
+#define INC48(seqno)	 seqno = ADD48(seqno, 1)
 
 static inline void dccp_set_seqno(u64 *seqno, u64 value)
 {
@@ -110,7 +111,7 @@ static inline void dccp_set_seqno(u64 *s
 
 static inline void dccp_inc_seqno(u64 *seqno)
 {
-	*seqno = ADD48(*seqno, 1);
+	INC48(*seqno);
 }
 
 /* return > 0 if seqno1 is `before' seqno2, <= 0 otherwise */
Acked-by on v1 5/5
#1 lore raw
Quoted 2 lines · Gerrit Renker

[DCCP]: Introduce macro for incrementing modulo-48

Signature · 3 lines
Web: http://wand.net.nz/~iam4
Blog: http://imcdnzl.blogspot.com
WAND Network Research Group