1 /* SPDX-License-Identifier: GPL-2.0-or-later * 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 2 3 #ifndef _BR_PRIVATE_CFM_H_ 3 #ifndef _BR_PRIVATE_CFM_H_ 4 #define _BR_PRIVATE_CFM_H_ 4 #define _BR_PRIVATE_CFM_H_ 5 5 6 #include "br_private.h" 6 #include "br_private.h" 7 #include <uapi/linux/cfm_bridge.h> 7 #include <uapi/linux/cfm_bridge.h> 8 8 9 struct br_cfm_mep_create { 9 struct br_cfm_mep_create { 10 enum br_cfm_domain domain; /* Domain f 10 enum br_cfm_domain domain; /* Domain for this MEP */ 11 enum br_cfm_mep_direction direction; / 11 enum br_cfm_mep_direction direction; /* Up or Down MEP direction */ 12 u32 ifindex; /* Residence port */ 12 u32 ifindex; /* Residence port */ 13 }; 13 }; 14 14 15 int br_cfm_mep_create(struct net_bridge *br, 15 int br_cfm_mep_create(struct net_bridge *br, 16 const u32 instance, 16 const u32 instance, 17 struct br_cfm_mep_create 17 struct br_cfm_mep_create *const create, 18 struct netlink_ext_ack * 18 struct netlink_ext_ack *extack); 19 19 20 int br_cfm_mep_delete(struct net_bridge *br, 20 int br_cfm_mep_delete(struct net_bridge *br, 21 const u32 instance, 21 const u32 instance, 22 struct netlink_ext_ack * 22 struct netlink_ext_ack *extack); 23 23 24 struct br_cfm_mep_config { 24 struct br_cfm_mep_config { 25 u32 mdlevel; 25 u32 mdlevel; 26 u32 mepid; /* MEPID for this MEP */ 26 u32 mepid; /* MEPID for this MEP */ 27 struct mac_addr unicast_mac; /* The ME 27 struct mac_addr unicast_mac; /* The MEP unicast MAC */ 28 }; 28 }; 29 29 30 int br_cfm_mep_config_set(struct net_bridge *b 30 int br_cfm_mep_config_set(struct net_bridge *br, 31 const u32 instance, 31 const u32 instance, 32 const struct br_cfm_ 32 const struct br_cfm_mep_config *const config, 33 struct netlink_ext_a 33 struct netlink_ext_ack *extack); 34 34 35 struct br_cfm_maid { 35 struct br_cfm_maid { 36 u8 data[CFM_MAID_LENGTH]; 36 u8 data[CFM_MAID_LENGTH]; 37 }; 37 }; 38 38 39 struct br_cfm_cc_config { 39 struct br_cfm_cc_config { 40 /* Expected received CCM PDU MAID. */ 40 /* Expected received CCM PDU MAID. */ 41 struct br_cfm_maid exp_maid; 41 struct br_cfm_maid exp_maid; 42 42 43 /* Expected received CCM PDU interval. 43 /* Expected received CCM PDU interval. */ 44 /* Transmitting CCM PDU interval when 44 /* Transmitting CCM PDU interval when CCM tx is enabled. */ 45 enum br_cfm_ccm_interval exp_interval; 45 enum br_cfm_ccm_interval exp_interval; 46 46 47 bool enable; /* Enable/disable CCM PDU 47 bool enable; /* Enable/disable CCM PDU handling */ 48 }; 48 }; 49 49 50 int br_cfm_cc_config_set(struct net_bridge *br 50 int br_cfm_cc_config_set(struct net_bridge *br, 51 const u32 instance, 51 const u32 instance, 52 const struct br_cfm_c 52 const struct br_cfm_cc_config *const config, 53 struct netlink_ext_ac 53 struct netlink_ext_ack *extack); 54 54 55 int br_cfm_cc_peer_mep_add(struct net_bridge * 55 int br_cfm_cc_peer_mep_add(struct net_bridge *br, const u32 instance, 56 u32 peer_mep_id, 56 u32 peer_mep_id, 57 struct netlink_ext_ 57 struct netlink_ext_ack *extack); 58 int br_cfm_cc_peer_mep_remove(struct net_bridg 58 int br_cfm_cc_peer_mep_remove(struct net_bridge *br, const u32 instance, 59 u32 peer_mep_id, 59 u32 peer_mep_id, 60 struct netlink_e 60 struct netlink_ext_ack *extack); 61 61 62 /* Transmitted CCM Remote Defect Indication st 62 /* Transmitted CCM Remote Defect Indication status set. 63 * This RDI is inserted in transmitted CCM PDU 63 * This RDI is inserted in transmitted CCM PDUs if CCM transmission is enabled. 64 * See br_cfm_cc_ccm_tx() with interval != BR_ 64 * See br_cfm_cc_ccm_tx() with interval != BR_CFM_CCM_INTERVAL_NONE 65 */ 65 */ 66 int br_cfm_cc_rdi_set(struct net_bridge *br, c 66 int br_cfm_cc_rdi_set(struct net_bridge *br, const u32 instance, 67 const bool rdi, struct n 67 const bool rdi, struct netlink_ext_ack *extack); 68 68 69 /* OAM PDU Tx information */ 69 /* OAM PDU Tx information */ 70 struct br_cfm_cc_ccm_tx_info { 70 struct br_cfm_cc_ccm_tx_info { 71 struct mac_addr dmac; 71 struct mac_addr dmac; 72 /* The CCM will be transmitted for thi 72 /* The CCM will be transmitted for this period in seconds. 73 * Call br_cfm_cc_ccm_tx before timeou 73 * Call br_cfm_cc_ccm_tx before timeout to keep transmission alive. 74 * When period is zero any ongoing tra 74 * When period is zero any ongoing transmission will be stopped. 75 */ 75 */ 76 u32 period; 76 u32 period; 77 77 78 bool seq_no_update; /* Update Tx CCM s 78 bool seq_no_update; /* Update Tx CCM sequence number */ 79 bool if_tlv; /* Insert Interface Statu 79 bool if_tlv; /* Insert Interface Status TLV */ 80 u8 if_tlv_value; /* Interface Status T 80 u8 if_tlv_value; /* Interface Status TLV value */ 81 bool port_tlv; /* Insert Port Status T 81 bool port_tlv; /* Insert Port Status TLV */ 82 u8 port_tlv_value; /* Port Status TLV 82 u8 port_tlv_value; /* Port Status TLV value */ 83 /* Sender ID TLV ?? 83 /* Sender ID TLV ?? 84 * Organization-Specific TLV ?? 84 * Organization-Specific TLV ?? 85 */ 85 */ 86 }; 86 }; 87 87 88 int br_cfm_cc_ccm_tx(struct net_bridge *br, co 88 int br_cfm_cc_ccm_tx(struct net_bridge *br, const u32 instance, 89 const struct br_cfm_cc_cc 89 const struct br_cfm_cc_ccm_tx_info *const tx_info, 90 struct netlink_ext_ack *e 90 struct netlink_ext_ack *extack); 91 91 92 struct br_cfm_mep_status { 92 struct br_cfm_mep_status { 93 /* Indications that an OAM PDU has bee 93 /* Indications that an OAM PDU has been seen. */ 94 bool opcode_unexp_seen; /* RX of OAM P 94 bool opcode_unexp_seen; /* RX of OAM PDU with unexpected opcode */ 95 bool version_unexp_seen; /* RX of OAM 95 bool version_unexp_seen; /* RX of OAM PDU with unexpected version */ 96 bool rx_level_low_seen; /* Rx of OAM P 96 bool rx_level_low_seen; /* Rx of OAM PDU with level low */ 97 }; 97 }; 98 98 99 struct br_cfm_cc_peer_status { 99 struct br_cfm_cc_peer_status { 100 /* This CCM related status is based on 100 /* This CCM related status is based on the latest received CCM PDU. */ 101 u8 port_tlv_value; /* Port Status TLV 101 u8 port_tlv_value; /* Port Status TLV value */ 102 u8 if_tlv_value; /* Interface Status T 102 u8 if_tlv_value; /* Interface Status TLV value */ 103 103 104 /* CCM has not been received for 3.25 104 /* CCM has not been received for 3.25 intervals */ 105 u8 ccm_defect:1; 105 u8 ccm_defect:1; 106 106 107 /* (RDI == 1) for last received CCM PD 107 /* (RDI == 1) for last received CCM PDU */ 108 u8 rdi:1; 108 u8 rdi:1; 109 109 110 /* Indications that a CCM PDU has been 110 /* Indications that a CCM PDU has been seen. */ 111 u8 seen:1; /* CCM PDU received */ 111 u8 seen:1; /* CCM PDU received */ 112 u8 tlv_seen:1; /* CCM PDU with TLV rec 112 u8 tlv_seen:1; /* CCM PDU with TLV received */ 113 /* CCM PDU with unexpected sequence nu 113 /* CCM PDU with unexpected sequence number received */ 114 u8 seq_unexp_seen:1; 114 u8 seq_unexp_seen:1; 115 }; 115 }; 116 116 117 struct br_cfm_mep { 117 struct br_cfm_mep { 118 /* list header of MEP instances */ 118 /* list header of MEP instances */ 119 struct hlist_node head; 119 struct hlist_node head; 120 u32 instan 120 u32 instance; 121 struct br_cfm_mep_create create 121 struct br_cfm_mep_create create; 122 struct br_cfm_mep_config config 122 struct br_cfm_mep_config config; 123 struct br_cfm_cc_config cc_con 123 struct br_cfm_cc_config cc_config; 124 struct br_cfm_cc_ccm_tx_info cc_ccm 124 struct br_cfm_cc_ccm_tx_info cc_ccm_tx_info; 125 /* List of multiple peer MEPs */ 125 /* List of multiple peer MEPs */ 126 struct hlist_head peer_m 126 struct hlist_head peer_mep_list; 127 struct net_bridge_port __rcu *b_por 127 struct net_bridge_port __rcu *b_port; 128 unsigned long ccm_tx 128 unsigned long ccm_tx_end; 129 struct delayed_work ccm_tx 129 struct delayed_work ccm_tx_dwork; 130 u32 ccm_tx 130 u32 ccm_tx_snumber; 131 u32 ccm_rx 131 u32 ccm_rx_snumber; 132 struct br_cfm_mep_status status 132 struct br_cfm_mep_status status; 133 bool rdi; 133 bool rdi; 134 struct rcu_head rcu; 134 struct rcu_head rcu; 135 }; 135 }; 136 136 137 struct br_cfm_peer_mep { 137 struct br_cfm_peer_mep { 138 struct hlist_node head; 138 struct hlist_node head; 139 struct br_cfm_mep *mep; 139 struct br_cfm_mep *mep; 140 struct delayed_work ccm_rx 140 struct delayed_work ccm_rx_dwork; 141 u32 mepid; 141 u32 mepid; 142 struct br_cfm_cc_peer_status cc_sta 142 struct br_cfm_cc_peer_status cc_status; 143 u32 ccm_rx 143 u32 ccm_rx_count_miss; 144 struct rcu_head rcu; 144 struct rcu_head rcu; 145 }; 145 }; 146 146 147 #endif /* _BR_PRIVATE_CFM_H_ */ 147 #endif /* _BR_PRIVATE_CFM_H_ */ 148 148
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.