: Introduce macro for incrementing modulo-48
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.
Signed-off-by Gerrit Renker <[email protected]>
--- 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 *sstatic inline void dccp_inc_seqno (u64 *seqno) { - *seqno =ADD48 (*seqno,1 ); +INC48 (*seqno); }/* return > 0 if seqno1 is `before' seqno2, <= 0 otherwise */
Quoted 2 lines · Gerrit Renker
[DCCP]: Introduce macro for incrementing modulo-48
Acked-by Ian McDonald <[email protected]>
Signature · 3 lines
Web: http://wand.net.nz/~iam4 Blog: http://imcdnzl.blogspot.com WAND Network Research Group