162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
262306a36Sopenharmony_ci
362306a36Sopenharmony_ci#ifndef _UAPI_LINUX_CFM_BRIDGE_H_
462306a36Sopenharmony_ci#define _UAPI_LINUX_CFM_BRIDGE_H_
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#include <linux/types.h>
762306a36Sopenharmony_ci#include <linux/if_ether.h>
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#define ETHER_HEADER_LENGTH		(6+6+4+2)
1062306a36Sopenharmony_ci#define CFM_MAID_LENGTH			48
1162306a36Sopenharmony_ci#define CFM_CCM_PDU_LENGTH		75
1262306a36Sopenharmony_ci#define CFM_PORT_STATUS_TLV_LENGTH	4
1362306a36Sopenharmony_ci#define CFM_IF_STATUS_TLV_LENGTH	4
1462306a36Sopenharmony_ci#define CFM_IF_STATUS_TLV_TYPE		4
1562306a36Sopenharmony_ci#define CFM_PORT_STATUS_TLV_TYPE	2
1662306a36Sopenharmony_ci#define CFM_ENDE_TLV_TYPE		0
1762306a36Sopenharmony_ci#define CFM_CCM_MAX_FRAME_LENGTH	(ETHER_HEADER_LENGTH+\
1862306a36Sopenharmony_ci					 CFM_CCM_PDU_LENGTH+\
1962306a36Sopenharmony_ci					 CFM_PORT_STATUS_TLV_LENGTH+\
2062306a36Sopenharmony_ci					 CFM_IF_STATUS_TLV_LENGTH)
2162306a36Sopenharmony_ci#define CFM_FRAME_PRIO			7
2262306a36Sopenharmony_ci#define CFM_CCM_TLV_OFFSET		70
2362306a36Sopenharmony_ci#define CFM_CCM_PDU_MAID_OFFSET		10
2462306a36Sopenharmony_ci#define CFM_CCM_PDU_MEPID_OFFSET	8
2562306a36Sopenharmony_ci#define CFM_CCM_PDU_SEQNR_OFFSET	4
2662306a36Sopenharmony_ci#define CFM_CCM_PDU_TLV_OFFSET		74
2762306a36Sopenharmony_ci#define CFM_CCM_ITU_RESERVED_SIZE	16
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_cistruct br_cfm_common_hdr {
3062306a36Sopenharmony_ci	__u8 mdlevel_version;
3162306a36Sopenharmony_ci	__u8 opcode;
3262306a36Sopenharmony_ci	__u8 flags;
3362306a36Sopenharmony_ci	__u8 tlv_offset;
3462306a36Sopenharmony_ci};
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_cienum br_cfm_opcodes {
3762306a36Sopenharmony_ci	BR_CFM_OPCODE_CCM = 0x1,
3862306a36Sopenharmony_ci};
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci/* MEP domain */
4162306a36Sopenharmony_cienum br_cfm_domain {
4262306a36Sopenharmony_ci	BR_CFM_PORT,
4362306a36Sopenharmony_ci	BR_CFM_VLAN,
4462306a36Sopenharmony_ci};
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci/* MEP direction */
4762306a36Sopenharmony_cienum br_cfm_mep_direction {
4862306a36Sopenharmony_ci	BR_CFM_MEP_DIRECTION_DOWN,
4962306a36Sopenharmony_ci	BR_CFM_MEP_DIRECTION_UP,
5062306a36Sopenharmony_ci};
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci/* CCM interval supported. */
5362306a36Sopenharmony_cienum br_cfm_ccm_interval {
5462306a36Sopenharmony_ci	BR_CFM_CCM_INTERVAL_NONE,
5562306a36Sopenharmony_ci	BR_CFM_CCM_INTERVAL_3_3_MS,
5662306a36Sopenharmony_ci	BR_CFM_CCM_INTERVAL_10_MS,
5762306a36Sopenharmony_ci	BR_CFM_CCM_INTERVAL_100_MS,
5862306a36Sopenharmony_ci	BR_CFM_CCM_INTERVAL_1_SEC,
5962306a36Sopenharmony_ci	BR_CFM_CCM_INTERVAL_10_SEC,
6062306a36Sopenharmony_ci	BR_CFM_CCM_INTERVAL_1_MIN,
6162306a36Sopenharmony_ci	BR_CFM_CCM_INTERVAL_10_MIN,
6262306a36Sopenharmony_ci};
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci#endif
65