]> git.proxmox.com Git - mirror_ovs.git/blame - lib/cfm.h
OPENFLOW-1.1+: Groups are now supported.
[mirror_ovs.git] / lib / cfm.h
CommitLineData
e0edde6f 1/* Copyright (c) 2010, 2011 Nicira, Inc.
b31bcf60
EJ
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef CFM_H
17#define CFM_H 1
18
19#include <stdint.h>
20
21#include "hmap.h"
2a899f6e 22#include "openvswitch/types.h"
b31bcf60
EJ
23
24struct flow;
2a899f6e 25struct ofpbuf;
90967e95 26struct netdev;
642dc74d 27struct flow_wildcards;
b31bcf60 28
189cb9e4
EJ
29#define CFM_RANDOM_VLAN UINT16_MAX
30
b9380396
EJ
31#define CFM_FAULT_REASONS \
32 CFM_FAULT_REASON(RECV, recv) \
33 CFM_FAULT_REASON(RDI, rdi) \
34 CFM_FAULT_REASON(MAID, maid) \
35 CFM_FAULT_REASON(LOOPBACK, loopback) \
36 CFM_FAULT_REASON(OVERFLOW, overflow) \
0258d4a0 37 CFM_FAULT_REASON(OVERRIDE, override)
b9380396
EJ
38
39enum cfm_fault_bit_index {
40#define CFM_FAULT_REASON(NAME, STR) CFM_FAULT_INDEX_##NAME,
41 CFM_FAULT_REASONS
42#undef CFM_FAULT_REASON
43 CFM_FAULT_N_REASONS
44};
45
46enum cfm_fault_reason {
47#define CFM_FAULT_REASON(NAME, STR) \
48 CFM_FAULT_##NAME = 1 << CFM_FAULT_INDEX_##NAME,
49 CFM_FAULT_REASONS
50#undef CFM_FAULT_REASON
51};
52
a5610457 53struct cfm_settings {
348f01e3 54 uint64_t mpid; /* The MPID of this CFM. */
b31bcf60 55 int interval; /* The requested transmission interval. */
ef9819b5 56 bool extended; /* Run in extended mode. */
90967e95 57 bool demand; /* Run in demand mode. */
86dc6501 58 bool opup; /* Operational State. */
189cb9e4
EJ
59 uint16_t ccm_vlan; /* CCM Vlan tag. Zero if none.
60 CFM_RANDOM_VLAN if random. */
a7aa2d3c 61 uint8_t ccm_pcp; /* CCM Priority. Zero if none. */
b363bae4
EJ
62
63 bool check_tnl_key; /* Verify inbound packet key? */
b31bcf60
EJ
64};
65
9ac3fce4 66void cfm_init(void);
90967e95 67struct cfm *cfm_create(const struct netdev *);
8e9a73fa
EJ
68struct cfm *cfm_ref(const struct cfm *);
69void cfm_unref(struct cfm *);
a58727fb 70void cfm_run(struct cfm *);
a58727fb 71bool cfm_should_send_ccm(struct cfm *);
c0a2e71d 72void cfm_compose_ccm(struct cfm *, struct ofpbuf *packet, uint8_t eth_src[6]);
b31bcf60 73void cfm_wait(struct cfm *);
a5610457 74bool cfm_configure(struct cfm *, const struct cfm_settings *);
9d46b444 75void cfm_set_netdev(struct cfm *, const struct netdev *);
642dc74d
JP
76bool cfm_should_process_flow(const struct cfm *cfm, const struct flow *,
77 struct flow_wildcards *);
b31bcf60 78void cfm_process_heartbeat(struct cfm *, const struct ofpbuf *packet);
b9380396 79int cfm_get_fault(const struct cfm *);
3967a833 80int cfm_get_health(const struct cfm *);
4653c558 81int cfm_get_opup(const struct cfm *);
13b1b2ae 82void cfm_get_remote_mpids(const struct cfm *, uint64_t **rmps, size_t *n_rmps);
b9380396 83const char *cfm_fault_reason_to_str(int fault);
a5610457 84
526d174a 85long long int cfm_wake_time(struct cfm*);
b31bcf60 86#endif /* cfm.h */