1 /* Copyright (c) 2010, 2011 Nicira Networks.
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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include "openvswitch/types.h"
27 /* Ethernet destination address of CCM packets. */
28 static const uint8_t eth_addr_ccm[6] OVS_UNUSED
29 = { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x30 };
31 #define ETH_TYPE_CFM 0x8902
33 /* A 'ccm' represents a Continuity Check Message from the 802.1ag
34 * specification. Continuity Check Messages are broadcast periodically so that
35 * hosts can determine who they have connectivity to. */
37 #define CCM_MAID_LEN 48
39 uint8_t mdlevel_version; /* MD Level and Version */
45 uint8_t maid[CCM_MAID_LEN];
46 uint8_t zero[16]; /* Defined by ITU-T Y.1731 should be zero */
47 } __attribute__((packed));
48 BUILD_ASSERT_DECL(CCM_LEN == sizeof(struct ccm));
51 uint16_t mpid; /* The MPID of this CFM. */
52 int interval; /* The requested transmission interval. */
53 const char *name; /* Name of this CFM object. */
55 const uint16_t *remote_mpids; /* Array of remote MPIDs */
56 size_t n_remote_mpids; /* Number of MPIDs in 'remote_mpids'. */
61 struct cfm *cfm_create(void);
63 void cfm_destroy(struct cfm *);
65 void cfm_run(struct cfm *);
67 bool cfm_should_send_ccm(struct cfm *);
69 void cfm_compose_ccm(struct cfm *, struct ccm *);
71 void cfm_wait(struct cfm *);
73 bool cfm_configure(struct cfm *, const struct cfm_settings *);
75 bool cfm_should_process_flow(const struct flow *);
77 void cfm_process_heartbeat(struct cfm *, const struct ofpbuf *packet);
79 bool cfm_get_fault(const struct cfm *);