]>
git.proxmox.com Git - mirror_ovs.git/blob - lib/bond.h
2 * Copyright (c) 2008, 2009, 2010, 2011 Nicira, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
31 /* How flows are balanced among bond slaves. */
33 BM_TCP
, /* Transport Layer Load Balance. */
34 BM_SLB
, /* Source Load Balance. */
35 BM_AB
/* Active Backup. */
38 bool bond_mode_from_string(enum bond_mode
*, const char *);
39 const char *bond_mode_to_string(enum bond_mode
);
41 /* Configuration for a bond as a whole. */
42 struct bond_settings
{
43 char *name
; /* Bond's name, for log messages. */
44 uint32_t basis
; /* Flow hashing basis. */
46 /* Balancing configuration. */
47 enum bond_mode balance
;
48 int rebalance_interval
; /* Milliseconds between rebalances.
49 Zero to disable rebalancing. */
51 /* Link status detection. */
52 int up_delay
; /* ms before enabling an up slave. */
53 int down_delay
; /* ms before disabling a down slave. */
55 /* Legacy compatibility. */
56 bool fake_iface
; /* Update fake stats for netdev 'name'? */
59 /* Program startup. */
63 struct bond
*bond_create(const struct bond_settings
*);
64 void bond_destroy(struct bond
*);
66 bool bond_reconfigure(struct bond
*, const struct bond_settings
*);
67 void bond_slave_register(struct bond
*, void *slave_
, struct netdev
*);
68 void bond_slave_set_netdev(struct bond
*, void *slave_
, struct netdev
*);
69 void bond_slave_unregister(struct bond
*, const void *slave
);
71 void bond_run(struct bond
*, struct tag_set
*, enum lacp_status
);
72 void bond_wait(struct bond
*);
74 void bond_slave_set_may_enable(struct bond
*, void *slave_
, bool may_enable
);
76 /* Special MAC learning support for SLB bonding. */
77 bool bond_should_send_learning_packets(struct bond
*);
78 struct ofpbuf
*bond_compose_learning_packet(struct bond
*,
79 const uint8_t eth_src
[ETH_ADDR_LEN
],
80 uint16_t vlan
, void **port_aux
);
82 /* Packet processing. */
84 BV_ACCEPT
, /* Accept this packet. */
85 BV_DROP
, /* Drop this packet. */
86 BV_DROP_IF_MOVED
/* Drop if we've learned a different port. */
88 enum bond_verdict
bond_check_admissibility(struct bond
*, const void *slave_
,
89 const uint8_t eth_dst
[ETH_ADDR_LEN
],
91 void *bond_choose_output_slave(struct bond
*, const struct flow
*,
92 struct flow_wildcards
*, uint16_t vlan
,
96 void bond_account(struct bond
*, const struct flow
*, uint16_t vlan
,
98 void bond_rebalance(struct bond
*, struct tag_set
*);