0001
0002
0003
0004
0005
0006
0007 #ifndef _NET_BATMAN_ADV_BITARRAY_H_
0008 #define _NET_BATMAN_ADV_BITARRAY_H_
0009
0010 #include "main.h"
0011
0012 #include <linux/bitops.h>
0013 #include <linux/compiler.h>
0014 #include <linux/stddef.h>
0015 #include <linux/types.h>
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 static inline bool batadv_test_bit(const unsigned long *seq_bits,
0028 u32 last_seqno, u32 curr_seqno)
0029 {
0030 s32 diff;
0031
0032 diff = last_seqno - curr_seqno;
0033 if (diff < 0 || diff >= BATADV_TQ_LOCAL_WINDOW_SIZE)
0034 return false;
0035 return test_bit(diff, seq_bits) != 0;
0036 }
0037
0038
0039
0040
0041
0042
0043
0044 static inline void batadv_set_bit(unsigned long *seq_bits, s32 n)
0045 {
0046
0047 if (n < 0 || n >= BATADV_TQ_LOCAL_WINDOW_SIZE)
0048 return;
0049
0050 set_bit(n, seq_bits);
0051 }
0052
0053 bool batadv_bit_get_packet(void *priv, unsigned long *seq_bits,
0054 s32 seq_num_diff, int set_mark);
0055
0056 #endif