main.h (3193e8fdfa355289892661d206d1954114a7be95) main.h (9cfc7bd608b97463993b4f3e4775d99022253f8d)
1/*
2 * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
1/* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
3 *
4 * Marek Lindner, Simon Wunderlich
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of version 2 of the GNU General Public
8 * License as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA
2 *
3 * Marek Lindner, Simon Wunderlich
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of version 2 of the GNU General Public
7 * License as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 * 02110-1301, USA
19 *
20 */
21
22#ifndef _NET_BATMAN_ADV_MAIN_H_
23#define _NET_BATMAN_ADV_MAIN_H_
24
25#define DRIVER_AUTHOR "Marek Lindner <lindner_marek@yahoo.de>, " \
26 "Simon Wunderlich <siwu@hrz.tu-chemnitz.de>"
27#define DRIVER_DESC "B.A.T.M.A.N. advanced"
28#define DRIVER_DEVICE "batman-adv"
29
30#ifndef SOURCE_VERSION
31#define SOURCE_VERSION "2012.3.0"
32#endif
33
34/* B.A.T.M.A.N. parameters */
35
36#define TQ_MAX_VALUE 255
37#define JITTER 20
38
18 */
19
20#ifndef _NET_BATMAN_ADV_MAIN_H_
21#define _NET_BATMAN_ADV_MAIN_H_
22
23#define DRIVER_AUTHOR "Marek Lindner <lindner_marek@yahoo.de>, " \
24 "Simon Wunderlich <siwu@hrz.tu-chemnitz.de>"
25#define DRIVER_DESC "B.A.T.M.A.N. advanced"
26#define DRIVER_DEVICE "batman-adv"
27
28#ifndef SOURCE_VERSION
29#define SOURCE_VERSION "2012.3.0"
30#endif
31
32/* B.A.T.M.A.N. parameters */
33
34#define TQ_MAX_VALUE 255
35#define JITTER 20
36
39 /* Time To Live of broadcast messages */
37/* Time To Live of broadcast messages */
40#define TTL 50
41
42/* purge originators after time in seconds if no valid packet comes in
38#define TTL 50
39
40/* purge originators after time in seconds if no valid packet comes in
43 * -> TODO: check influence on TQ_LOCAL_WINDOW_SIZE */
41 * -> TODO: check influence on TQ_LOCAL_WINDOW_SIZE
42 */
44#define PURGE_TIMEOUT 200000 /* 200 seconds */
45#define TT_LOCAL_TIMEOUT 3600000 /* in miliseconds */
46#define TT_CLIENT_ROAM_TIMEOUT 600000 /* in miliseconds */
47/* sliding packet range of received originator messages in sequence numbers
43#define PURGE_TIMEOUT 200000 /* 200 seconds */
44#define TT_LOCAL_TIMEOUT 3600000 /* in miliseconds */
45#define TT_CLIENT_ROAM_TIMEOUT 600000 /* in miliseconds */
46/* sliding packet range of received originator messages in sequence numbers
48 * (should be a multiple of our word size) */
47 * (should be a multiple of our word size)
48 */
49#define TQ_LOCAL_WINDOW_SIZE 64
49#define TQ_LOCAL_WINDOW_SIZE 64
50#define TT_REQUEST_TIMEOUT 3000 /* miliseconds we have to keep
51 * pending tt_req */
50/* miliseconds we have to keep pending tt_req */
51#define TT_REQUEST_TIMEOUT 3000
52
53#define TQ_GLOBAL_WINDOW_SIZE 5
54#define TQ_LOCAL_BIDRECT_SEND_MINIMUM 1
55#define TQ_LOCAL_BIDRECT_RECV_MINIMUM 1
56#define TQ_TOTAL_BIDRECT_LIMIT 1
57
58#define TT_OGM_APPEND_MAX 3 /* number of OGMs sent with the last tt diff */
59
52
53#define TQ_GLOBAL_WINDOW_SIZE 5
54#define TQ_LOCAL_BIDRECT_SEND_MINIMUM 1
55#define TQ_LOCAL_BIDRECT_RECV_MINIMUM 1
56#define TQ_TOTAL_BIDRECT_LIMIT 1
57
58#define TT_OGM_APPEND_MAX 3 /* number of OGMs sent with the last tt diff */
59
60#define ROAMING_MAX_TIME 20000 /* Time in which a client can roam at most
61 * ROAMING_MAX_COUNT times in miliseconds*/
60/* Time in which a client can roam at most ROAMING_MAX_COUNT times in
61 * miliseconds
62 */
63#define ROAMING_MAX_TIME 20000
62#define ROAMING_MAX_COUNT 5
63
64#define NO_FLAGS 0
65
66#define NULL_IFINDEX 0 /* dummy ifindex used to avoid iface checks */
67
68#define NUM_WORDS BITS_TO_LONGS(TQ_LOCAL_WINDOW_SIZE)
69
70#define LOG_BUF_LEN 8192 /* has to be a power of 2 */
71
72#define VIS_INTERVAL 5000 /* 5 seconds */
73
74/* how much worse secondary interfaces may be to be considered as bonding
64#define ROAMING_MAX_COUNT 5
65
66#define NO_FLAGS 0
67
68#define NULL_IFINDEX 0 /* dummy ifindex used to avoid iface checks */
69
70#define NUM_WORDS BITS_TO_LONGS(TQ_LOCAL_WINDOW_SIZE)
71
72#define LOG_BUF_LEN 8192 /* has to be a power of 2 */
73
74#define VIS_INTERVAL 5000 /* 5 seconds */
75
76/* how much worse secondary interfaces may be to be considered as bonding
75 * candidates */
77 * candidates
78 */
76#define BONDING_TQ_THRESHOLD 50
77
78/* should not be bigger than 512 bytes or change the size of
79#define BONDING_TQ_THRESHOLD 50
80
81/* should not be bigger than 512 bytes or change the size of
79 * forw_packet->direct_link_flags */
82 * forw_packet->direct_link_flags
83 */
80#define MAX_AGGREGATION_BYTES 512
81#define MAX_AGGREGATION_MS 100
82
83#define BLA_PERIOD_LENGTH 10000 /* 10 seconds */
84#define BLA_BACKBONE_TIMEOUT (BLA_PERIOD_LENGTH * 3)
85#define BLA_CLAIM_TIMEOUT (BLA_PERIOD_LENGTH * 10)
86
87#define DUPLIST_SIZE 16

--- 108 unchanged lines hidden (view full) ---

196#define bat_err(net_dev, fmt, arg...) \
197 do { \
198 struct net_device *_netdev = (net_dev); \
199 struct bat_priv *_batpriv = netdev_priv(_netdev); \
200 bat_dbg(DBG_ALL, _batpriv, fmt, ## arg); \
201 pr_err("%s: " fmt, _netdev->name, ## arg); \
202 } while (0)
203
84#define MAX_AGGREGATION_BYTES 512
85#define MAX_AGGREGATION_MS 100
86
87#define BLA_PERIOD_LENGTH 10000 /* 10 seconds */
88#define BLA_BACKBONE_TIMEOUT (BLA_PERIOD_LENGTH * 3)
89#define BLA_CLAIM_TIMEOUT (BLA_PERIOD_LENGTH * 10)
90
91#define DUPLIST_SIZE 16

--- 108 unchanged lines hidden (view full) ---

200#define bat_err(net_dev, fmt, arg...) \
201 do { \
202 struct net_device *_netdev = (net_dev); \
203 struct bat_priv *_batpriv = netdev_priv(_netdev); \
204 bat_dbg(DBG_ALL, _batpriv, fmt, ## arg); \
205 pr_err("%s: " fmt, _netdev->name, ## arg); \
206 } while (0)
207
204/**
205 * returns 1 if they are the same ethernet addr
208/* returns 1 if they are the same ethernet addr
206 *
207 * note: can't use compare_ether_addr() as it requires aligned memory
208 */
209 *
210 * note: can't use compare_ether_addr() as it requires aligned memory
211 */
209
210static inline int compare_eth(const void *data1, const void *data2)
211{
212 return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0);
213}
214
212static inline int compare_eth(const void *data1, const void *data2)
213{
214 return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0);
215}
216
215/**
216 * has_timed_out - compares current time (jiffies) and timestamp + timeout
217/* has_timed_out - compares current time (jiffies) and timestamp + timeout
217 * @timestamp: base value to compare with (in jiffies)
218 * @timeout: added to base value before comparing (in milliseconds)
219 *
220 * Returns true if current time is after timestamp + timeout
221 */
222static inline bool has_timed_out(unsigned long timestamp, unsigned int timeout)
223{
224 return time_is_before_jiffies(timestamp + msecs_to_jiffies(timeout));

--- 7 unchanged lines hidden (view full) ---

232/* Checks if a sequence number x is a predecessor/successor of y.
233 * they handle overflows/underflows and can correctly check for a
234 * predecessor/successor unless the variable sequence number has grown by
235 * more then 2**(bitwidth(x)-1)-1.
236 * This means that for a uint8_t with the maximum value 255, it would think:
237 * - when adding nothing - it is neither a predecessor nor a successor
238 * - before adding more than 127 to the starting value - it is a predecessor,
239 * - when adding 128 - it is neither a predecessor nor a successor,
218 * @timestamp: base value to compare with (in jiffies)
219 * @timeout: added to base value before comparing (in milliseconds)
220 *
221 * Returns true if current time is after timestamp + timeout
222 */
223static inline bool has_timed_out(unsigned long timestamp, unsigned int timeout)
224{
225 return time_is_before_jiffies(timestamp + msecs_to_jiffies(timeout));

--- 7 unchanged lines hidden (view full) ---

233/* Checks if a sequence number x is a predecessor/successor of y.
234 * they handle overflows/underflows and can correctly check for a
235 * predecessor/successor unless the variable sequence number has grown by
236 * more then 2**(bitwidth(x)-1)-1.
237 * This means that for a uint8_t with the maximum value 255, it would think:
238 * - when adding nothing - it is neither a predecessor nor a successor
239 * - before adding more than 127 to the starting value - it is a predecessor,
240 * - when adding 128 - it is neither a predecessor nor a successor,
240 * - after adding more than 127 to the starting value - it is a successor */
241 * - after adding more than 127 to the starting value - it is a successor
242 */
241#define seq_before(x, y) ({typeof(x) _d1 = (x); \
242 typeof(y) _d2 = (y); \
243 typeof(x) _dummy = (_d1 - _d2); \
244 (void) (&_d1 == &_d2); \
245 _dummy > smallest_signed_int(_dummy); })
246#define seq_after(x, y) seq_before(y, x)
247
248/* Stop preemption on local cpu while incrementing the counter */

--- 26 unchanged lines hidden ---
243#define seq_before(x, y) ({typeof(x) _d1 = (x); \
244 typeof(y) _d2 = (y); \
245 typeof(x) _dummy = (_d1 - _d2); \
246 (void) (&_d1 == &_d2); \
247 _dummy > smallest_signed_int(_dummy); })
248#define seq_after(x, y) seq_before(y, x)
249
250/* Stop preemption on local cpu while incrementing the counter */

--- 26 unchanged lines hidden ---