aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv
diff options
context:
space:
mode:
authorMarek Lindner <lindner_marek@yahoo.de>2012-12-25 08:45:12 -0500
committerAntonio Quartulli <ordex@autistici.org>2013-01-19 08:18:11 -0500
commit88a32c9a8a3f0217430f0b67fc90e425c1ceaa7f (patch)
tree54e267038f0fab7e98fd80425bfff9baace9e56c /net/batman-adv
parent712bbfe46b3004603762adb506baff99be0f8d8c (diff)
batman-adv: kernel doc for types.h
Thanks to Sven Eckelmann and Simon Wunderlich for their support. Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv')
-rw-r--r--net/batman-adv/types.h461
1 files changed, 395 insertions, 66 deletions
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index 549ba5618071..03197f5ebf6c 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -24,6 +24,9 @@
24#include "bitarray.h" 24#include "bitarray.h"
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26 26
27/**
28 * Maximum overhead for the encapsulation for a payload packet
29 */
27#define BATADV_HEADER_LEN \ 30#define BATADV_HEADER_LEN \
28 (ETH_HLEN + max(sizeof(struct batadv_unicast_packet), \ 31 (ETH_HLEN + max(sizeof(struct batadv_unicast_packet), \
29 sizeof(struct batadv_bcast_packet))) 32 sizeof(struct batadv_bcast_packet)))
@@ -51,6 +54,21 @@ struct batadv_hard_iface_bat_iv {
51 atomic_t ogm_seqno; 54 atomic_t ogm_seqno;
52}; 55};
53 56
57/**
58 * struct batadv_hard_iface - network device known to batman-adv
59 * @list: list node for batadv_hardif_list
60 * @if_num: identificator of the interface
61 * @if_status: status of the interface for batman-adv
62 * @net_dev: pointer to the net_device
63 * @frag_seqno: last fragment sequence number sent by this interface
64 * @hardif_obj: kobject of the per interface sysfs "mesh" directory
65 * @refcount: number of contexts the object is used
66 * @batman_adv_ptype: packet type describing packets that should be processed by
67 * batman-adv for this interface
68 * @soft_iface: the batman-adv interface which uses this network interface
69 * @rcu: struct used for freeing in an RCU-safe manner
70 * @bat_iv: BATMAN IV specific per hard interface data
71 */
54struct batadv_hard_iface { 72struct batadv_hard_iface {
55 struct list_head list; 73 struct list_head list;
56 int16_t if_num; 74 int16_t if_num;
@@ -67,17 +85,47 @@ struct batadv_hard_iface {
67 85
68/** 86/**
69 * struct batadv_orig_node - structure for orig_list maintaining nodes of mesh 87 * struct batadv_orig_node - structure for orig_list maintaining nodes of mesh
88 * @orig: originator ethernet address
70 * @primary_addr: hosts primary interface address 89 * @primary_addr: hosts primary interface address
71 * @last_seen: when last packet from this node was received 90 * @router: router that should be used to reach this originator
91 * @batadv_dat_addr_t: address of the orig node in the distributed hash
92 * @bcast_own: bitfield containing the number of our OGMs this orig_node
93 * rebroadcasted "back" to us (relative to last_real_seqno)
94 * @bcast_own_sum: counted result of bcast_own
95 * @last_seen: time when last packet from this node was received
72 * @bcast_seqno_reset: time when the broadcast seqno window was reset 96 * @bcast_seqno_reset: time when the broadcast seqno window was reset
73 * @batman_seqno_reset: time when the batman seqno window was reset 97 * @batman_seqno_reset: time when the batman seqno window was reset
74 * @gw_flags: flags related to gateway class 98 * @gw_flags: flags related to gateway class
75 * @flags: for now only VIS_SERVER flag 99 * @flags: for now only VIS_SERVER flag
100 * @last_ttvn: last seen translation table version number
101 * @tt_crc: CRC of the translation table
102 * @tt_buff: last tt changeset this node received from the orig node
103 * @tt_buff_len: length of the last tt changeset this node received from the
104 * orig node
105 * @tt_buff_lock: lock that protects tt_buff and tt_buff_len
106 * @tt_size: number of global TT entries announced by the orig node
107 * @tt_initialised: bool keeping track of whether or not this node have received
108 * any translation table information from the orig node yet
76 * @last_real_seqno: last and best known sequence number 109 * @last_real_seqno: last and best known sequence number
77 * @last_ttl: ttl of last received packet 110 * @last_ttl: ttl of last received packet
111 * @bcast_bits: bitfield containing the info which payload broadcast originated
112 * from this orig node this host already has seen (relative to
113 * last_bcast_seqno)
78 * @last_bcast_seqno: last broadcast sequence number received by this host 114 * @last_bcast_seqno: last broadcast sequence number received by this host
79 * @candidates: how many candidates are available 115 * @neigh_list: list of potential next hop neighbor towards this orig node
80 * @selected: next bonding candidate 116 * @frag_list: fragmentation buffer list for fragment re-assembly
117 * @last_frag_packet: time when last fragmented packet from this node was
118 * received
119 * @neigh_list_lock: lock protecting neigh_list, router and bonding_list
120 * @hash_entry: hlist node for batadv_priv::orig_hash
121 * @bat_priv: pointer to soft_iface this orig node belongs to
122 * @ogm_cnt_lock: lock protecting bcast_own, bcast_own_sum,
123 * neigh_node->real_bits & neigh_node->real_packet_count
124 * @bcast_seqno_lock: lock protecting bcast_bits & last_bcast_seqno
125 * @bond_candidates: how many candidates are available
126 * @bond_list: list of bonding candidates
127 * @refcount: number of contexts the object is used
128 * @rcu: struct used for freeing in an RCU-safe manner
81 */ 129 */
82struct batadv_orig_node { 130struct batadv_orig_node {
83 uint8_t orig[ETH_ALEN]; 131 uint8_t orig[ETH_ALEN];
@@ -93,11 +141,11 @@ struct batadv_orig_node {
93 unsigned long batman_seqno_reset; 141 unsigned long batman_seqno_reset;
94 uint8_t gw_flags; 142 uint8_t gw_flags;
95 uint8_t flags; 143 uint8_t flags;
96 atomic_t last_ttvn; /* last seen translation table version number */ 144 atomic_t last_ttvn;
97 uint16_t tt_crc; 145 uint16_t tt_crc;
98 unsigned char *tt_buff; 146 unsigned char *tt_buff;
99 int16_t tt_buff_len; 147 int16_t tt_buff_len;
100 spinlock_t tt_buff_lock; /* protects tt_buff */ 148 spinlock_t tt_buff_lock; /* protects tt_buff & tt_buff_len */
101 atomic_t tt_size; 149 atomic_t tt_size;
102 bool tt_initialised; 150 bool tt_initialised;
103 uint32_t last_real_seqno; 151 uint32_t last_real_seqno;
@@ -106,22 +154,31 @@ struct batadv_orig_node {
106 uint32_t last_bcast_seqno; 154 uint32_t last_bcast_seqno;
107 struct hlist_head neigh_list; 155 struct hlist_head neigh_list;
108 struct list_head frag_list; 156 struct list_head frag_list;
109 spinlock_t neigh_list_lock; /* protects neigh_list and router */ 157 unsigned long last_frag_packet;
110 atomic_t refcount; 158 /* neigh_list_lock protects: neigh_list, router & bonding_list */
111 struct rcu_head rcu; 159 spinlock_t neigh_list_lock;
112 struct hlist_node hash_entry; 160 struct hlist_node hash_entry;
113 struct batadv_priv *bat_priv; 161 struct batadv_priv *bat_priv;
114 unsigned long last_frag_packet;
115 /* ogm_cnt_lock protects: bcast_own, bcast_own_sum, 162 /* ogm_cnt_lock protects: bcast_own, bcast_own_sum,
116 * neigh_node->real_bits, neigh_node->real_packet_count 163 * neigh_node->real_bits & neigh_node->real_packet_count
117 */ 164 */
118 spinlock_t ogm_cnt_lock; 165 spinlock_t ogm_cnt_lock;
119 /* bcast_seqno_lock protects bcast_bits, last_bcast_seqno */ 166 /* bcast_seqno_lock protects: bcast_bits & last_bcast_seqno */
120 spinlock_t bcast_seqno_lock; 167 spinlock_t bcast_seqno_lock;
121 atomic_t bond_candidates; 168 atomic_t bond_candidates;
122 struct list_head bond_list; 169 struct list_head bond_list;
170 atomic_t refcount;
171 struct rcu_head rcu;
123}; 172};
124 173
174/**
175 * struct batadv_gw_node - structure for orig nodes announcing gw capabilities
176 * @list: list node for batadv_priv_gw::list
177 * @orig_node: pointer to corresponding orig node
178 * @deleted: this struct is scheduled for deletion
179 * @refcount: number of contexts the object is used
180 * @rcu: struct used for freeing in an RCU-safe manner
181 */
125struct batadv_gw_node { 182struct batadv_gw_node {
126 struct hlist_node list; 183 struct hlist_node list;
127 struct batadv_orig_node *orig_node; 184 struct batadv_orig_node *orig_node;
@@ -130,13 +187,28 @@ struct batadv_gw_node {
130 struct rcu_head rcu; 187 struct rcu_head rcu;
131}; 188};
132 189
133/* batadv_neigh_node 190/**
134 * @last_seen: when last packet via this neighbor was received 191 * struct batadv_neigh_node - structure for single hop neighbors
192 * @list: list node for batadv_orig_node::neigh_list
193 * @addr: mac address of neigh node
194 * @tq_recv: ring buffer of received TQ values from this neigh node
195 * @tq_index: ring buffer index
196 * @tq_avg: averaged tq of all tq values in the ring buffer (tq_recv)
197 * @last_ttl: last received ttl from this neigh node
198 * @bonding_list: list node for batadv_orig_node::bond_list
199 * @last_seen: when last packet via this neighbor was received
200 * @real_bits: bitfield containing the number of OGMs received from this neigh
201 * node (relative to orig_node->last_real_seqno)
202 * @real_packet_count: counted result of real_bits
203 * @orig_node: pointer to corresponding orig_node
204 * @if_incoming: pointer to incoming hard interface
205 * @lq_update_lock: lock protecting tq_recv & tq_index
206 * @refcount: number of contexts the object is used
207 * @rcu: struct used for freeing in an RCU-safe manner
135 */ 208 */
136struct batadv_neigh_node { 209struct batadv_neigh_node {
137 struct hlist_node list; 210 struct hlist_node list;
138 uint8_t addr[ETH_ALEN]; 211 uint8_t addr[ETH_ALEN];
139 uint8_t real_packet_count;
140 uint8_t tq_recv[BATADV_TQ_GLOBAL_WINDOW_SIZE]; 212 uint8_t tq_recv[BATADV_TQ_GLOBAL_WINDOW_SIZE];
141 uint8_t tq_index; 213 uint8_t tq_index;
142 uint8_t tq_avg; 214 uint8_t tq_avg;
@@ -144,13 +216,20 @@ struct batadv_neigh_node {
144 struct list_head bonding_list; 216 struct list_head bonding_list;
145 unsigned long last_seen; 217 unsigned long last_seen;
146 DECLARE_BITMAP(real_bits, BATADV_TQ_LOCAL_WINDOW_SIZE); 218 DECLARE_BITMAP(real_bits, BATADV_TQ_LOCAL_WINDOW_SIZE);
147 atomic_t refcount; 219 uint8_t real_packet_count;
148 struct rcu_head rcu;
149 struct batadv_orig_node *orig_node; 220 struct batadv_orig_node *orig_node;
150 struct batadv_hard_iface *if_incoming; 221 struct batadv_hard_iface *if_incoming;
151 spinlock_t lq_update_lock; /* protects: tq_recv, tq_index */ 222 spinlock_t lq_update_lock; /* protects tq_recv & tq_index */
223 atomic_t refcount;
224 struct rcu_head rcu;
152}; 225};
153 226
227/**
228 * struct batadv_bcast_duplist_entry - structure for LAN broadcast suppression
229 * @orig[ETH_ALEN]: mac address of orig node orginating the broadcast
230 * @crc: crc32 checksum of broadcast payload
231 * @entrytime: time when the broadcast packet was received
232 */
154#ifdef CONFIG_BATMAN_ADV_BLA 233#ifdef CONFIG_BATMAN_ADV_BLA
155struct batadv_bcast_duplist_entry { 234struct batadv_bcast_duplist_entry {
156 uint8_t orig[ETH_ALEN]; 235 uint8_t orig[ETH_ALEN];
@@ -159,6 +238,33 @@ struct batadv_bcast_duplist_entry {
159}; 238};
160#endif 239#endif
161 240
241/**
242 * enum batadv_counters - indices for traffic counters
243 * @BATADV_CNT_TX: transmitted payload traffic packet counter
244 * @BATADV_CNT_TX_BYTES: transmitted payload traffic bytes counter
245 * @BATADV_CNT_TX_DROPPED: dropped transmission payload traffic packet counter
246 * @BATADV_CNT_RX: received payload traffic packet counter
247 * @BATADV_CNT_RX_BYTES: received payload traffic bytes counter
248 * @BATADV_CNT_FORWARD: forwarded payload traffic packet counter
249 * @BATADV_CNT_FORWARD_BYTES: forwarded payload traffic bytes counter
250 * @BATADV_CNT_MGMT_TX: transmitted routing protocol traffic packet counter
251 * @BATADV_CNT_MGMT_TX_BYTES: transmitted routing protocol traffic bytes counter
252 * @BATADV_CNT_MGMT_RX: received routing protocol traffic packet counter
253 * @BATADV_CNT_MGMT_RX_BYTES: received routing protocol traffic bytes counter
254 * @BATADV_CNT_TT_REQUEST_TX: transmitted tt req traffic packet counter
255 * @BATADV_CNT_TT_REQUEST_RX: received tt req traffic packet counter
256 * @BATADV_CNT_TT_RESPONSE_TX: transmitted tt resp traffic packet counter
257 * @BATADV_CNT_TT_RESPONSE_RX: received tt resp traffic packet counter
258 * @BATADV_CNT_TT_ROAM_ADV_TX: transmitted tt roam traffic packet counter
259 * @BATADV_CNT_TT_ROAM_ADV_RX: received tt roam traffic packet counter
260 * @BATADV_CNT_DAT_GET_TX: transmitted dht GET traffic packet counter
261 * @BATADV_CNT_DAT_GET_RX: received dht GET traffic packet counter
262 * @BATADV_CNT_DAT_PUT_TX: transmitted dht PUT traffic packet counter
263 * @BATADV_CNT_DAT_PUT_RX: received dht PUT traffic packet counter
264 * @BATADV_CNT_DAT_CACHED_REPLY_TX: transmitted dat cache reply traffic packet
265 * counter
266 * @BATADV_CNT_NUM: number of traffic counters
267 */
162enum batadv_counters { 268enum batadv_counters {
163 BATADV_CNT_TX, 269 BATADV_CNT_TX,
164 BATADV_CNT_TX_BYTES, 270 BATADV_CNT_TX_BYTES,
@@ -190,14 +296,23 @@ enum batadv_counters {
190/** 296/**
191 * struct batadv_priv_tt - per mesh interface translation table data 297 * struct batadv_priv_tt - per mesh interface translation table data
192 * @vn: translation table version number 298 * @vn: translation table version number
299 * @ogm_append_cnt: counter of number of OGMs containing the local tt diff
193 * @local_changes: changes registered in an originator interval 300 * @local_changes: changes registered in an originator interval
194 * @poss_change: Detect an ongoing roaming phase. If true, then this node
195 * received a roaming_adv and has to inspect every packet directed to it to
196 * check whether it still is the true destination or not. This flag will be
197 * reset to false as soon as the this node's ttvn is increased
198 * @changes_list: tracks tt local changes within an originator interval 301 * @changes_list: tracks tt local changes within an originator interval
199 * @req_list: list of pending tt_requests 302 * @local_hash: local translation table hash table
303 * @global_hash: global translation table hash table
304 * @req_list: list of pending & unanswered tt_requests
305 * @roam_list: list of the last roaming events of each client limiting the
306 * number of roaming events to avoid route flapping
307 * @changes_list_lock: lock protecting changes_list
308 * @req_list_lock: lock protecting req_list
309 * @roam_list_lock: lock protecting roam_list
310 * @local_entry_num: number of entries in the local hash table
200 * @local_crc: Checksum of the local table, recomputed before sending a new OGM 311 * @local_crc: Checksum of the local table, recomputed before sending a new OGM
312 * @last_changeset: last tt changeset this host has generated
313 * @last_changeset_len: length of last tt changeset this host has generated
314 * @last_changeset_lock: lock protecting last_changeset & last_changeset_len
315 * @work: work queue callback item for translation table purging
201 */ 316 */
202struct batadv_priv_tt { 317struct batadv_priv_tt {
203 atomic_t vn; 318 atomic_t vn;
@@ -215,24 +330,45 @@ struct batadv_priv_tt {
215 uint16_t local_crc; 330 uint16_t local_crc;
216 unsigned char *last_changeset; 331 unsigned char *last_changeset;
217 int16_t last_changeset_len; 332 int16_t last_changeset_len;
218 spinlock_t last_changeset_lock; /* protects last_changeset */ 333 /* protects last_changeset & last_changeset_len */
334 spinlock_t last_changeset_lock;
219 struct delayed_work work; 335 struct delayed_work work;
220}; 336};
221 337
338/**
339 * struct batadv_priv_bla - per mesh interface bridge loope avoidance data
340 * @num_requests; number of bla requests in flight
341 * @claim_hash: hash table containing mesh nodes this host has claimed
342 * @backbone_hash: hash table containing all detected backbone gateways
343 * @bcast_duplist: recently received broadcast packets array (for broadcast
344 * duplicate suppression)
345 * @bcast_duplist_curr: index of last broadcast packet added to bcast_duplist
346 * @bcast_duplist_lock: lock protecting bcast_duplist & bcast_duplist_curr
347 * @claim_dest: local claim data (e.g. claim group)
348 * @work: work queue callback item for cleanups & bla announcements
349 */
222#ifdef CONFIG_BATMAN_ADV_BLA 350#ifdef CONFIG_BATMAN_ADV_BLA
223struct batadv_priv_bla { 351struct batadv_priv_bla {
224 atomic_t num_requests; /* number of bla requests in flight */ 352 atomic_t num_requests;
225 struct batadv_hashtable *claim_hash; 353 struct batadv_hashtable *claim_hash;
226 struct batadv_hashtable *backbone_hash; 354 struct batadv_hashtable *backbone_hash;
227 struct batadv_bcast_duplist_entry bcast_duplist[BATADV_DUPLIST_SIZE]; 355 struct batadv_bcast_duplist_entry bcast_duplist[BATADV_DUPLIST_SIZE];
228 int bcast_duplist_curr; 356 int bcast_duplist_curr;
229 /* protects bcast_duplist and bcast_duplist_curr */ 357 /* protects bcast_duplist & bcast_duplist_curr */
230 spinlock_t bcast_duplist_lock; 358 spinlock_t bcast_duplist_lock;
231 struct batadv_bla_claim_dst claim_dest; 359 struct batadv_bla_claim_dst claim_dest;
232 struct delayed_work work; 360 struct delayed_work work;
233}; 361};
234#endif 362#endif
235 363
364/**
365 * struct batadv_debug_log - debug logging data
366 * @log_buff: buffer holding the logs (ring bufer)
367 * @log_start: index of next character to read
368 * @log_end: index of next character to write
369 * @lock: lock protecting log_buff, log_start & log_end
370 * @queue_wait: log reader's wait queue
371 */
236#ifdef CONFIG_BATMAN_ADV_DEBUG 372#ifdef CONFIG_BATMAN_ADV_DEBUG
237struct batadv_priv_debug_log { 373struct batadv_priv_debug_log {
238 char log_buff[BATADV_LOG_BUF_LEN]; 374 char log_buff[BATADV_LOG_BUF_LEN];
@@ -243,18 +379,34 @@ struct batadv_priv_debug_log {
243}; 379};
244#endif 380#endif
245 381
382/**
383 * struct batadv_priv_gw - per mesh interface gateway data
384 * @list: list of available gateway nodes
385 * @list_lock: lock protecting gw_list & curr_gw
386 * @curr_gw: pointer to currently selected gateway node
387 * @reselect: bool indicating a gateway re-selection is in progress
388 */
246struct batadv_priv_gw { 389struct batadv_priv_gw {
247 struct hlist_head list; 390 struct hlist_head list;
248 spinlock_t list_lock; /* protects gw_list and curr_gw */ 391 spinlock_t list_lock; /* protects gw_list & curr_gw */
249 struct batadv_gw_node __rcu *curr_gw; /* rcu protected pointer */ 392 struct batadv_gw_node __rcu *curr_gw; /* rcu protected pointer */
250 atomic_t reselect; 393 atomic_t reselect;
251}; 394};
252 395
396/**
397 * struct batadv_priv_vis - per mesh interface vis data
398 * @send_list: list of batadv_vis_info packets to sent
399 * @hash: hash table containing vis data from other nodes in the network
400 * @hash_lock: lock protecting the hash table
401 * @list_lock: lock protecting my_info::recv_list
402 * @work: work queue callback item for vis packet sending
403 * @my_info: holds this node's vis data sent on a regular basis
404 */
253struct batadv_priv_vis { 405struct batadv_priv_vis {
254 struct list_head send_list; 406 struct list_head send_list;
255 struct batadv_hashtable *hash; 407 struct batadv_hashtable *hash;
256 spinlock_t hash_lock; /* protects hash */ 408 spinlock_t hash_lock; /* protects hash */
257 spinlock_t list_lock; /* protects info::recv_list */ 409 spinlock_t list_lock; /* protects my_info::recv_list */
258 struct delayed_work work; 410 struct delayed_work work;
259 struct batadv_vis_info *my_info; 411 struct batadv_vis_info *my_info;
260}; 412};
@@ -273,28 +425,70 @@ struct batadv_priv_dat {
273}; 425};
274#endif 426#endif
275 427
428/**
429 * struct batadv_priv - per mesh interface data
430 * @mesh_state: current status of the mesh (inactive/active/deactivating)
431 * @stats: structure holding the data for the ndo_get_stats() call
432 * @bat_counters: mesh internal traffic statistic counters (see batadv_counters)
433 * @aggregated_ogms: bool indicating whether OGM aggregation is enabled
434 * @bonding: bool indicating whether traffic bonding is enabled
435 * @fragmentation: bool indicating whether traffic fragmentation is enabled
436 * @ap_isolation: bool indicating whether ap isolation is enabled
437 * @bridge_loop_avoidance: bool indicating whether bridge loop avoidance is
438 * enabled
439 * @distributed_arp_table: bool indicating whether distributed ARP table is
440 * enabled
441 * @vis_mode: vis operation: client or server (see batadv_vis_packettype)
442 * @gw_mode: gateway operation: off, client or server (see batadv_gw_modes)
443 * @gw_sel_class: gateway selection class (applies if gw_mode client)
444 * @gw_bandwidth: gateway announced bandwidth (applies if gw_mode server)
445 * @orig_interval: OGM broadcast interval in milliseconds
446 * @hop_penalty: penalty which will be applied to an OGM's tq-field on every hop
447 * @log_level: configured log level (see batadv_dbg_level)
448 * @bcast_seqno: last sent broadcast packet sequence number
449 * @bcast_queue_left: number of remaining buffered broadcast packet slots
450 * @batman_queue_left: number of remaining OGM packet slots
451 * @num_ifaces: number of interfaces assigned to this mesh interface
452 * @mesh_obj: kobject for sysfs mesh subdirectory
453 * @debug_dir: dentry for debugfs batman-adv subdirectory
454 * @forw_bat_list: list of aggregated OGMs that will be forwarded
455 * @forw_bcast_list: list of broadcast packets that will be rebroadcasted
456 * @orig_hash: hash table containing mesh participants (orig nodes)
457 * @forw_bat_list_lock: lock protecting forw_bat_list
458 * @forw_bcast_list_lock: lock protecting forw_bcast_list
459 * @orig_work: work queue callback item for orig node purging
460 * @primary_if: one of the hard interfaces assigned to this mesh interface
461 * becomes the primary interface
462 * @bat_algo_ops: routing algorithm used by this mesh interface
463 * @bla: bridge loope avoidance data
464 * @debug_log: holding debug logging relevant data
465 * @gw: gateway data
466 * @tt: translation table data
467 * @vis: vis data
468 * @dat: distributed arp table data
469 */
276struct batadv_priv { 470struct batadv_priv {
277 atomic_t mesh_state; 471 atomic_t mesh_state;
278 struct net_device_stats stats; 472 struct net_device_stats stats;
279 uint64_t __percpu *bat_counters; /* Per cpu counters */ 473 uint64_t __percpu *bat_counters; /* Per cpu counters */
280 atomic_t aggregated_ogms; /* boolean */ 474 atomic_t aggregated_ogms;
281 atomic_t bonding; /* boolean */ 475 atomic_t bonding;
282 atomic_t fragmentation; /* boolean */ 476 atomic_t fragmentation;
283 atomic_t ap_isolation; /* boolean */ 477 atomic_t ap_isolation;
284#ifdef CONFIG_BATMAN_ADV_BLA 478#ifdef CONFIG_BATMAN_ADV_BLA
285 atomic_t bridge_loop_avoidance; /* boolean */ 479 atomic_t bridge_loop_avoidance;
286#endif 480#endif
287#ifdef CONFIG_BATMAN_ADV_DAT 481#ifdef CONFIG_BATMAN_ADV_DAT
288 atomic_t distributed_arp_table; /* boolean */ 482 atomic_t distributed_arp_table;
289#endif 483#endif
290 atomic_t vis_mode; /* VIS_TYPE_* */ 484 atomic_t vis_mode;
291 atomic_t gw_mode; /* GW_MODE_* */ 485 atomic_t gw_mode;
292 atomic_t gw_sel_class; /* uint */ 486 atomic_t gw_sel_class;
293 atomic_t gw_bandwidth; /* gw bandwidth */ 487 atomic_t gw_bandwidth;
294 atomic_t orig_interval; /* uint */ 488 atomic_t orig_interval;
295 atomic_t hop_penalty; /* uint */ 489 atomic_t hop_penalty;
296#ifdef CONFIG_BATMAN_ADV_DEBUG 490#ifdef CONFIG_BATMAN_ADV_DEBUG
297 atomic_t log_level; /* uint */ 491 atomic_t log_level;
298#endif 492#endif
299 atomic_t bcast_seqno; 493 atomic_t bcast_seqno;
300 atomic_t bcast_queue_left; 494 atomic_t bcast_queue_left;
@@ -324,46 +518,97 @@ struct batadv_priv {
324#endif 518#endif
325}; 519};
326 520
521/**
522 * struct batadv_socket_client - layer2 icmp socket client data
523 * @queue_list: packet queue for packets destined for this socket client
524 * @queue_len: number of packets in the packet queue (queue_list)
525 * @index: socket client's index in the batadv_socket_client_hash
526 * @lock: lock protecting queue_list, queue_len & index
527 * @queue_wait: socket client's wait queue
528 * @bat_priv: pointer to soft_iface this client belongs to
529 */
327struct batadv_socket_client { 530struct batadv_socket_client {
328 struct list_head queue_list; 531 struct list_head queue_list;
329 unsigned int queue_len; 532 unsigned int queue_len;
330 unsigned char index; 533 unsigned char index;
331 spinlock_t lock; /* protects queue_list, queue_len, index */ 534 spinlock_t lock; /* protects queue_list, queue_len & index */
332 wait_queue_head_t queue_wait; 535 wait_queue_head_t queue_wait;
333 struct batadv_priv *bat_priv; 536 struct batadv_priv *bat_priv;
334}; 537};
335 538
539/**
540 * struct batadv_socket_packet - layer2 icmp packet for socket client
541 * @list: list node for batadv_socket_client::queue_list
542 * @icmp_len: size of the layer2 icmp packet
543 * @icmp_packet: layer2 icmp packet
544 */
336struct batadv_socket_packet { 545struct batadv_socket_packet {
337 struct list_head list; 546 struct list_head list;
338 size_t icmp_len; 547 size_t icmp_len;
339 struct batadv_icmp_packet_rr icmp_packet; 548 struct batadv_icmp_packet_rr icmp_packet;
340}; 549};
341 550
551/**
552 * struct batadv_bla_backbone_gw - batman-adv gateway bridged into the LAN
553 * @orig: originator address of backbone node (mac address of primary iface)
554 * @vid: vlan id this gateway was detected on
555 * @hash_entry: hlist node for batadv_priv_bla::backbone_hash
556 * @bat_priv: pointer to soft_iface this backbone gateway belongs to
557 * @lasttime: last time we heard of this backbone gw
558 * @wait_periods: grace time for bridge forward delays and bla group forming at
559 * bootup phase - no bcast traffic is formwared until it has elapsed
560 * @request_sent: if this bool is set to true we are out of sync with this
561 * backbone gateway - no bcast traffic is formwared until the situation was
562 * resolved
563 * @crc: crc16 checksum over all claims
564 * @refcount: number of contexts the object is used
565 * @rcu: struct used for freeing in an RCU-safe manner
566 */
342#ifdef CONFIG_BATMAN_ADV_BLA 567#ifdef CONFIG_BATMAN_ADV_BLA
343struct batadv_bla_backbone_gw { 568struct batadv_bla_backbone_gw {
344 uint8_t orig[ETH_ALEN]; 569 uint8_t orig[ETH_ALEN];
345 short vid; /* used VLAN ID */ 570 short vid;
346 struct hlist_node hash_entry; 571 struct hlist_node hash_entry;
347 struct batadv_priv *bat_priv; 572 struct batadv_priv *bat_priv;
348 unsigned long lasttime; /* last time we heard of this backbone gw */ 573 unsigned long lasttime;
349 atomic_t wait_periods; 574 atomic_t wait_periods;
350 atomic_t request_sent; 575 atomic_t request_sent;
576 uint16_t crc;
351 atomic_t refcount; 577 atomic_t refcount;
352 struct rcu_head rcu; 578 struct rcu_head rcu;
353 uint16_t crc; /* crc checksum over all claims */
354}; 579};
355 580
581/**
582 * struct batadv_bla_claim - claimed non-mesh client structure
583 * @addr: mac address of claimed non-mesh client
584 * @vid: vlan id this client was detected on
585 * @batadv_bla_backbone_gw: pointer to backbone gw claiming this client
586 * @lasttime: last time we heard of claim (locals only)
587 * @hash_entry: hlist node for batadv_priv_bla::claim_hash
588 * @refcount: number of contexts the object is used
589 * @rcu: struct used for freeing in an RCU-safe manner
590 */
356struct batadv_bla_claim { 591struct batadv_bla_claim {
357 uint8_t addr[ETH_ALEN]; 592 uint8_t addr[ETH_ALEN];
358 short vid; 593 short vid;
359 struct batadv_bla_backbone_gw *backbone_gw; 594 struct batadv_bla_backbone_gw *backbone_gw;
360 unsigned long lasttime; /* last time we heard of claim (locals only) */ 595 unsigned long lasttime;
596 struct hlist_node hash_entry;
361 struct rcu_head rcu; 597 struct rcu_head rcu;
362 atomic_t refcount; 598 atomic_t refcount;
363 struct hlist_node hash_entry;
364}; 599};
365#endif 600#endif
366 601
602/**
603 * struct batadv_tt_common_entry - tt local & tt global common data
604 * @addr: mac address of non-mesh client
605 * @hash_entry: hlist node for batadv_priv_tt::local_hash or for
606 * batadv_priv_tt::global_hash
607 * @flags: various state handling flags (see batadv_tt_client_flags)
608 * @added_at: timestamp used for purging stale tt common entries
609 * @refcount: number of contexts the object is used
610 * @rcu: struct used for freeing in an RCU-safe manner
611 */
367struct batadv_tt_common_entry { 612struct batadv_tt_common_entry {
368 uint8_t addr[ETH_ALEN]; 613 uint8_t addr[ETH_ALEN];
369 struct hlist_node hash_entry; 614 struct hlist_node hash_entry;
@@ -373,37 +618,76 @@ struct batadv_tt_common_entry {
373 struct rcu_head rcu; 618 struct rcu_head rcu;
374}; 619};
375 620
621/**
622 * struct batadv_tt_local_entry - translation table local entry data
623 * @common: general translation table data
624 * @last_seen: timestamp used for purging stale tt local entries
625 */
376struct batadv_tt_local_entry { 626struct batadv_tt_local_entry {
377 struct batadv_tt_common_entry common; 627 struct batadv_tt_common_entry common;
378 unsigned long last_seen; 628 unsigned long last_seen;
379}; 629};
380 630
631/**
632 * struct batadv_tt_global_entry - translation table global entry data
633 * @common: general translation table data
634 * @orig_list: list of orig nodes announcing this non-mesh client
635 * @list_lock: lock protecting orig_list
636 * @roam_at: time at which TT_GLOBAL_ROAM was set
637 */
381struct batadv_tt_global_entry { 638struct batadv_tt_global_entry {
382 struct batadv_tt_common_entry common; 639 struct batadv_tt_common_entry common;
383 struct hlist_head orig_list; 640 struct hlist_head orig_list;
384 spinlock_t list_lock; /* protects the list */ 641 spinlock_t list_lock; /* protects orig_list */
385 unsigned long roam_at; /* time at which TT_GLOBAL_ROAM was set */ 642 unsigned long roam_at;
386}; 643};
387 644
645/**
646 * struct batadv_tt_orig_list_entry - orig node announcing a non-mesh client
647 * @orig_node: pointer to orig node announcing this non-mesh client
648 * @ttvn: translation table version number which added the non-mesh client
649 * @list: list node for batadv_tt_global_entry::orig_list
650 * @refcount: number of contexts the object is used
651 * @rcu: struct used for freeing in an RCU-safe manner
652 */
388struct batadv_tt_orig_list_entry { 653struct batadv_tt_orig_list_entry {
389 struct batadv_orig_node *orig_node; 654 struct batadv_orig_node *orig_node;
390 uint8_t ttvn; 655 uint8_t ttvn;
656 struct hlist_node list;
391 atomic_t refcount; 657 atomic_t refcount;
392 struct rcu_head rcu; 658 struct rcu_head rcu;
393 struct hlist_node list;
394}; 659};
395 660
661/**
662 * struct batadv_tt_change_node - structure for tt changes occured
663 * @list: list node for batadv_priv_tt::changes_list
664 * @change: holds the actual translation table diff data
665 */
396struct batadv_tt_change_node { 666struct batadv_tt_change_node {
397 struct list_head list; 667 struct list_head list;
398 struct batadv_tt_change change; 668 struct batadv_tt_change change;
399}; 669};
400 670
671/**
672 * struct batadv_tt_req_node - data to keep track of the tt requests in flight
673 * @addr: mac address address of the originator this request was sent to
674 * @issued_at: timestamp used for purging stale tt requests
675 * @list: list node for batadv_priv_tt::req_list
676 */
401struct batadv_tt_req_node { 677struct batadv_tt_req_node {
402 uint8_t addr[ETH_ALEN]; 678 uint8_t addr[ETH_ALEN];
403 unsigned long issued_at; 679 unsigned long issued_at;
404 struct list_head list; 680 struct list_head list;
405}; 681};
406 682
683/**
684 * struct batadv_tt_roam_node - roaming client data
685 * @addr: mac address of the client in the roaming phase
686 * @counter: number of allowed roaming events per client within a single
687 * OGM interval (changes are committed with each OGM)
688 * @first_time: timestamp used for purging stale roaming node entries
689 * @list: list node for batadv_priv_tt::roam_list
690 */
407struct batadv_tt_roam_node { 691struct batadv_tt_roam_node {
408 uint8_t addr[ETH_ALEN]; 692 uint8_t addr[ETH_ALEN];
409 atomic_t counter; 693 atomic_t counter;
@@ -411,8 +695,19 @@ struct batadv_tt_roam_node {
411 struct list_head list; 695 struct list_head list;
412}; 696};
413 697
414/* forw_packet - structure for forw_list maintaining packets to be 698/**
415 * send/forwarded 699 * struct batadv_forw_packet - structure for bcast packets to be sent/forwarded
700 * @list: list node for batadv_socket_client::queue_list
701 * @send_time: execution time for delayed_work (packet sending)
702 * @own: bool for locally generated packets (local OGMs are re-scheduled after
703 * sending)
704 * @skb: bcast packet's skb buffer
705 * @packet_len: size of aggregated OGM packet inside the skb buffer
706 * @direct_link_flags: direct link flags for aggregated OGM packets
707 * @num_packets: counter for bcast packet retransmission
708 * @delayed_work: work queue callback item for packet sending
709 * @if_incoming: pointer incoming hard-iface or primary iface if locally
710 * generated packet
416 */ 711 */
417struct batadv_forw_packet { 712struct batadv_forw_packet {
418 struct hlist_node list; 713 struct hlist_node list;
@@ -426,39 +721,69 @@ struct batadv_forw_packet {
426 struct batadv_hard_iface *if_incoming; 721 struct batadv_hard_iface *if_incoming;
427}; 722};
428 723
724/**
725 * struct batadv_frag_packet_list_entry - storage for fragment packet
726 * @list: list node for orig_node::frag_list
727 * @seqno: sequence number of the fragment
728 * @skb: fragment's skb buffer
729 */
429struct batadv_frag_packet_list_entry { 730struct batadv_frag_packet_list_entry {
430 struct list_head list; 731 struct list_head list;
431 uint16_t seqno; 732 uint16_t seqno;
432 struct sk_buff *skb; 733 struct sk_buff *skb;
433}; 734};
434 735
736/**
737 * struct batadv_vis_info - local data for vis information
738 * @first_seen: timestamp used for purging stale vis info entries
739 * @recv_list: List of server-neighbors we have received this packet from. This
740 * packet should not be re-forward to them again. List elements are struct
741 * batadv_vis_recvlist_node
742 * @send_list: list of packets to be forwarded
743 * @refcount: number of contexts the object is used
744 * @hash_entry: hlist node for batadv_priv_vis::hash
745 * @bat_priv: pointer to soft_iface this orig node belongs to
746 * @skb_packet: contains the vis packet
747 */
435struct batadv_vis_info { 748struct batadv_vis_info {
436 unsigned long first_seen; 749 unsigned long first_seen;
437 /* list of server-neighbors we received a vis-packet
438 * from. we should not reply to them.
439 */
440 struct list_head recv_list; 750 struct list_head recv_list;
441 struct list_head send_list; 751 struct list_head send_list;
442 struct kref refcount; 752 struct kref refcount;
443 struct hlist_node hash_entry; 753 struct hlist_node hash_entry;
444 struct batadv_priv *bat_priv; 754 struct batadv_priv *bat_priv;
445 /* this packet might be part of the vis send queue. */
446 struct sk_buff *skb_packet; 755 struct sk_buff *skb_packet;
447 /* vis_info may follow here */
448} __packed; 756} __packed;
449 757
758/**
759 * struct batadv_vis_info_entry - contains link information for vis
760 * @src: source MAC of the link, all zero for local TT entry
761 * @dst: destination MAC of the link, client mac address for local TT entry
762 * @quality: transmission quality of the link, or 0 for local TT entry
763 */
450struct batadv_vis_info_entry { 764struct batadv_vis_info_entry {
451 uint8_t src[ETH_ALEN]; 765 uint8_t src[ETH_ALEN];
452 uint8_t dest[ETH_ALEN]; 766 uint8_t dest[ETH_ALEN];
453 uint8_t quality; /* quality = 0 client */ 767 uint8_t quality;
454} __packed; 768} __packed;
455 769
770/**
771 * struct batadv_vis_recvlist_node - list entry for batadv_vis_info::recv_list
772 * @list: list node for batadv_vis_info::recv_list
773 * @mac: MAC address of the originator from where the vis_info was received
774 */
456struct batadv_vis_recvlist_node { 775struct batadv_vis_recvlist_node {
457 struct list_head list; 776 struct list_head list;
458 uint8_t mac[ETH_ALEN]; 777 uint8_t mac[ETH_ALEN];
459}; 778};
460 779
461/* While scanning for vis-entries of a particular vis-originator 780/**
781 * struct batadv_vis_if_list_entry - auxiliary data for vis data generation
782 * @addr: MAC address of the interface
783 * @primary: true if this interface is the primary interface
784 * @list: list node the interface list
785 *
786 * While scanning for vis-entries of a particular vis-originator
462 * this list collects its interfaces to create a subgraph/cluster 787 * this list collects its interfaces to create a subgraph/cluster
463 * out of them later 788 * out of them later
464 */ 789 */
@@ -468,22 +793,26 @@ struct batadv_vis_if_list_entry {
468 struct hlist_node list; 793 struct hlist_node list;
469}; 794};
470 795
796/**
797 * struct batadv_algo_ops - mesh algorithm callbacks
798 * @list: list node for the batadv_algo_list
799 * @name: name of the algorithm
800 * @bat_iface_enable: init routing info when hard-interface is enabled
801 * @bat_iface_disable: de-init routing info when hard-interface is disabled
802 * @bat_iface_update_mac: (re-)init mac addresses of the protocol information
803 * belonging to this hard-interface
804 * @bat_primary_iface_set: called when primary interface is selected / changed
805 * @bat_ogm_schedule: prepare a new outgoing OGM for the send queue
806 * @bat_ogm_emit: send scheduled OGM
807 */
471struct batadv_algo_ops { 808struct batadv_algo_ops {
472 struct hlist_node list; 809 struct hlist_node list;
473 char *name; 810 char *name;
474 /* init routing info when hard-interface is enabled */
475 int (*bat_iface_enable)(struct batadv_hard_iface *hard_iface); 811 int (*bat_iface_enable)(struct batadv_hard_iface *hard_iface);
476 /* de-init routing info when hard-interface is disabled */
477 void (*bat_iface_disable)(struct batadv_hard_iface *hard_iface); 812 void (*bat_iface_disable)(struct batadv_hard_iface *hard_iface);
478 /* (re-)init mac addresses of the protocol information
479 * belonging to this hard-interface
480 */
481 void (*bat_iface_update_mac)(struct batadv_hard_iface *hard_iface); 813 void (*bat_iface_update_mac)(struct batadv_hard_iface *hard_iface);
482 /* called when primary interface is selected / changed */
483 void (*bat_primary_iface_set)(struct batadv_hard_iface *hard_iface); 814 void (*bat_primary_iface_set)(struct batadv_hard_iface *hard_iface);
484 /* prepare a new outgoing OGM for the send queue */
485 void (*bat_ogm_schedule)(struct batadv_hard_iface *hard_iface); 815 void (*bat_ogm_schedule)(struct batadv_hard_iface *hard_iface);
486 /* send scheduled OGM */
487 void (*bat_ogm_emit)(struct batadv_forw_packet *forw_packet); 816 void (*bat_ogm_emit)(struct batadv_forw_packet *forw_packet);
488}; 817};
489 818