]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/network/networkd-netdev-bond.h
networkd: port many log messages over to newer logging API
[thirdparty/systemd.git] / src / network / networkd-netdev-bond.h
CommitLineData
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 24typedef 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
34typedef 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
46typedef 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
56typedef 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
63typedef 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
71typedef 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
79typedef 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
88typedef 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
95typedef 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
103typedef struct ArpIpTarget {
104 union in_addr_union ip;
105
106 LIST_FIELDS(struct ArpIpTarget, arp_ip_target);
107} ArpIpTarget;
108
aa9f1140
TG
109struct 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
138extern const NetDevVTable bond_vtable;
139
3be1d7e0
TG
140const char *bond_mode_to_string(BondMode d) _const_;
141BondMode bond_mode_from_string(const char *d) _pure_;
142
227cdf2c
SS
143const char *bond_xmit_hash_policy_to_string(BondXmitHashPolicy d) _const_;
144BondXmitHashPolicy bond_xmit_hash_policy_from_string(const char *d) _pure_;
145
fb1021a2
SS
146const char *bond_lacp_rate_to_string(BondLacpRate d) _const_;
147BondLacpRate bond_lacp_rate_from_string(const char *d) _pure_;
148
81bd37a8
SS
149const char *bond_fail_over_mac_to_string(BondFailOverMac d) _const_;
150BondFailOverMac bond_fail_over_mac_from_string(const char *d) _pure_;
151
152const char *bond_ad_select_to_string(BondAdSelect d) _const_;
153BondAdSelect bond_ad_select_from_string(const char *d) _pure_;
154
155const char *bond_arp_validate_to_string(BondArpValidate d) _const_;
156BondArpValidate bond_arp_validate_from_string(const char *d) _pure_;
157
158const char *bond_arp_all_targets_to_string(BondArpAllTargets d) _const_;
159BondArpAllTargets bond_arp_all_targets_from_string(const char *d) _pure_;
160
161const char *bond_primary_reselect_to_string(BondPrimaryReselect d) _const_;
162BondPrimaryReselect bond_primary_reselect_from_string(const char *d) _pure_;
163
3be1d7e0 164int 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 165int 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 166int 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
167int 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);
168int 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);
169int 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);
170int 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);
171int 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);
172int 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);