blob: a17edda8a7816c2ba92e7c1b7aee3cce23b93f8f [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Bond several ethernet interfaces into a Cisco, running 'Etherchannel'.
3 *
4 *
5 * Portions are (c) Copyright 1995 Simon "Guru Aleph-Null" Janes
6 * NCM: Network and Communications Management, Inc.
7 *
8 * BUT, I'm the one who modified it for ethernet, so:
9 * (c) Copyright 1999, Thomas Davis, tadavis@lbl.gov
10 *
11 * This software may be used and distributed according to the terms
12 * of the GNU Public License, incorporated herein by reference.
13 *
14 * 2003/03/18 - Amir Noam <amir.noam at intel dot com>
15 * - Added support for getting slave's speed and duplex via ethtool.
16 * Needed for 802.3ad and other future modes.
17 *
18 * 2003/03/18 - Tsippy Mendelson <tsippy.mendelson at intel dot com> and
19 * Shmulik Hen <shmulik.hen at intel dot com>
20 * - Enable support of modes that need to use the unique mac address of
21 * each slave.
22 *
23 * 2003/03/18 - Tsippy Mendelson <tsippy.mendelson at intel dot com> and
24 * Amir Noam <amir.noam at intel dot com>
25 * - Moved driver's private data types to bonding.h
26 *
27 * 2003/03/18 - Amir Noam <amir.noam at intel dot com>,
28 * Tsippy Mendelson <tsippy.mendelson at intel dot com> and
29 * Shmulik Hen <shmulik.hen at intel dot com>
30 * - Added support for IEEE 802.3ad Dynamic link aggregation mode.
31 *
32 * 2003/05/01 - Amir Noam <amir.noam at intel dot com>
33 * - Added ABI version control to restore compatibility between
34 * new/old ifenslave and new/old bonding.
35 *
36 * 2003/12/01 - Shmulik Hen <shmulik.hen at intel dot com>
37 * - Code cleanup and style changes
Jay Vosburgh169a3e62005-06-26 17:54:11 -040038 *
39 * 2005/05/05 - Jason Gabler <jygabler at lbl dot gov>
40 * - added definitions for various XOR hashing policies
Linus Torvalds1da177e2005-04-16 15:20:36 -070041 */
42
43#ifndef _LINUX_IF_BONDING_H
44#define _LINUX_IF_BONDING_H
45
46#include <linux/if.h>
47#include <linux/types.h>
48#include <linux/if_ether.h>
49
50/* userland - kernel ABI version (2003/05/08) */
51#define BOND_ABI_VERSION 2
52
53/*
54 * We can remove these ioctl definitions in 2.5. People should use the
55 * SIOC*** versions of them instead
56 */
57#define BOND_ENSLAVE_OLD (SIOCDEVPRIVATE)
58#define BOND_RELEASE_OLD (SIOCDEVPRIVATE + 1)
59#define BOND_SETHWADDR_OLD (SIOCDEVPRIVATE + 2)
60#define BOND_SLAVE_INFO_QUERY_OLD (SIOCDEVPRIVATE + 11)
61#define BOND_INFO_QUERY_OLD (SIOCDEVPRIVATE + 12)
62#define BOND_CHANGE_ACTIVE_OLD (SIOCDEVPRIVATE + 13)
63
64#define BOND_CHECK_MII_STATUS (SIOCGMIIPHY)
65
66#define BOND_MODE_ROUNDROBIN 0
67#define BOND_MODE_ACTIVEBACKUP 1
68#define BOND_MODE_XOR 2
69#define BOND_MODE_BROADCAST 3
70#define BOND_MODE_8023AD 4
71#define BOND_MODE_TLB 5
72#define BOND_MODE_ALB 6 /* TLB + RLB (receive load balancing) */
73
74/* each slave's link has 4 states */
75#define BOND_LINK_UP 0 /* link is up and running */
76#define BOND_LINK_FAIL 1 /* link has just gone down */
77#define BOND_LINK_DOWN 2 /* link has been down for too long time */
78#define BOND_LINK_BACK 3 /* link is going back */
79
80/* each slave has several states */
81#define BOND_STATE_ACTIVE 0 /* link is active */
82#define BOND_STATE_BACKUP 1 /* link is backup */
83
84#define BOND_DEFAULT_MAX_BONDS 1 /* Default maximum number of devices to support */
85
Andy Gospodarekbb1d9122010-06-02 08:40:18 +000086#define BOND_DEFAULT_TX_QUEUES 16 /* Default number of tx queues per device */
Flavio Leitnerc2952c32010-10-05 14:23:59 +000087
88#define BOND_DEFAULT_RESEND_IGMP 1 /* Default number of IGMP membership reports */
89
Jay Vosburgh169a3e62005-06-26 17:54:11 -040090/* hashing types */
91#define BOND_XMIT_POLICY_LAYER2 0 /* layer 2 (MAC only), default */
Jay Vosburgh6f6652b2007-12-06 23:40:34 -080092#define BOND_XMIT_POLICY_LAYER34 1 /* layer 3+4 (IP ^ (TCP || UDP)) */
93#define BOND_XMIT_POLICY_LAYER23 2 /* layer 2+3 (IP ^ MAC) */
Jay Vosburgh169a3e62005-06-26 17:54:11 -040094
Linus Torvalds1da177e2005-04-16 15:20:36 -070095typedef struct ifbond {
96 __s32 bond_mode;
97 __s32 num_slaves;
98 __s32 miimon;
99} ifbond;
100
Eric Dumazetd94d9fe2009-11-04 09:50:58 -0800101typedef struct ifslave {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102 __s32 slave_id; /* Used as an IN param to the BOND_SLAVE_INFO_QUERY ioctl */
103 char slave_name[IFNAMSIZ];
104 __s8 link;
105 __s8 state;
106 __u32 link_failure_count;
107} ifslave;
108
109struct ad_info {
110 __u16 aggregator_id;
111 __u16 ports;
112 __u16 actor_key;
113 __u16 partner_key;
114 __u8 partner_system[ETH_ALEN];
115};
116
117#endif /* _LINUX_IF_BONDING_H */
118
119/*
120 * Local variables:
121 * version-control: t
122 * kept-new-versions: 5
123 * c-indent-level: 8
124 * c-basic-offset: 8
125 * tab-width: 8
126 * End:
127 */
128