[PATCH 5/5][REVISED]: Introduce macro for incrementing modulo-48

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[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.

Signed-off-by: Gerrit Renker <gerrit@xxxxxxxxxxxxxx>
---
 net/dccp/dccp.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -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 */
-
To unsubscribe from this list: send the line "unsubscribe dccp" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [IETF DCCP]     [Linux Networking]     [Git]     [Security]     [Linux Assembly]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux