lacp: New "strict" lacp mode.
[sliver-openvswitch.git] / lib / lacp.h
1 /*
2  * Copyright (c) 2011 Nicira Networks.
3  *
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:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef LACP_H
18 #define LACP_H 1
19
20 #include <stdbool.h>
21 #include <stdint.h>
22 #include "packets.h"
23
24 struct lacp_settings {
25     char *name;
26     uint8_t id[ETH_ADDR_LEN];
27     uint16_t priority;
28     bool active;
29     bool fast;
30     bool strict;
31 };
32
33 void lacp_init(void);
34 struct lacp *lacp_create(void);
35 void lacp_destroy(struct lacp *);
36
37 void lacp_configure(struct lacp *, const struct lacp_settings *);
38 bool lacp_is_active(const struct lacp *);
39
40 void lacp_process_pdu(struct lacp *, const void *slave,
41                       const struct lacp_pdu *);
42 bool lacp_negotiated(const struct lacp *);
43
44 struct lacp_slave_settings {
45     char *name;
46     uint16_t id;
47     uint16_t priority;
48 };
49
50 void lacp_slave_register(struct lacp *, void *slave_,
51                          const struct lacp_slave_settings *);
52 void lacp_slave_unregister(struct lacp *, const void *slave);
53 void lacp_slave_carrier_changed(const struct lacp *, const void *slave);
54 bool lacp_slave_may_enable(const struct lacp *, const void *slave);
55 uint16_t lacp_slave_get_port_id(const struct lacp *, const void *slave);
56 bool lacp_slave_is_current(const struct lacp *, const void *slave_);
57
58 /* Callback function for lacp_run() for sending a LACP PDU. */
59 typedef void lacp_send_pdu(void *slave, const struct lacp_pdu *);
60
61 void lacp_run(struct lacp *, lacp_send_pdu *);
62 void lacp_wait(struct lacp *);
63
64 #endif /* lacp.h */