2 * Copyright (c) 2011 Nicira Networks.
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.
24 /* LACP Protocol Implementation. */
27 LACP_NEGOTIATED, /* Successful LACP negotations. */
28 LACP_CONFIGURED, /* LACP is enabled but not negotiated. */
29 LACP_DISABLED /* LACP is not enabled. */
32 struct lacp_settings {
33 char *name; /* Name (for debugging). */
34 uint8_t id[ETH_ADDR_LEN]; /* System ID. Must be nonzero. */
35 uint16_t priority; /* System priority. */
36 bool active; /* Active or passive mode? */
37 bool fast; /* Fast or slow probe interval. */
38 bool heartbeat; /* Heartbeat mode. */
42 struct lacp *lacp_create(void);
43 void lacp_destroy(struct lacp *);
45 void lacp_configure(struct lacp *, const struct lacp_settings *);
46 bool lacp_is_active(const struct lacp *);
48 void lacp_process_packet(struct lacp *, const void *slave,
49 const struct ofpbuf *packet);
50 enum lacp_status lacp_status(const struct lacp *);
52 struct lacp_slave_settings {
53 char *name; /* Name (for debugging). */
54 uint16_t id; /* Port ID. */
55 uint16_t priority; /* Port priority. */
56 uint16_t key; /* Aggregation key. */
59 void lacp_slave_register(struct lacp *, void *slave_,
60 const struct lacp_slave_settings *);
61 void lacp_slave_unregister(struct lacp *, const void *slave);
62 void lacp_slave_carrier_changed(const struct lacp *, const void *slave);
63 bool lacp_slave_may_enable(const struct lacp *, const void *slave);
64 uint16_t lacp_slave_get_port_id(const struct lacp *, const void *slave);
65 bool lacp_slave_is_current(const struct lacp *, const void *slave_);
67 /* Callback function for lacp_run() for sending a LACP PDU. */
68 typedef void lacp_send_pdu(void *slave, const void *pdu, size_t pdu_size);
70 void lacp_run(struct lacp *, lacp_send_pdu *);
71 void lacp_wait(struct lacp *);