]> git.proxmox.com Git - mirror_ovs.git/blame - lib/lacp.h
doc: Remove final markdown references
[mirror_ovs.git] / lib / lacp.h
CommitLineData
6aa74308 1/*
e0edde6f 2 * Copyright (c) 2011 Nicira, Inc.
6aa74308
EJ
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>
02c9ed77 22#include "packets.h"
6aa74308 23
81aee5f9
EJ
24/* LACP Protocol Implementation. */
25
bdebeece
EJ
26enum lacp_status {
27 LACP_NEGOTIATED, /* Successful LACP negotations. */
28 LACP_CONFIGURED, /* LACP is enabled but not negotiated. */
29 LACP_DISABLED /* LACP is not enabled. */
30};
31
bb5bc6c0 32struct lacp_settings {
d3bfdcff 33 char *name; /* Name (for debugging). */
74ff3298 34 struct eth_addr id; /* System ID. Must be nonzero. */
d3bfdcff
EJ
35 uint16_t priority; /* System priority. */
36 bool active; /* Active or passive mode? */
bf83f7c8 37 bool fast; /* Fast or slow probe interval. */
9dd165e0 38 bool fallback_ab_cfg; /* Fallback to BM_SLB on LACP failure. */
bb5bc6c0 39};
6aa74308
EJ
40
41void lacp_init(void);
42struct lacp *lacp_create(void);
91779071
EJ
43void lacp_unref(struct lacp *);
44struct lacp *lacp_ref(const struct lacp *);
7a673515 45
bb5bc6c0 46void lacp_configure(struct lacp *, const struct lacp_settings *);
7a673515
BP
47bool lacp_is_active(const struct lacp *);
48
5f877369 49void lacp_process_packet(struct lacp *, const void *slave,
cf62fa4c 50 const struct dp_packet *packet);
bdebeece 51enum lacp_status lacp_status(const struct lacp *);
6aa74308 52
bb5bc6c0 53struct lacp_slave_settings {
d3bfdcff
EJ
54 char *name; /* Name (for debugging). */
55 uint16_t id; /* Port ID. */
56 uint16_t priority; /* Port priority. */
57 uint16_t key; /* Aggregation key. */
bb5bc6c0
BP
58};
59
60void lacp_slave_register(struct lacp *, void *slave_,
61 const struct lacp_slave_settings *);
6aa74308 62void lacp_slave_unregister(struct lacp *, const void *slave);
6aa74308
EJ
63void lacp_slave_carrier_changed(const struct lacp *, const void *slave);
64bool lacp_slave_may_enable(const struct lacp *, const void *slave);
44cb163f 65bool lacp_slave_is_current(const struct lacp *, const void *slave_);
6aa74308 66
bb5bc6c0 67/* Callback function for lacp_run() for sending a LACP PDU. */
5f877369 68typedef void lacp_send_pdu(void *slave, const void *pdu, size_t pdu_size);
bb5bc6c0 69
6aa74308
EJ
70void lacp_run(struct lacp *, lacp_send_pdu *);
71void lacp_wait(struct lacp *);
72
50b9699f
NM
73struct lacp_slave_stats {
74 /* id */
74ff3298
JR
75 struct eth_addr dot3adAggPortActorSystemID;
76 struct eth_addr dot3adAggPortPartnerOperSystemID;
50b9699f
NM
77 uint32_t dot3adAggPortAttachedAggID;
78 /* state */
79 uint8_t dot3adAggPortActorAdminState;
80 uint8_t dot3adAggPortActorOperState;
81 uint8_t dot3adAggPortPartnerAdminState;
82 uint8_t dot3adAggPortPartnerOperState;
83 /* counters */
84 uint32_t dot3adAggPortStatsLACPDUsRx;
85 /* uint32_t dot3adAggPortStatsMarkerPDUsRx; */
86 /* uint32_t dot3adAggPortStatsMarkerResponsePDUsRx; */
87 /* uint32_t dot3adAggPortStatsUnknownRx; */
88 uint32_t dot3adAggPortStatsIllegalRx;
89 uint32_t dot3adAggPortStatsLACPDUsTx;
90 /* uint32_t dot3adAggPortStatsMarkerPDUsTx; */
91 /* uint32_t dot3adAggPortStatsMarkerResponsePDUsTx; */
92};
93
94bool lacp_get_slave_stats(const struct lacp *, const void *slave_, struct lacp_slave_stats *);
95
6aa74308 96#endif /* lacp.h */