~ubuntu-branches/ubuntu/quantal/linux-lowlatency/quantal-proposed

« back to all changes in this revision

Viewing changes to net/batman-adv/main.h

  • Committer: Package Import Robot
  • Author(s): Andy Whitcroft, Andy Whitcroft
  • Date: 2012-06-21 09:16:38 UTC
  • Revision ID: package-import@ubuntu.com-20120621091638-gubhv4nox8xez1ct
Tags: 3.5.0-1.1
[ Andy Whitcroft]

* Rebuild lowlatency against Ubuntu-3.5.0-1.1
* All new configuration system to allow configuration deltas to be
  exposed via debian.lowlatency/config-delta

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors:
 
2
 * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
3
3
 *
4
4
 * Marek Lindner, Simon Wunderlich
5
5
 *
28
28
#define DRIVER_DEVICE "batman-adv"
29
29
 
30
30
#ifndef SOURCE_VERSION
31
 
#define SOURCE_VERSION "2011.4.0"
 
31
#define SOURCE_VERSION "2012.2.0"
32
32
#endif
33
33
 
34
34
/* B.A.T.M.A.N. parameters */
41
41
 
42
42
/* purge originators after time in seconds if no valid packet comes in
43
43
 * -> TODO: check influence on TQ_LOCAL_WINDOW_SIZE */
44
 
#define PURGE_TIMEOUT 200
45
 
#define TT_LOCAL_TIMEOUT 3600 /* in seconds */
46
 
#define TT_CLIENT_ROAM_TIMEOUT 600
 
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
47
/* sliding packet range of received originator messages in sequence numbers
48
48
 * (should be a multiple of our word size) */
49
49
#define TQ_LOCAL_WINDOW_SIZE 64
50
 
#define TT_REQUEST_TIMEOUT 3 /* seconds we have to keep pending tt_req */
 
50
#define TT_REQUEST_TIMEOUT 3000 /* miliseconds we have to keep
 
51
                                 * pending tt_req */
51
52
 
52
53
#define TQ_GLOBAL_WINDOW_SIZE 5
53
54
#define TQ_LOCAL_BIDRECT_SEND_MINIMUM 1
56
57
 
57
58
#define TT_OGM_APPEND_MAX 3 /* number of OGMs sent with the last tt diff */
58
59
 
59
 
#define ROAMING_MAX_TIME 20 /* Time in which a client can roam at most
60
 
                             * ROAMING_MAX_COUNT times */
 
60
#define ROAMING_MAX_TIME 20000 /* Time in which a client can roam at most
 
61
                                * ROAMING_MAX_COUNT times in miliseconds*/
61
62
#define ROAMING_MAX_COUNT 5
62
63
 
63
64
#define NO_FLAGS 0
64
65
 
65
66
#define NULL_IFINDEX 0 /* dummy ifindex used to avoid iface checks */
66
67
 
67
 
#define NUM_WORDS (TQ_LOCAL_WINDOW_SIZE / WORD_BIT_SIZE)
 
68
#define NUM_WORDS BITS_TO_LONGS(TQ_LOCAL_WINDOW_SIZE)
68
69
 
69
70
#define LOG_BUF_LEN 8192          /* has to be a power of 2 */
70
71
 
79
80
#define MAX_AGGREGATION_BYTES 512
80
81
#define MAX_AGGREGATION_MS 100
81
82
 
82
 
#define SOFTIF_NEIGH_TIMEOUT 180000 /* 3 minutes */
 
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)
83
86
 
 
87
#define DUPLIST_SIZE            16
 
88
#define DUPLIST_TIMEOUT         500     /* 500 ms */
84
89
/* don't reset again within 30 seconds */
85
90
#define RESET_PROTECTION_MS 30000
86
91
#define EXPECTED_SEQNO_RANGE    65536
106
111
 
107
112
#define GW_THRESHOLD    50
108
113
 
109
 
/*
110
 
 * Debug Messages
111
 
 */
 
114
/* Debug Messages */
112
115
#ifdef pr_fmt
113
116
#undef pr_fmt
114
117
#endif
120
123
        DBG_BATMAN = 1 << 0,
121
124
        DBG_ROUTES = 1 << 1, /* route added / changed / deleted */
122
125
        DBG_TT     = 1 << 2, /* translation table operations */
123
 
        DBG_ALL    = 7
 
126
        DBG_BLA    = 1 << 3, /* bridge loop avoidance */
 
127
        DBG_ALL    = 15
124
128
};
125
129
 
126
 
 
127
 
/*
128
 
 *  Vis
129
 
 */
130
 
 
131
 
/*
132
 
 * Kernel headers
133
 
 */
 
130
/* Kernel headers */
134
131
 
135
132
#include <linux/mutex.h>        /* mutex */
136
133
#include <linux/module.h>       /* needed by all modules */
147
144
#include <linux/seq_file.h>
148
145
#include "types.h"
149
146
 
 
147
extern char bat_routing_algo[];
150
148
extern struct list_head hardif_list;
151
149
 
152
150
extern unsigned char broadcast_addr[];
157
155
void inc_module_count(void);
158
156
void dec_module_count(void);
159
157
int is_my_mac(const uint8_t *addr);
 
158
int batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
 
159
                    struct packet_type *ptype, struct net_device *orig_dev);
 
160
int recv_handler_register(uint8_t packet_type,
 
161
                          int (*recv_handler)(struct sk_buff *,
 
162
                                              struct hard_iface *));
 
163
void recv_handler_unregister(uint8_t packet_type);
 
164
int bat_algo_register(struct bat_algo_ops *bat_algo_ops);
 
165
int bat_algo_select(struct bat_priv *bat_priv, char *name);
 
166
int bat_algo_seq_print_text(struct seq_file *seq, void *offset);
160
167
 
161
168
#ifdef CONFIG_BATMAN_ADV_DEBUG
162
169
int debug_log(struct bat_priv *bat_priv, const char *fmt, ...) __printf(2, 3);
202
209
        return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0);
203
210
}
204
211
 
 
212
/**
 
213
 * has_timed_out - compares current time (jiffies) and timestamp + timeout
 
214
 * @timestamp:          base value to compare with (in jiffies)
 
215
 * @timeout:            added to base value before comparing (in milliseconds)
 
216
 *
 
217
 * Returns true if current time is after timestamp + timeout
 
218
 */
 
219
static inline bool has_timed_out(unsigned long timestamp, unsigned int timeout)
 
220
{
 
221
        return time_is_before_jiffies(timestamp + msecs_to_jiffies(timeout));
 
222
}
205
223
 
206
224
#define atomic_dec_not_zero(v)  atomic_add_unless((v), -1, 0)
207
225