2 * Bond several ethernet interfaces into a Cisco, running 'Etherchannel'.
5 * Portions are (c) Copyright 1995 Simon "Guru Aleph-Null" Janes
6 * NCM: Network and Communications Management, Inc.
8 * BUT, I'm the one who modified it for ethernet, so:
9 * (c) Copyright 1999, Thomas Davis, tadavis@lbl.gov
11 * This software may be used and distributed according to the terms
12 * of the GNU Public License, incorporated herein by reference.
16 #ifndef _LINUX_IF_BONDING_H
17 #define _LINUX_IF_BONDING_H
20 #include <linux/timer.h>
22 #include <linux/proc_fs.h>
23 #endif /* __KERNEL__ */
25 #include <linux/types.h>
28 * We can remove these ioctl definitions in 2.5. People should use the
29 * SIOC*** versions of them instead
31 #define BOND_ENSLAVE_OLD (SIOCDEVPRIVATE)
32 #define BOND_RELEASE_OLD (SIOCDEVPRIVATE + 1)
33 #define BOND_SETHWADDR_OLD (SIOCDEVPRIVATE + 2)
34 #define BOND_SLAVE_INFO_QUERY_OLD (SIOCDEVPRIVATE + 11)
35 #define BOND_INFO_QUERY_OLD (SIOCDEVPRIVATE + 12)
36 #define BOND_CHANGE_ACTIVE_OLD (SIOCDEVPRIVATE + 13)
38 #define BOND_CHECK_MII_STATUS (SIOCGMIIPHY)
40 #define BOND_MODE_ROUNDROBIN 0
41 #define BOND_MODE_ACTIVEBACKUP 1
42 #define BOND_MODE_XOR 2
43 #define BOND_MODE_BROADCAST 3
45 /* each slave's link has 4 states */
46 #define BOND_LINK_UP 0 /* link is up and running */
47 #define BOND_LINK_FAIL 1 /* link has just gone down */
48 #define BOND_LINK_DOWN 2 /* link has been down for too long time */
49 #define BOND_LINK_BACK 3 /* link is going back */
51 /* each slave has several states */
52 #define BOND_STATE_ACTIVE 0 /* link is active */
53 #define BOND_STATE_BACKUP 1 /* link is backup */
55 #define BOND_DEFAULT_MAX_BONDS 1 /* Default maximum number of devices to support */
57 typedef struct ifbond {
63 typedef struct ifslave
65 __s32 slave_id; /* Used as an IN param to the BOND_SLAVE_INFO_QUERY ioctl */
66 char slave_name[IFNAMSIZ];
69 __u32 link_failure_count;
73 typedef struct slave {
76 struct net_device *dev;
78 unsigned long jiffies;
79 char link; /* one of BOND_LINK_XXXX */
80 char state; /* one of BOND_STATE_XXXX */
81 unsigned short original_flags;
82 u32 link_failure_count;
86 * Here are the locking policies for the two bonding locks:
88 * 1) Get bond->lock when reading/writing slave list.
89 * 2) Get bond->ptrlock when reading/writing bond->current_slave.
90 * (It is unnecessary when the write-lock is put with bond->lock.)
91 * 3) When we lock with bond->ptrlock, we must lock with bond->lock
94 typedef struct bonding {
97 slave_t *current_slave;
98 slave_t *primary_slave;
99 slave_t *current_arp_slave;
103 struct timer_list mii_timer;
104 struct timer_list arp_timer;
105 struct net_device_stats *stats;
106 #ifdef CONFIG_PROC_FS
107 struct proc_dir_entry *bond_proc_dir;
108 struct proc_dir_entry *bond_proc_info_file;
109 #endif /* CONFIG_PROC_FS */
110 struct bonding *next_bond;
111 struct net_device *device;
112 struct dev_mc_list *mc_list;
113 unsigned short flags;
115 #endif /* __KERNEL__ */
117 #endif /* _LINUX_BOND_H */
122 * kept-new-versions: 5