Blame view
include/net/bonding.h
18.7 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 3 4 5 6 7 8 9 10 11 12 |
/* * Bond several ethernet interfaces into a Cisco, running 'Etherchannel'. * * Portions are (c) Copyright 1995 Simon "Guru Aleph-Null" Janes * NCM: Network and Communications Management, Inc. * * BUT, I'm the one who modified it for ethernet, so: * (c) Copyright 1999, Thomas Davis, tadavis@lbl.gov * * This software may be used and distributed according to the terms * of the GNU Public License, incorporated herein by reference. * |
1da177e4c Linux-2.6.12-rc2 |
13 |
*/ |
1ef8019be net: Move bonding... |
14 15 |
#ifndef _NET_BONDING_H #define _NET_BONDING_H |
1da177e4c Linux-2.6.12-rc2 |
16 17 18 19 |
#include <linux/timer.h> #include <linux/proc_fs.h> #include <linux/if_bonding.h> |
e843fa508 bonding: Fix dead... |
20 |
#include <linux/cpumask.h> |
305d552ac bonding: send IPv... |
21 |
#include <linux/in6.h> |
8a8efa22f bonding: sync net... |
22 |
#include <linux/netpoll.h> |
eaddcd769 bonding: remove e... |
23 |
#include <linux/inetdevice.h> |
567b871e5 bonding: rlb mode... |
24 |
#include <linux/etherdevice.h> |
809fa972f reciprocal_divide... |
25 |
#include <linux/reciprocal_div.h> |
5f0c5f73e bonding: make glo... |
26 |
#include <linux/if_link.h> |
809fa972f reciprocal_divide... |
27 |
|
1ef8019be net: Move bonding... |
28 29 30 |
#include <net/bond_3ad.h> #include <net/bond_alb.h> #include <net/bond_options.h> |
1da177e4c Linux-2.6.12-rc2 |
31 |
|
1da177e4c Linux-2.6.12-rc2 |
32 |
#define BOND_MAX_ARP_TARGETS 16 |
fe9d04afe bonding: disable ... |
33 |
#define BOND_DEFAULT_MIIMON 100 |
1da177e4c Linux-2.6.12-rc2 |
34 |
/* |
1da177e4c Linux-2.6.12-rc2 |
35 36 37 38 39 40 41 42 43 44 45 |
* Less bad way to call ioctl from within the kernel; this needs to be * done some other way to get the call out of interrupt context. * Needs "ioctl" variable to be supplied by calling context. */ #define IOCTL(dev, arg, cmd) ({ \ int res = 0; \ mm_segment_t fs = get_fs(); \ set_fs(get_ds()); \ res = ioctl(dev, arg, cmd); \ set_fs(fs); \ res; }) |
01844098e bonding: create a... |
46 |
#define BOND_MODE(bond) ((bond)->params.mode) |
dec1e90e8 bonding: convert ... |
47 |
/* slave list primitives */ |
5a52405a3 bonding: convert ... |
48 49 50 |
#define bond_slave_list(bond) (&(bond)->dev->adj_list.lower) #define bond_has_slaves(bond) !list_empty(bond_slave_list(bond)) |
0965a1f3f bonding: add bond... |
51 |
|
dec1e90e8 bonding: convert ... |
52 53 |
/* IMPORTANT: bond_first/last_slave can return NULL in case of an empty list */ #define bond_first_slave(bond) \ |
5a52405a3 bonding: convert ... |
54 55 56 |
(bond_has_slaves(bond) ? \ netdev_adjacent_get_private(bond_slave_list(bond)->next) : \ NULL) |
dec1e90e8 bonding: convert ... |
57 |
#define bond_last_slave(bond) \ |
5a52405a3 bonding: convert ... |
58 59 60 |
(bond_has_slaves(bond) ? \ netdev_adjacent_get_private(bond_slave_list(bond)->prev) : \ NULL) |
dec1e90e8 bonding: convert ... |
61 |
|
e001bfad9 bonding: create b... |
62 63 64 |
/* Caller must have rcu_read_lock */ #define bond_first_slave_rcu(bond) \ netdev_lower_get_first_private_rcu(bond->dev) |
5a52405a3 bonding: convert ... |
65 66 |
#define bond_is_first_slave(bond, pos) (pos == bond_first_slave(bond)) #define bond_is_last_slave(bond, pos) (pos == bond_last_slave(bond)) |
dec1e90e8 bonding: convert ... |
67 |
|
1da177e4c Linux-2.6.12-rc2 |
68 |
/** |
dec1e90e8 bonding: convert ... |
69 70 71 |
* bond_for_each_slave - iterate over all slaves * @bond: the bond holding this list * @pos: current slave |
9caff1e7b bonding: make bon... |
72 |
* @iter: list_head * iterator |
1da177e4c Linux-2.6.12-rc2 |
73 |
* |
87163ef9c bonding: remove l... |
74 |
* Caller must hold RTNL |
1da177e4c Linux-2.6.12-rc2 |
75 |
*/ |
9caff1e7b bonding: make bon... |
76 77 |
#define bond_for_each_slave(bond, pos, iter) \ netdev_for_each_lower_private((bond)->dev, pos, iter) |
1da177e4c Linux-2.6.12-rc2 |
78 |
|
278b20837 bonding: initial ... |
79 |
/* Caller must have rcu_read_lock */ |
9caff1e7b bonding: make bon... |
80 81 |
#define bond_for_each_slave_rcu(bond, pos, iter) \ netdev_for_each_lower_private_rcu((bond)->dev, pos, iter) |
278b20837 bonding: initial ... |
82 |
|
e843fa508 bonding: Fix dead... |
83 |
#ifdef CONFIG_NET_POLL_CONTROLLER |
fb4fa76a1 net: Convert netp... |
84 |
extern atomic_t netpoll_block_tx; |
e843fa508 bonding: Fix dead... |
85 86 87 |
static inline void block_netpoll_tx(void) { |
fb4fa76a1 net: Convert netp... |
88 |
atomic_inc(&netpoll_block_tx); |
e843fa508 bonding: Fix dead... |
89 90 91 92 |
} static inline void unblock_netpoll_tx(void) { |
fb4fa76a1 net: Convert netp... |
93 |
atomic_dec(&netpoll_block_tx); |
e843fa508 bonding: Fix dead... |
94 95 96 97 |
} static inline int is_netpoll_tx_blocked(struct net_device *dev) { |
080e4130b netpoll: remove I... |
98 |
if (unlikely(netpoll_tx_running(dev))) |
fb4fa76a1 net: Convert netp... |
99 |
return atomic_read(&netpoll_block_tx); |
e843fa508 bonding: Fix dead... |
100 101 102 103 104 105 106 |
return 0; } #else #define block_netpoll_tx() #define unblock_netpoll_tx() #define is_netpoll_tx_blocked(dev) (0) #endif |
1da177e4c Linux-2.6.12-rc2 |
107 108 |
struct bond_params { int mode; |
169a3e666 bonding: xor/802.... |
109 |
int xmit_policy; |
1da177e4c Linux-2.6.12-rc2 |
110 |
int miimon; |
ad246c992 ipv4, ipv6, bondi... |
111 |
u8 num_peer_notif; |
1da177e4c Linux-2.6.12-rc2 |
112 |
int arp_interval; |
f5b2b966f [PATCH] bonding: ... |
113 |
int arp_validate; |
8599b52e1 bonding: add an o... |
114 |
int arp_all_targets; |
1da177e4c Linux-2.6.12-rc2 |
115 |
int use_carrier; |
dd957c57c net/bonding: Opti... |
116 |
int fail_over_mac; |
1da177e4c Linux-2.6.12-rc2 |
117 118 119 |
int updelay; int downdelay; int lacp_fast; |
655f8919d bonding: add min ... |
120 |
unsigned int min_links; |
fd989c833 bonding: alternat... |
121 |
int ad_select; |
1da177e4c Linux-2.6.12-rc2 |
122 |
char primary[IFNAMSIZ]; |
a549952ad bonding: introduc... |
123 |
int primary_reselect; |
d3bb52b09 endianness annota... |
124 |
__be32 arp_targets[BOND_MAX_ARP_TARGETS]; |
bb1d91232 bonding: allow us... |
125 |
int tx_queues; |
ebd8e4977 bonding: add all_... |
126 |
int all_slaves_active; |
c2952c314 bonding: add retr... |
127 |
int resend_igmp; |
7eacd0381 bonding: Make alb... |
128 |
int lp_interval; |
73958329e bonding: extend r... |
129 |
int packets_per_slave; |
e9f0fb884 bonding: Add tlb_... |
130 |
int tlb_dynamic_lb; |
809fa972f reciprocal_divide... |
131 |
struct reciprocal_value reciprocal_packets_per_slave; |
6791e4661 bonding: Allow us... |
132 |
u16 ad_actor_sys_prio; |
d22a5fc0c bonding: Implemen... |
133 |
u16 ad_user_port_key; |
745149575 bonding: Allow us... |
134 |
u8 ad_actor_system[ETH_ALEN]; |
1da177e4c Linux-2.6.12-rc2 |
135 |
}; |
12479f9a8 [PATCH] bonding: ... |
136 137 138 139 |
struct bond_parm_tbl { char *modename; int mode; }; |
69e611334 net/bonding: Noti... |
140 141 |
struct netdev_notify_work { struct delayed_work work; |
69e611334 net/bonding: Noti... |
142 |
struct net_device *dev; |
92e584fe4 net/bonding: Fix ... |
143 |
struct netdev_bonding_info bonding_info; |
69e611334 net/bonding: Noti... |
144 |
}; |
1da177e4c Linux-2.6.12-rc2 |
145 |
struct slave { |
e944ef791 [PATCH] bonding: ... |
146 |
struct net_device *dev; /* first - useful for panic debug */ |
35d48903e bonding: fix rx_h... |
147 |
struct bonding *bond; /* our master */ |
8bb5f96b0 [PATCH] bonding: ... |
148 |
int delay; |
8e603460f bonding: trivial:... |
149 150 |
/* all three in jiffies */ unsigned long last_link_up; |
49f17de72 bonding: rename l... |
151 |
unsigned long last_rx; |
8599b52e1 bonding: add an o... |
152 |
unsigned long target_last_arp_rx[BOND_MAX_ARP_TARGETS]; |
1da177e4c Linux-2.6.12-rc2 |
153 |
s8 link; /* one of BOND_LINK_XXXX */ |
b2220cad5 bonding: refactor... |
154 |
s8 new_link; |
2d7011ca7 bonding: get rid ... |
155 156 |
u8 backup:1, /* indicates backup slave. Value corresponds with BOND_STATE_ACTIVE and BOND_STATE_BACKUP */ |
5e5b06653 bonding: Fix RTNL... |
157 |
inactive:1, /* indicates inactive slave */ |
5d397061c bonding: allow no... |
158 159 |
should_notify:1, /* indicates whether the state changed */ should_notify_link:1; /* indicates whether the link changed */ |
5d30530ef net-bonding: Addi... |
160 |
u8 duplex; |
3158bf7d4 net/bonding: Hand... |
161 |
u32 original_mtu; |
1da177e4c Linux-2.6.12-rc2 |
162 |
u32 link_failure_count; |
5d30530ef net-bonding: Addi... |
163 |
u32 speed; |
bb1d91232 bonding: allow us... |
164 |
u16 queue_id; |
5d30530ef net-bonding: Addi... |
165 |
u8 perm_hwaddr[ETH_ALEN]; |
3fdddd859 bonding: alloc th... |
166 |
struct ad_slave_info *ad_info; |
1da177e4c Linux-2.6.12-rc2 |
167 |
struct tlb_slave_info tlb_info; |
8a8efa22f bonding: sync net... |
168 169 170 |
#ifdef CONFIG_NET_POLL_CONTROLLER struct netpoll *np; #endif |
07699f9a7 bonding: add sysf... |
171 |
struct kobject kobj; |
5f0c5f73e bonding: make glo... |
172 |
struct rtnl_link_stats64 slave_stats; |
1da177e4c Linux-2.6.12-rc2 |
173 |
}; |
ee6377147 bonding: Simplify... |
174 175 176 177 178 |
struct bond_up_slave { unsigned int count; struct rcu_head rcu; struct slave *arr[0]; }; |
1da177e4c Linux-2.6.12-rc2 |
179 |
/* |
b2220cad5 bonding: refactor... |
180 181 182 183 184 |
* Link pseudo-state only used internally by monitors */ #define BOND_LINK_NOCHANGE -1 /* |
1da177e4c Linux-2.6.12-rc2 |
185 |
* Here are the locking policies for the two bonding locks: |
1c72cfdc9 bonding: clean cu... |
186 |
* Get rcu_read_lock when reading or RTNL when writing slave list. |
1da177e4c Linux-2.6.12-rc2 |
187 188 |
*/ struct bonding { |
e944ef791 [PATCH] bonding: ... |
189 |
struct net_device *dev; /* first - useful for panic debug */ |
4740d6382 bonding: add prop... |
190 |
struct slave __rcu *curr_active_slave; |
857417183 bonding: add prop... |
191 |
struct slave __rcu *current_arp_slave; |
059b47e8a bonding: convert ... |
192 |
struct slave __rcu *primary_slave; |
ee6377147 bonding: Simplify... |
193 |
struct bond_up_slave __rcu *slave_arr; /* Array of usable slaves */ |
a549952ad bonding: introduc... |
194 |
bool force_primary; |
1da177e4c Linux-2.6.12-rc2 |
195 |
s32 slave_cnt; /* never change this value outside the attach/detach wrappers */ |
de063b704 bonding: remove p... |
196 197 |
int (*recv_probe)(const struct sk_buff *, struct bonding *, struct slave *); |
8c0bc5502 bonding: adjust l... |
198 199 |
/* mode_lock is used for mode-specific locking needs, currently used by: * 3ad mode (4) - protect against running bond_3ad_unbind_slave() and |
547942cac bonding: trivial:... |
200 201 |
* bond_3ad_state_machine_handler() concurrently and also * the access to the state machine shared variables. |
8c0bc5502 bonding: adjust l... |
202 203 204 |
* TLB mode (5) - to sync the use and modifications of its hash table * ALB mode (6) - to sync the use and modifications of its hash table */ |
b74356281 bonding: convert ... |
205 |
spinlock_t mode_lock; |
fe30937b6 bonding: fix bond... |
206 |
spinlock_t stats_lock; |
ad246c992 ipv4, ipv6, bondi... |
207 |
u8 send_peer_notif; |
4f5474e7f bonding: fix igmp... |
208 |
u8 igmp_retrans; |
1da177e4c Linux-2.6.12-rc2 |
209 210 211 212 213 |
#ifdef CONFIG_PROC_FS struct proc_dir_entry *proc_entry; char proc_file_name[IFNAMSIZ]; #endif /* CONFIG_PROC_FS */ struct list_head bond_list; |
73958329e bonding: extend r... |
214 |
u32 rr_tx_counter; |
1da177e4c Linux-2.6.12-rc2 |
215 216 217 |
struct ad_bond_info ad_info; struct alb_bond_info alb_info; struct bond_params params; |
1b76b3169 Convert bonding t... |
218 219 220 221 222 |
struct workqueue_struct *wq; struct delayed_work mii_work; struct delayed_work arp_work; struct delayed_work alb_work; struct delayed_work ad_work; |
5a37e8ca8 bonding: rejoin m... |
223 |
struct delayed_work mcast_work; |
ee6377147 bonding: Simplify... |
224 |
struct delayed_work slave_arr_work; |
f073c7ca2 bonding: add the ... |
225 |
#ifdef CONFIG_DEBUG_FS |
02582e9bc treewide: fix typ... |
226 |
/* debugging support via debugfs */ |
f073c7ca2 bonding: add the ... |
227 228 |
struct dentry *debug_dir; #endif /* CONFIG_DEBUG_FS */ |
5f0c5f73e bonding: make glo... |
229 |
struct rtnl_link_stats64 bond_stats; |
1da177e4c Linux-2.6.12-rc2 |
230 |
}; |
f1c1775ac bonding: register... |
231 232 |
#define bond_slave_get_rcu(dev) \ ((struct slave *) rcu_dereference(dev->rx_handler_data)) |
471cb5a33 bonding: remove u... |
233 234 |
#define bond_slave_get_rtnl(dev) \ ((struct slave *) rtnl_dereference(dev->rx_handler_data)) |
69e611334 net/bonding: Noti... |
235 |
void bond_queue_slave_event(struct slave *slave); |
f7c7eb7f7 bonding: implemen... |
236 |
void bond_lower_state_changed(struct slave *slave); |
69e611334 net/bonding: Noti... |
237 |
|
fbd929f2d bonding: support ... |
238 239 240 241 |
struct bond_vlan_tag { __be16 vlan_proto; unsigned short vlan_id; }; |
1da177e4c Linux-2.6.12-rc2 |
242 243 244 245 246 |
/** * Returns NULL if the net_device does not belong to any of the bond's slaves * * Caller must hold bond lock for read */ |
4ec952b8a bonding: fix spar... |
247 248 |
static inline struct slave *bond_get_slave_by_dev(struct bonding *bond, struct net_device *slave_dev) |
1da177e4c Linux-2.6.12-rc2 |
249 |
{ |
46bb4807b bonding: modify b... |
250 |
return netdev_lower_dev_get_private(bond->dev, slave_dev); |
1da177e4c Linux-2.6.12-rc2 |
251 |
} |
cceb904f9 [PATCH] drivers/n... |
252 |
static inline struct bonding *bond_get_bond_by_slave(struct slave *slave) |
1da177e4c Linux-2.6.12-rc2 |
253 |
{ |
471cb5a33 bonding: remove u... |
254 |
return slave->bond; |
1da177e4c Linux-2.6.12-rc2 |
255 |
} |
d1e2e5cd4 bonding: make TX_... |
256 257 |
static inline bool bond_should_override_tx_queue(struct bonding *bond) { |
01844098e bonding: create a... |
258 259 |
return BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP || BOND_MODE(bond) == BOND_MODE_ROUNDROBIN; |
d1e2e5cd4 bonding: make TX_... |
260 |
} |
584020542 bonding: add and ... |
261 262 |
static inline bool bond_is_lb(const struct bonding *bond) { |
01844098e bonding: create a... |
263 264 |
return BOND_MODE(bond) == BOND_MODE_TLB || BOND_MODE(bond) == BOND_MODE_ALB; |
584020542 bonding: add and ... |
265 |
} |
6b794c1cd bonding: Do not t... |
266 267 268 269 270 |
static inline bool bond_is_nondyn_tlb(const struct bonding *bond) { return (BOND_MODE(bond) == BOND_MODE_TLB) && (bond->params.tlb_dynamic_lb == 0); } |
d7021325a bonding: display ... |
271 272 273 274 275 276 |
static inline bool bond_mode_uses_xmit_hash(const struct bonding *bond) { return (BOND_MODE(bond) == BOND_MODE_8023AD || BOND_MODE(bond) == BOND_MODE_XOR || bond_is_nondyn_tlb(bond)); } |
267bed777 bonding: make BON... |
277 278 279 280 281 |
static inline bool bond_mode_uses_arp(int mode) { return mode != BOND_MODE_8023AD && mode != BOND_MODE_TLB && mode != BOND_MODE_ALB; } |
ec0865a94 bonding: make USE... |
282 283 284 285 286 287 288 289 |
static inline bool bond_mode_uses_primary(int mode) { return mode == BOND_MODE_ACTIVEBACKUP || mode == BOND_MODE_TLB || mode == BOND_MODE_ALB; } static inline bool bond_uses_primary(struct bonding *bond) { |
01844098e bonding: create a... |
290 |
return bond_mode_uses_primary(BOND_MODE(bond)); |
ec0865a94 bonding: make USE... |
291 |
} |
e99986954 net/bonding: Expo... |
292 293 294 295 296 297 |
static inline struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond) { struct slave *slave = rcu_dereference(bond->curr_active_slave); return bond_uses_primary(bond) && slave ? slave->dev : NULL; } |
b6adc610f bonding: convert ... |
298 299 300 301 |
static inline bool bond_slave_is_up(struct slave *slave) { return netif_running(slave->dev) && netif_carrier_ok(slave->dev); } |
e30bc066a bonding: wrap sla... |
302 303 |
static inline void bond_set_active_slave(struct slave *slave) { |
1d3ee88ae bonding: add netl... |
304 305 |
if (slave->backup) { slave->backup = 0; |
69e611334 net/bonding: Noti... |
306 |
bond_queue_slave_event(slave); |
f7c7eb7f7 bonding: implemen... |
307 |
bond_lower_state_changed(slave); |
072256d1f bonding: make sla... |
308 |
rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC); |
1d3ee88ae bonding: add netl... |
309 |
} |
e30bc066a bonding: wrap sla... |
310 311 312 313 |
} static inline void bond_set_backup_slave(struct slave *slave) { |
1d3ee88ae bonding: add netl... |
314 315 |
if (!slave->backup) { slave->backup = 1; |
69e611334 net/bonding: Noti... |
316 |
bond_queue_slave_event(slave); |
f7c7eb7f7 bonding: implemen... |
317 |
bond_lower_state_changed(slave); |
072256d1f bonding: make sla... |
318 |
rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC); |
1d3ee88ae bonding: add netl... |
319 |
} |
e30bc066a bonding: wrap sla... |
320 |
} |
5e5b06653 bonding: Fix RTNL... |
321 322 323 324 325 326 327 328 |
static inline void bond_set_slave_state(struct slave *slave, int slave_state, bool notify) { if (slave->backup == slave_state) return; slave->backup = slave_state; if (notify) { |
f7c7eb7f7 bonding: implemen... |
329 |
bond_lower_state_changed(slave); |
072256d1f bonding: make sla... |
330 |
rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC); |
69e611334 net/bonding: Noti... |
331 |
bond_queue_slave_event(slave); |
5e5b06653 bonding: Fix RTNL... |
332 333 334 335 336 337 338 339 |
slave->should_notify = 0; } else { if (slave->should_notify) slave->should_notify = 0; else slave->should_notify = 1; } } |
6fde8f037 bonding: fix lock... |
340 341 342 343 344 345 346 347 348 349 350 351 |
static inline void bond_slave_state_change(struct bonding *bond) { struct list_head *iter; struct slave *tmp; bond_for_each_slave(bond, tmp, iter) { if (tmp->link == BOND_LINK_UP) bond_set_active_slave(tmp); else if (tmp->link == BOND_LINK_DOWN) bond_set_backup_slave(tmp); } } |
b0929915e bonding: Fix RTNL... |
352 353 354 355 356 357 358 |
static inline void bond_slave_state_notify(struct bonding *bond) { struct list_head *iter; struct slave *tmp; bond_for_each_slave(bond, tmp, iter) { if (tmp->should_notify) { |
f7c7eb7f7 bonding: implemen... |
359 |
bond_lower_state_changed(tmp); |
072256d1f bonding: make sla... |
360 |
rtmsg_ifinfo(RTM_NEWLINK, tmp->dev, 0, GFP_ATOMIC); |
b0929915e bonding: Fix RTNL... |
361 362 363 364 |
tmp->should_notify = 0; } } } |
e30bc066a bonding: wrap sla... |
365 366 367 368 369 370 371 372 373 |
static inline int bond_slave_state(struct slave *slave) { return slave->backup; } static inline bool bond_is_active_slave(struct slave *slave) { return !bond_slave_state(slave); } |
891ab54d6 bonding: rename {... |
374 375 376 377 378 |
static inline bool bond_slave_can_tx(struct slave *slave) { return bond_slave_is_up(slave) && slave->link == BOND_LINK_UP && bond_is_active_slave(slave); } |
a549952ad bonding: introduc... |
379 380 381 |
#define BOND_PRI_RESELECT_ALWAYS 0 #define BOND_PRI_RESELECT_BETTER 1 #define BOND_PRI_RESELECT_FAILURE 2 |
3915c1e86 bonding: Add "fol... |
382 383 384 |
#define BOND_FOM_NONE 0 #define BOND_FOM_ACTIVE 1 #define BOND_FOM_FOLLOW 2 |
8599b52e1 bonding: add an o... |
385 386 |
#define BOND_ARP_TARGETS_ANY 0 #define BOND_ARP_TARGETS_ALL 1 |
f5b2b966f [PATCH] bonding: ... |
387 388 389 390 391 |
#define BOND_ARP_VALIDATE_NONE 0 #define BOND_ARP_VALIDATE_ACTIVE (1 << BOND_STATE_ACTIVE) #define BOND_ARP_VALIDATE_BACKUP (1 << BOND_STATE_BACKUP) #define BOND_ARP_VALIDATE_ALL (BOND_ARP_VALIDATE_ACTIVE | \ BOND_ARP_VALIDATE_BACKUP) |
896149ff1 bonding: extend a... |
392 393 394 395 396 |
#define BOND_ARP_FILTER (BOND_ARP_VALIDATE_ALL + 1) #define BOND_ARP_FILTER_ACTIVE (BOND_ARP_VALIDATE_ACTIVE | \ BOND_ARP_FILTER) #define BOND_ARP_FILTER_BACKUP (BOND_ARP_VALIDATE_BACKUP | \ BOND_ARP_FILTER) |
f5b2b966f [PATCH] bonding: ... |
397 |
|
5e5b06653 bonding: Fix RTNL... |
398 399 |
#define BOND_SLAVE_NOTIFY_NOW true #define BOND_SLAVE_NOTIFY_LATER false |
079ca7da1 bonding.h: "exter... |
400 401 |
static inline int slave_do_arp_validate(struct bonding *bond, struct slave *slave) |
f5b2b966f [PATCH] bonding: ... |
402 |
{ |
e30bc066a bonding: wrap sla... |
403 |
return bond->params.arp_validate & (1 << bond_slave_state(slave)); |
f5b2b966f [PATCH] bonding: ... |
404 |
} |
bedabf903 bonding: simplify... |
405 |
static inline int slave_do_arp_validate_only(struct bonding *bond) |
896149ff1 bonding: extend a... |
406 407 408 |
{ return bond->params.arp_validate & BOND_ARP_FILTER; } |
2807a9feb bonding: make IS_... |
409 410 411 412 |
static inline int bond_is_ip_target_ok(__be32 addr) { return !ipv4_is_lbcast(addr) && !ipv4_is_zeronet(addr); } |
8599b52e1 bonding: add an o... |
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 |
/* Get the oldest arp which we've received on this slave for bond's * arp_targets. */ static inline unsigned long slave_oldest_target_arp_rx(struct bonding *bond, struct slave *slave) { int i = 1; unsigned long ret = slave->target_last_arp_rx[0]; for (; (i < BOND_MAX_ARP_TARGETS) && bond->params.arp_targets[i]; i++) if (time_before(slave->target_last_arp_rx[i], ret)) ret = slave->target_last_arp_rx[i]; return ret; } |
079ca7da1 bonding.h: "exter... |
428 |
static inline unsigned long slave_last_rx(struct bonding *bond, |
f8a8ccd56 bonding: ARP moni... |
429 |
struct slave *slave) |
f5b2b966f [PATCH] bonding: ... |
430 |
{ |
9f2427383 bonding: use last... |
431 432 |
if (bond->params.arp_all_targets == BOND_ARP_TARGETS_ALL) return slave_oldest_target_arp_rx(bond, slave); |
f5b2b966f [PATCH] bonding: ... |
433 |
|
49f17de72 bonding: rename l... |
434 |
return slave->last_rx; |
f5b2b966f [PATCH] bonding: ... |
435 |
} |
8a8efa22f bonding: sync net... |
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
#ifdef CONFIG_NET_POLL_CONTROLLER static inline void bond_netpoll_send_skb(const struct slave *slave, struct sk_buff *skb) { struct netpoll *np = slave->np; if (np) netpoll_send_skb(np, skb); } #else static inline void bond_netpoll_send_skb(const struct slave *slave, struct sk_buff *skb) { } #endif |
5e5b06653 bonding: Fix RTNL... |
451 452 |
static inline void bond_set_slave_inactive_flags(struct slave *slave, bool notify) |
1da177e4c Linux-2.6.12-rc2 |
453 |
{ |
471cb5a33 bonding: remove u... |
454 |
if (!bond_is_lb(slave->bond)) |
5e5b06653 bonding: Fix RTNL... |
455 |
bond_set_slave_state(slave, BOND_STATE_BACKUP, notify); |
471cb5a33 bonding: remove u... |
456 |
if (!slave->bond->params.all_slaves_active) |
2d7011ca7 bonding: get rid ... |
457 |
slave->inactive = 1; |
1da177e4c Linux-2.6.12-rc2 |
458 |
} |
5e5b06653 bonding: Fix RTNL... |
459 460 |
static inline void bond_set_slave_active_flags(struct slave *slave, bool notify) |
1da177e4c Linux-2.6.12-rc2 |
461 |
{ |
5e5b06653 bonding: Fix RTNL... |
462 |
bond_set_slave_state(slave, BOND_STATE_ACTIVE, notify); |
2d7011ca7 bonding: get rid ... |
463 464 465 466 467 468 |
slave->inactive = 0; } static inline bool bond_is_slave_inactive(struct slave *slave) { return slave->inactive; |
1da177e4c Linux-2.6.12-rc2 |
469 |
} |
5d397061c bonding: allow no... |
470 471 |
static inline void bond_set_slave_link_state(struct slave *slave, int state, bool notify) |
69a2338e0 net/bonding: Move... |
472 |
{ |
5d397061c bonding: allow no... |
473 474 |
if (slave->link == state) return; |
69a2338e0 net/bonding: Move... |
475 |
slave->link = state; |
5d397061c bonding: allow no... |
476 477 |
if (notify) { bond_queue_slave_event(slave); |
f7c7eb7f7 bonding: implemen... |
478 |
bond_lower_state_changed(slave); |
5d397061c bonding: allow no... |
479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 |
slave->should_notify_link = 0; } else { if (slave->should_notify_link) slave->should_notify_link = 0; else slave->should_notify_link = 1; } } static inline void bond_slave_link_notify(struct bonding *bond) { struct list_head *iter; struct slave *tmp; bond_for_each_slave(bond, tmp, iter) { if (tmp->should_notify_link) { bond_queue_slave_event(tmp); |
f7c7eb7f7 bonding: implemen... |
496 |
bond_lower_state_changed(tmp); |
5d397061c bonding: allow no... |
497 498 499 |
tmp->should_notify_link = 0; } } |
69a2338e0 net/bonding: Move... |
500 |
} |
eaddcd769 bonding: remove e... |
501 502 503 504 505 506 507 508 509 |
static inline __be32 bond_confirm_addr(struct net_device *dev, __be32 dst, __be32 local) { struct in_device *in_dev; __be32 addr = 0; rcu_read_lock(); in_dev = __in_dev_get_rcu(dev); if (in_dev) |
b601fa197 ipv4: fix wildcar... |
510 511 |
addr = inet_confirm_addr(dev_net(dev), in_dev, dst, local, RT_SCOPE_HOST); |
eaddcd769 bonding: remove e... |
512 513 514 |
rcu_read_unlock(); return addr; } |
31924325f bonding: remove t... |
515 516 517 518 519 520 521 522 |
struct bond_net { struct net *net; /* Associated network namespace */ struct list_head dev_list; #ifdef CONFIG_PROC_FS struct proc_dir_entry *proc_dir; #endif struct class_attribute class_attr_bonding_masters; }; |
4c22400ab bonding: Use a pe... |
523 |
|
5bb9e0b50 bonding: fix bond... |
524 |
int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond, struct slave *slave); |
d316dedd4 bonding: remove u... |
525 |
void bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev); |
ec87fd3b4 bond: Add support... |
526 |
int bond_create(struct net *net, const char *name); |
4c22400ab bonding: Use a pe... |
527 528 |
int bond_create_sysfs(struct bond_net *net); void bond_destroy_sysfs(struct bond_net *net); |
6151b3d43 bond: Simply bond... |
529 |
void bond_prepare_sysfs_group(struct bonding *bond); |
07699f9a7 bonding: add sysf... |
530 531 |
int bond_sysfs_slave_add(struct slave *slave); void bond_sysfs_slave_del(struct slave *slave); |
a77b53258 [PATCH] bonding: ... |
532 533 |
int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev); int bond_release(struct net_device *bond_dev, struct net_device *slave_dev); |
ee62e8681 bonding: Changed ... |
534 |
u32 bond_xmit_hash(struct bonding *bond, struct sk_buff *skb); |
2477bc9a3 bonding: update b... |
535 |
int bond_set_carrier(struct bonding *bond); |
a77b53258 [PATCH] bonding: ... |
536 537 |
void bond_select_active_slave(struct bonding *bond); void bond_change_active_slave(struct bonding *bond, struct slave *new_active); |
f073c7ca2 bonding: add the ... |
538 539 540 541 542 |
void bond_create_debugfs(void); void bond_destroy_debugfs(void); void bond_debug_register(struct bonding *bond); void bond_debug_unregister(struct bonding *bond); void bond_debug_reregister(struct bonding *bond); |
d30ee670f net-bonding: Fix ... |
543 |
const char *bond_mode_name(int mode); |
0a2a78c4a bonding: push Net... |
544 545 546 547 |
void bond_setup(struct net_device *bond_dev); unsigned int bond_get_num_tx_queues(void); int bond_netlink_init(void); void bond_netlink_fini(void); |
752d48b52 bonding: move act... |
548 |
struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond); |
07699f9a7 bonding: add sysf... |
549 |
const char *bond_slave_link_status(s8 link); |
3e403a777 bonding: make it ... |
550 551 552 |
struct bond_vlan_tag *bond_verify_device_path(struct net_device *start_dev, struct net_device *end_dev, int level); |
ee6377147 bonding: Simplify... |
553 554 |
int bond_update_slave_arr(struct bonding *bond, struct slave *skipslave); void bond_slave_arr_work_rearm(struct bonding *bond, unsigned long delay); |
1da177e4c Linux-2.6.12-rc2 |
555 |
|
bd33acc3c bonding: move pro... |
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 |
#ifdef CONFIG_PROC_FS void bond_create_proc_entry(struct bonding *bond); void bond_remove_proc_entry(struct bonding *bond); void bond_create_proc_dir(struct bond_net *bn); void bond_destroy_proc_dir(struct bond_net *bn); #else static inline void bond_create_proc_entry(struct bonding *bond) { } static inline void bond_remove_proc_entry(struct bonding *bond) { } static inline void bond_create_proc_dir(struct bond_net *bn) { } static inline void bond_destroy_proc_dir(struct bond_net *bn) { } #endif |
567b871e5 bonding: rlb mode... |
578 579 580 |
static inline struct slave *bond_slave_has_mac(struct bonding *bond, const u8 *mac) { |
9caff1e7b bonding: make bon... |
581 |
struct list_head *iter; |
567b871e5 bonding: rlb mode... |
582 |
struct slave *tmp; |
9caff1e7b bonding: make bon... |
583 |
bond_for_each_slave(bond, tmp, iter) |
567b871e5 bonding: rlb mode... |
584 585 586 587 588 |
if (ether_addr_equal_64bits(mac, tmp->dev->dev_addr)) return tmp; return NULL; } |
bd33acc3c bonding: move pro... |
589 |
|
28c719260 bonding: use RCU ... |
590 591 592 593 594 595 596 597 598 599 600 601 602 |
/* Caller must hold rcu_read_lock() for read */ static inline struct slave *bond_slave_has_mac_rcu(struct bonding *bond, const u8 *mac) { struct list_head *iter; struct slave *tmp; bond_for_each_slave_rcu(bond, tmp, iter) if (ether_addr_equal_64bits(mac, tmp->dev->dev_addr)) return tmp; return NULL; } |
14af9963b bonding: Support ... |
603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 |
/* Caller must hold rcu_read_lock() for read */ static inline bool bond_slave_has_mac_rx(struct bonding *bond, const u8 *mac) { struct list_head *iter; struct slave *tmp; struct netdev_hw_addr *ha; bond_for_each_slave_rcu(bond, tmp, iter) if (ether_addr_equal_64bits(mac, tmp->dev->dev_addr)) return true; if (netdev_uc_empty(bond->dev)) return false; netdev_for_each_uc_addr(ha, bond->dev) if (ether_addr_equal_64bits(mac, ha->addr)) return true; return false; } |
87a7b84b5 bonding: add help... |
623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 |
/* Check if the ip is present in arp ip list, or first free slot if ip == 0 * Returns -1 if not found, index if found */ static inline int bond_get_targets_ip(__be32 *targets, __be32 ip) { int i; for (i = 0; i < BOND_MAX_ARP_TARGETS; i++) if (targets[i] == ip) return i; else if (targets[i] == 0) break; return -1; } |
b22596726 drivers/net/bondi... |
638 |
/* exported from bond_main.c */ |
ec87fd3b4 bond: Add support... |
639 |
extern int bond_net_id; |
e97fd7c6d bonding: turn all... |
640 |
extern const struct bond_parm_tbl bond_lacp_tbl[]; |
e97fd7c6d bonding: turn all... |
641 642 |
extern const struct bond_parm_tbl xmit_hashtype_tbl[]; extern const struct bond_parm_tbl arp_validate_tbl[]; |
8599b52e1 bonding: add an o... |
643 |
extern const struct bond_parm_tbl arp_all_targets_tbl[]; |
e97fd7c6d bonding: turn all... |
644 |
extern const struct bond_parm_tbl fail_over_mac_tbl[]; |
a549952ad bonding: introduc... |
645 |
extern const struct bond_parm_tbl pri_reselect_tbl[]; |
b06715b7a drivers/net/bondi... |
646 |
extern struct bond_parm_tbl ad_select_tbl[]; |
0a2a78c4a bonding: push Net... |
647 648 |
/* exported from bond_netlink.c */ extern struct rtnl_link_ops bond_link_ops; |
31aa860e0 bonding: add bond... |
649 650 651 652 653 |
static inline void bond_tx_drop(struct net_device *dev, struct sk_buff *skb) { atomic_long_inc(&dev->tx_dropped); dev_kfree_skb_any(skb); } |
1ef8019be net: Move bonding... |
654 |
#endif /* _NET_BONDING_H */ |