]>
Commit | Line | Data |
---|---|---|
3be1d7e0 TG |
1 | /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ |
2 | ||
3 | /*** | |
4 | This file is part of systemd. | |
5 | ||
6 | Copyright 2014 Tom Gundersen <teg@jklm.no> | |
7 | ||
8 | systemd is free software; you can redistribute it and/or modify it | |
9 | under the terms of the GNU Lesser General Public License as published by | |
10 | the Free Software Foundation; either version 2.1 of the License, or | |
11 | (at your option) any later version. | |
12 | ||
13 | systemd is distributed in the hope that it will be useful, but | |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 | Lesser General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU Lesser General Public License | |
19 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
20 | ***/ | |
21 | ||
22 | #pragma once | |
23 | ||
aa9f1140 | 24 | typedef struct Bond Bond; |
3be1d7e0 | 25 | |
aa9f1140 | 26 | #include "networkd-netdev.h" |
3be1d7e0 | 27 | |
dd906398 DH |
28 | /* |
29 | * Maximum number of targets supported by the kernel for a single | |
30 | * bond netdev. | |
31 | */ | |
32 | #define NETDEV_BOND_ARP_TARGETS_MAX 16 | |
33 | ||
3be1d7e0 TG |
34 | typedef enum BondMode { |
35 | NETDEV_BOND_MODE_BALANCE_RR, | |
36 | NETDEV_BOND_MODE_ACTIVE_BACKUP, | |
37 | NETDEV_BOND_MODE_BALANCE_XOR, | |
38 | NETDEV_BOND_MODE_BROADCAST, | |
39 | NETDEV_BOND_MODE_802_3AD, | |
40 | NETDEV_BOND_MODE_BALANCE_TLB, | |
41 | NETDEV_BOND_MODE_BALANCE_ALB, | |
42 | _NETDEV_BOND_MODE_MAX, | |
43 | _NETDEV_BOND_MODE_INVALID = -1 | |
44 | } BondMode; | |
45 | ||
227cdf2c SS |
46 | typedef enum BondXmitHashPolicy { |
47 | NETDEV_BOND_XMIT_HASH_POLICY_LAYER2, | |
48 | NETDEV_BOND_XMIT_HASH_POLICY_LAYER34, | |
49 | NETDEV_BOND_XMIT_HASH_POLICY_LAYER23, | |
50 | NETDEV_BOND_XMIT_HASH_POLICY_ENCAP23, | |
51 | NETDEV_BOND_XMIT_HASH_POLICY_ENCAP34, | |
52 | _NETDEV_BOND_XMIT_HASH_POLICY_MAX, | |
53 | _NETDEV_BOND_XMIT_HASH_POLICY_INVALID = -1 | |
54 | } BondXmitHashPolicy; | |
55 | ||
fb1021a2 SS |
56 | typedef enum BondLacpRate { |
57 | NETDEV_BOND_LACP_RATE_SLOW, | |
58 | NETDEV_BOND_LACP_RATE_FAST, | |
59 | _NETDEV_BOND_LACP_RATE_MAX, | |
60 | _NETDEV_BOND_LACP_RATE_INVALID = -1, | |
61 | } BondLacpRate; | |
62 | ||
81bd37a8 SS |
63 | typedef enum BondAdSelect { |
64 | NETDEV_BOND_AD_SELECT_STABLE, | |
65 | NETDEV_BOND_AD_SELECT_BANDWIDTH, | |
66 | NETDEV_BOND_AD_SELECT_COUNT, | |
67 | _NETDEV_BOND_AD_SELECT_MAX, | |
68 | _NETDEV_BOND_AD_SELECT_INVALID = -1, | |
69 | } BondAdSelect; | |
70 | ||
71 | typedef enum BondFailOverMac { | |
72 | NETDEV_BOND_FAIL_OVER_MAC_NONE, | |
73 | NETDEV_BOND_FAIL_OVER_MAC_ACTIVE, | |
74 | NETDEV_BOND_FAIL_OVER_MAC_FOLLOW, | |
75 | _NETDEV_BOND_FAIL_OVER_MAC_MAX, | |
76 | _NETDEV_BOND_FAIL_OVER_MAC_INVALID = -1, | |
77 | } BondFailOverMac; | |
78 | ||
79 | typedef enum BondArpValidate { | |
80 | NETDEV_BOND_ARP_VALIDATE_NONE, | |
81 | NETDEV_BOND_ARP_VALIDATE_ACTIVE, | |
82 | NETDEV_BOND_ARP_VALIDATE_BACKUP, | |
83 | NETDEV_BOND_ARP_VALIDATE_ALL, | |
84 | _NETDEV_BOND_ARP_VALIDATE_MAX, | |
85 | _NETDEV_BOND_ARP_VALIDATE_INVALID = -1, | |
86 | } BondArpValidate; | |
87 | ||
88 | typedef enum BondArpAllTargets { | |
89 | NETDEV_BOND_ARP_ALL_TARGETS_ANY, | |
90 | NETDEV_BOND_ARP_ALL_TARGETS_ALL, | |
91 | _NETDEV_BOND_ARP_ALL_TARGETS_MAX, | |
92 | _NETDEV_BOND_ARP_ALL_TARGETS_INVALID = -1, | |
93 | } BondArpAllTargets; | |
94 | ||
95 | typedef enum BondPrimaryReselect { | |
96 | NETDEV_BOND_PRIMARY_RESELECT_ALWAYS, | |
97 | NETDEV_BOND_PRIMARY_RESELECT_BETTER, | |
98 | NETDEV_BOND_PRIMARY_RESELECT_FAILURE, | |
99 | _NETDEV_BOND_PRIMARY_RESELECT_MAX, | |
100 | _NETDEV_BOND_PRIMARY_RESELECT_INVALID = -1, | |
101 | } BondPrimaryReselect; | |
102 | ||
103 | typedef struct ArpIpTarget { | |
104 | union in_addr_union ip; | |
105 | ||
106 | LIST_FIELDS(struct ArpIpTarget, arp_ip_target); | |
107 | } ArpIpTarget; | |
108 | ||
aa9f1140 TG |
109 | struct Bond { |
110 | NetDev meta; | |
111 | ||
112 | BondMode mode; | |
227cdf2c | 113 | BondXmitHashPolicy xmit_hash_policy; |
fb1021a2 | 114 | BondLacpRate lacp_rate; |
81bd37a8 SS |
115 | BondAdSelect ad_select; |
116 | BondFailOverMac fail_over_mac; | |
117 | BondArpValidate arp_validate; | |
118 | BondArpAllTargets arp_all_targets; | |
119 | BondPrimaryReselect primary_reselect; | |
120 | ||
121 | bool all_slaves_active; | |
122 | ||
123 | unsigned resend_igmp; | |
124 | unsigned packets_per_slave; | |
125 | unsigned num_grat_arp; | |
126 | unsigned min_links; | |
d9c52fa0 SS |
127 | |
128 | usec_t miimon; | |
129 | usec_t updelay; | |
130 | usec_t downdelay; | |
81bd37a8 SS |
131 | usec_t arp_interval; |
132 | usec_t lp_interval; | |
133 | ||
134 | int n_arp_ip_targets; | |
135 | ArpIpTarget *arp_ip_targets; | |
aa9f1140 TG |
136 | }; |
137 | ||
138 | extern const NetDevVTable bond_vtable; | |
139 | ||
3be1d7e0 TG |
140 | const char *bond_mode_to_string(BondMode d) _const_; |
141 | BondMode bond_mode_from_string(const char *d) _pure_; | |
142 | ||
227cdf2c SS |
143 | const char *bond_xmit_hash_policy_to_string(BondXmitHashPolicy d) _const_; |
144 | BondXmitHashPolicy bond_xmit_hash_policy_from_string(const char *d) _pure_; | |
145 | ||
fb1021a2 SS |
146 | const char *bond_lacp_rate_to_string(BondLacpRate d) _const_; |
147 | BondLacpRate bond_lacp_rate_from_string(const char *d) _pure_; | |
148 | ||
81bd37a8 SS |
149 | const char *bond_fail_over_mac_to_string(BondFailOverMac d) _const_; |
150 | BondFailOverMac bond_fail_over_mac_from_string(const char *d) _pure_; | |
151 | ||
152 | const char *bond_ad_select_to_string(BondAdSelect d) _const_; | |
153 | BondAdSelect bond_ad_select_from_string(const char *d) _pure_; | |
154 | ||
155 | const char *bond_arp_validate_to_string(BondArpValidate d) _const_; | |
156 | BondArpValidate bond_arp_validate_from_string(const char *d) _pure_; | |
157 | ||
158 | const char *bond_arp_all_targets_to_string(BondArpAllTargets d) _const_; | |
159 | BondArpAllTargets bond_arp_all_targets_from_string(const char *d) _pure_; | |
160 | ||
161 | const char *bond_primary_reselect_to_string(BondPrimaryReselect d) _const_; | |
162 | BondPrimaryReselect bond_primary_reselect_from_string(const char *d) _pure_; | |
163 | ||
3be1d7e0 | 164 | int config_parse_bond_mode(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); |
227cdf2c | 165 | int config_parse_bond_xmit_hash_policy(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); |
fb1021a2 | 166 | int config_parse_bond_lacp_rate(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); |
81bd37a8 SS |
167 | int config_parse_bond_ad_select(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); |
168 | int config_parse_bond_fail_over_mac(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); | |
169 | int config_parse_bond_arp_validate(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); | |
170 | int config_parse_bond_arp_all_targets(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); | |
171 | int config_parse_bond_primary_reselect(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); | |
172 | int config_parse_arp_ip_target_address(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); |