1 /* 2 * Copyright 2021-2024 NXP 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef FSL_NETC_H_ 8 #define FSL_NETC_H_ 9 10 #include "fsl_common.h" 11 #if defined(FSL_ETH_ENABLE_CACHE_CONTROL) 12 #include "fsl_cache.h" 13 #endif 14 #if defined FSL_FEATURE_MEMORY_HAS_ADDRESS_OFFSET && FSL_FEATURE_MEMORY_HAS_ADDRESS_OFFSET 15 #include "fsl_memory.h" 16 #endif 17 18 /******************************************************************************* 19 * Definitions 20 ******************************************************************************/ 21 22 #if !(defined(__GNUC__) || defined(__ICCARM__)) 23 #pragma region netc 24 #endif 25 /*! @addtogroup netc 26 * @{ 27 */ 28 29 /*! 30 * @defgroup netc_abbrev Abbreviation in NETC driver 31 * @details Abbreviation list in NETC driver 32 * - UC: unicast 33 * - BC: broadcast 34 * - MC: multicast 35 * - IPF: ingress port filter 36 * - VlanC: Vlan classification 37 * - QosC: Qos Classification 38 * - FRER: Frame Replication and Elimination for Reliability 39 * - PSFP: Per-stream Filtering and Policing 40 * - FM: Frame Modification 41 * - SGI: Stream Gate Instance 42 * - SGC: Stream Gate Control List 43 * - ISI: Ingress Stream Identification 44 * - ISC: Ingress stream count 45 * - IS: Ingress Stream Table 46 * - VF: Vlan Filter 47 * - MF: Mac Filter 48 * - EM: Extract Match 49 * @ingroup netc 50 */ 51 52 /*! @brief Driver Version */ 53 #define FSL_NETC_DRIVER_VERSION (MAKE_VERSION(2, 7, 2)) 54 55 /*! @brief Macro to divides an address into a low 32 bits and a possible high 32 bits */ 56 #define NETC_ADDR_LOW_32BIT(x) ((uint32_t)(x)&0xFFFFFFFFU) 57 #define NETC_ADDR_HIGH_32BIT(x) ((4U != sizeof(uintptr_t)) ? (((uintptr_t)(x) >> 32U) & 0xFFFFFFFFU) : 0U) 58 59 /*! @brief Status code for the NETC module */ 60 enum 61 { 62 kStatus_NETC_RxFrameEmpty = MAKE_STATUS(kStatusGroup_NETC, 0), /*!< Rx BD ring empty. */ 63 kStatus_NETC_RxTsrResp = MAKE_STATUS(kStatusGroup_NETC, 1), /*!< Rx timestamp reference response */ 64 kStatus_NETC_RxFrameError = MAKE_STATUS(kStatusGroup_NETC, 2), /*!< Rx frame error. */ 65 kStatus_NETC_TxFrameOverLen = MAKE_STATUS(kStatusGroup_NETC, 3), /*!< Tx frame over length. */ 66 kStatus_NETC_LackOfResource = 67 MAKE_STATUS(kStatusGroup_NETC, 4), /*!< Lack of resources to configure certain features. */ 68 kStatus_NETC_Unsupported = MAKE_STATUS(kStatusGroup_NETC, 5), /*!< Unsupported operation/feature. */ 69 kStatus_NETC_RxHRZeroFrame = MAKE_STATUS(kStatusGroup_NETC, 6), /*!< Rx frame host reason is zero */ 70 kStatus_NETC_RxHRNotZeroFrame = MAKE_STATUS(kStatusGroup_NETC, 7), /*!< Rx frame host reason is not zero */ 71 kStatus_NETC_NotFound = MAKE_STATUS(kStatusGroup_NETC, 8), /*!< No entry found in hardware tables */ 72 kStatus_NETC_EntryExists = MAKE_STATUS(kStatusGroup_NETC, 9) /*!< An entry already exists in hardware tables */ 73 }; 74 75 /*! @brief Defines the common interrupt event for callback use. */ 76 typedef enum _netc_ep_event 77 { 78 kNETC_EPRxEvent, /*!< EP Rx interrupt event. */ 79 kNETC_EPTxEvent /*!< EP Tx interrupt event. */ 80 } netc_ep_event_t; 81 82 /*! @brief Status for the transmit buffer descriptor status. */ 83 typedef enum _netc_ep_tx_status 84 { 85 kNETC_EPTxSuccess = 0x0, /*!< Success transmission. */ 86 kNETC_EPTxProgramErr = 0x1, /*!< Error exists in either the Tx BD, the Tx ring registers, or both. */ 87 kNETC_EPTxTsdDrop = 0x2, /*!< The time defined in TX_START expired before frame could be transmitted. */ 88 kNETC_EPTxFrameSizeErr = 0x8, /*!< Frame size error. */ 89 kNETC_EPTxNullAddr = 0x9, /*!< Null address. */ 90 kNETC_EPTxInvalidLength = 0xA, /*!< Invalid frame/buffer/chain length. */ 91 kNETC_EPTxSrcMacSpoofingDetect = 0x10, /*!< Source MAC address spoofing detected. */ 92 kNETC_EPTxPortRestDrop = 0x20, /*!< Frame dropped due to port reset. */ 93 kNETC_EPTxPortDisableDrop = 0x21, /*!< Frame dropped due to port disable. */ 94 kNETC_EPTxVlanTpidDrop = 0x40, /*!< VLAN TPID not allowed. */ 95 kNETC_EPTxSmsoParamErr = 0x60, /*!< Programming error in buffer descriptor used for direct switch enqueue. */ 96 kNETC_EPTxFrameGateErr = 0x80, /*!< Frame too large for time gating window. */ 97 kNETC_EPTxAxiReadErr = 0x90, /*!< AXI read error. */ 98 kNETC_EPTxAxiWriteErr = 0x91, /*!< AXI write error. */ 99 kNETC_EPTxMultiBitECCErr = 0xA0, /*!< Frame not transmitted(dropped) due to a multi-bit ECC error detected. */ 100 kNETC_EPTxParityErr = 0xF0, /*!< Parity error. */ 101 kNETC_EPTxSwCongestion = 0x100, /*!< Frame dropped due to switch congestion. */ 102 } netc_ep_tx_status_t; 103 104 /*! @brief VLAN tag struct */ 105 typedef struct _netc_vlan 106 { 107 uint32_t vid : 12; /*!< Vlan Identifier. */ 108 uint32_t dei : 1; /*!< Drop Eligible indicator. */ 109 uint32_t pcp : 3; /*!< Priority. */ 110 uint32_t tpid : 16; /*!< Tag protocol identifier. */ 111 } netc_vlan_t; 112 113 /*! @brief Ethernet VLAN Tag protocol identifier */ 114 typedef enum _netc_vlan_tpid_select 115 { 116 kNETC_StanCvlan = 0x0U, /*!< 0x8100. */ 117 kNETC_StanSvlan, /*!< 0x88A8. */ 118 kNETC_CustomVlan1, /*!< CVLANR1[ETYPE] */ 119 kNETC_CustomVlan2 /*!< CVLANR2[ETYPE] */ 120 } netc_vlan_tpid_select_t; 121 122 /*! @brief Ethernet packet type enumerator */ 123 typedef enum _netc_packet_type 124 { 125 kNETC_PacketUnicast = 0U, 126 kNETC_PacketMulticast, 127 kNETC_PacketBroadcast, 128 } netc_packet_type_t; 129 130 /*! @brief Host reason*/ 131 typedef enum _netc_host_reason 132 { 133 kNETC_RegularFrame = 0x0, 134 kNETC_IngressMirror = 0x1, 135 kNETC_MACLearning = 0x2, 136 kNETC_TimestampResp = 0x3, 137 kNETC_SoftwareDefHR0 = 0x8, 138 kNETC_SoftwareDefHR1 = 0x9, 139 kNETC_SoftwareDefHR2 = 0xa, 140 kNETC_SoftwareDefHR3 = 0xb, 141 kNETC_SoftwareDefHR4 = 0xc, 142 kNETC_SoftwareDefHR5 = 0xd, 143 kNETC_SoftwareDefHR6 = 0xe, 144 kNETC_SoftwareDefHR7 = 0xf 145 } netc_host_reason_t; 146 147 /*! @brief Buffer structure. Driver can send/receive one frame spread across multiple buffers */ 148 typedef struct _ep_buffer_struct 149 { 150 void *buffer; /*!< Buffer address. */ 151 uint16_t length; /*!< Buffer data length. */ 152 } netc_buffer_struct_t; 153 154 /*! @brief Frame structure for single Tx/Rx frame */ 155 typedef struct _ep_frame_struct 156 { 157 netc_buffer_struct_t *buffArray; /*!< Buffer array. Tx: [in]App sets, Rx: [in/out]App sets prepared array, driver 158 sets back received buffers array. */ 159 uint16_t length; /*!< Buffer array length. Tx: [in]App sets, Rx: [in/out]App sets prepared array length, driver sets 160 back received buffers array length. */ 161 } netc_frame_struct_t; 162 163 /*! @brief Frame attribute struct */ 164 typedef struct _netc_frame_attr_struct 165 { 166 bool isTsAvail; /*!< Rx frame timestamp is available or not. */ 167 bool isVlanExtracted; /*!< Rx frame VLAN header is available or not. */ 168 bool isRssHashValid; 169 uint16_t parserSummary; 170 netc_host_reason_t hostReason; 171 uint8_t srcPort; 172 uint32_t rssHash; 173 netc_vlan_t vlan; 174 uint32_t timestamp; /*!< The timestamp of this Rx frame. */ 175 } netc_frame_attr_t; 176 177 /*! @brief Frame attribute structure */ 178 typedef struct _netc_tx_frame_info_struct 179 { 180 bool isTsAvail; /*!< Tx frame timestamp is available or not. */ 181 uint32_t timestamp; /*!< The timestamp of this Tx frame, valid when isTsAvail is true. */ 182 bool isTxTsIdAvail; /*!< Switch port Tx frame timestamp Identifier is available or not. */ 183 uint16_t txtsid; /*!< The Transmit Timestamp Identifier, valid when isTsIdAvail is true, use for Switch management 184 ENETC direct frame which has specified a timestamp request. */ 185 void *context; /*!< Private context provided by the user. */ 186 netc_ep_tx_status_t status; /*!< Transmit status. */ 187 } netc_tx_frame_info_t; 188 189 /*! @brief MSIX vector control field */ 190 typedef enum _netc_msix_vector_ctrl 191 { 192 kNETC_MsixIntrMaskBit = 1U, /*!< MSIX vector control interrupt mask bit. */ 193 } netc_msix_vector_ctrl_t; 194 195 /*! 196 * @brief NETC MSIX entry structure 197 */ 198 typedef struct _netc_msix_entry 199 { 200 uint64_t msgAddr; /*!< Message address. */ 201 uint32_t msgData; /*!< Message data. */ 202 uint32_t control; /*!< Vector control, netc_msix_vector_ctrl_t. */ 203 } netc_msix_entry_t; 204 205 /*! @brief METC Extension Transmit Buffer Descriptor Extension flags field */ 206 typedef enum _netc_tx_ext_flags 207 { 208 kNETC_TxExtVlanInsert = 0x1, /*!< Enable VLAN insert. */ 209 #if !(defined(FSL_FEATURE_NETC_HAS_ERRATA_051255) && FSL_FEATURE_NETC_HAS_ERRATA_051255) 210 kNETC_TxExtOneStepTs = 0x1 << 1U, /*!< Enable one-step timestamp offload. */ 211 #endif 212 kNETC_TxExtTwoStepTs = 0x1 << 2U, /*!< Enable two-step timestamp offload. */ 213 } netc_tx_ext_flags_t; 214 215 /*! @} */ // end of netc 216 #if !(defined(__GNUC__) || defined(__ICCARM__)) 217 #pragma endregion netc 218 #endif 219 220 #if !(defined(__GNUC__) || defined(__ICCARM__)) 221 #pragma region netc_hw 222 #endif 223 /*! @addtogroup netc_hw 224 * @{ 225 */ 226 /*! @brief Get SI information from netc_hw_si_idx_t. */ 227 #define getSiInstance(si) ((uint8_t)((uint16_t)(si) >> 8U)) /*!< The ENETC instance of this SI. */ 228 #define getSiNum(si) ((uint8_t)(((uint16_t)(si) >> 4U) & 0xFU)) /*!< The SI number in the ENETC. */ 229 #define getSiIdx(si) ((uint8_t)((uint16_t)(si)&0xFU)) /*!< The actaul index in the netc_hw_si_idx_t. */ 230 231 /*! @brief ENETC index enumerator */ 232 typedef enum _netc_hw_enetc_idx 233 { 234 kNETC_ENETC0, /*!< ENETC hardware 0 */ 235 kNETC_ENETC1, /*!< ENETC hardware 0 */ 236 } netc_hw_enetc_idx_t; 237 238 /*! @brief SWITCH index enumerator */ 239 typedef enum _netc_hw_switch_idx 240 { 241 kNETC_SWITCH0, /*!< SWITCH hardware 0 */ 242 } netc_hw_switch_idx_t; 243 244 /*! @brief Port Resource for the NETC module */ 245 typedef enum _netc_hw_port_idx 246 { 247 kNETC_ENETC0Port = 0U, /*!< MAC port for ENETC0 */ 248 kNETC_ENETC1Port = 0U, /*!< Pseudo MAC port for ENETC1 */ 249 kNETC_SWITCH0Port0 = 0U, /*!< MAC port0 for SWITCH */ 250 kNETC_SWITCH0Port1 = 1U, /*!< MAC port1 for SWITCH */ 251 kNETC_SWITCH0Port2 = 2U, /*!< MAC port2 for SWITCH */ 252 kNETC_SWITCH0Port3 = 3U, /*!< MAC port3 for SWITCH */ 253 kNETC_SWITCH0Port4 = 4U, /*!< Pseudo port4 for SWITCH */ 254 } netc_hw_port_idx_t; 255 256 /*! @brief Traffic class enumerator */ 257 typedef enum _netc_hw_tc_idx 258 { 259 kNETC_TxTC0 = 0, /*!< Traffic class 0 */ 260 kNETC_TxTC1, /*!< Traffic class 1 */ 261 kNETC_TxTC2, /*!< Traffic class 2 */ 262 kNETC_TxTC3, /*!< Traffic class 3 */ 263 kNETC_TxTC4, /*!< Traffic class 4 */ 264 kNETC_TxTC5, /*!< Traffic class 5 */ 265 kNETC_TxTC6, /*!< Traffic class 6 */ 266 kNETC_TxTC7 /*!< Traffic class 7 */ 267 } netc_hw_tc_idx_t; 268 269 /*! @brief Enumeration for the ENETC SI BDR identifier */ 270 typedef enum _netc_hw_bdr_idx 271 { 272 kNETC_BDR0 = 0, 273 kNETC_BDR1, 274 kNETC_BDR2, 275 kNETC_BDR3, 276 kNETC_BDR4, 277 kNETC_BDR5, 278 kNETC_BDR6, 279 kNETC_BDR7, 280 kNETC_BDR8, 281 kNETC_BDR9, 282 kNETC_BDR10, 283 kNETC_BDR11, 284 kNETC_BDR12, 285 kNETC_BDR13 286 } netc_hw_bdr_idx_t; 287 288 /*! @brief Switch command BD ring index enumerator */ 289 typedef enum _netc_hw_swt_cbdr_idx 290 { 291 kNETC_SWTCBDR0 = 0U, /*!< Switch command BD ring 0 */ 292 kNETC_SWTCBDR1 /*!< Switch command BD ring 1 */ 293 } netc_hw_swt_cbdr_idx_t; 294 295 /*! @brief Enumerator for ETM class queue identifier */ 296 typedef enum _netc_hw_classs_queue_idx 297 { 298 kNETC_ClassQueue0 = 0, /*!< ETM Class Queue 0 */ 299 kNETC_ClassQueue1, /*!< ETM Class Queue 1 */ 300 kNETC_ClassQueue2, /*!< ETM Class Queue 2 */ 301 kNETC_ClassQueue3, /*!< ETM Class Queue 3 */ 302 kNETC_ClassQueue4, /*!< ETM Class Queue 4 */ 303 kNETC_ClassQueue5, /*!< ETM Class Queue 5 */ 304 kNETC_ClassQueue6, /*!< ETM Class Queue 6 */ 305 kNETC_ClassQueue7 /*!< ETM Class Queue 7 */ 306 } netc_hw_etm_class_queue_idx_t; 307 308 /*! @brief Enumerator for the ETM congestion group */ 309 typedef enum _netc_hw_congestion_group_idx 310 { 311 kNETC_CongGroup0 = 0, 312 kNETC_CongGroup1 313 } netc_hw_congestion_group_idx_t; 314 315 /*! @brief Defines the MII/RGMII mode for data interface between the MAC and the PHY. */ 316 typedef enum _netc_hw_mii_mode 317 { 318 kNETC_XgmiiMode = 0U, /*!< XGMII mode for data interface. */ 319 kNETC_MiiMode = 1U, /*!< MII mode for data interface. */ 320 kNETC_GmiiMode = 2U, /*!< GMII mode for data interface. */ 321 kNETC_RmiiMode = 3U, /*!< RMII mode for data interface. */ 322 kNETC_RgmiiMode = 4U, /*!< RGMII mode for data interface. */ 323 } netc_hw_mii_mode_t; 324 325 /*! @brief Defines the speed for the *MII data interface. */ 326 typedef enum _netc_hw_mii_speed 327 { 328 kNETC_MiiSpeed10M = 0U, /*!< Speed 10 Mbps. */ 329 kNETC_MiiSpeed100M = 1U, /*!< Speed 100 Mbps. */ 330 kNETC_MiiSpeed1000M = 2U, /*!< Speed 1000 Mbps. */ 331 kNETC_MiiSpeed2500M = 3U, /*!< Speed 2500 Mbps. */ 332 kNETC_MiiSpeed5G = 4U, /*!< Speed 5Gbps. */ 333 kNETC_MiiSpeed10G = 5U, /*!< Speed 10Gbps Mbps. */ 334 } netc_hw_mii_speed_t; 335 336 /*! @brief Defines the half or full duplex for the MII data interface. */ 337 typedef enum _netc_hw_mii_duplex 338 { 339 kNETC_MiiHalfDuplex = 0U, /*!< Half duplex mode. */ 340 kNETC_MiiFullDuplex /*!< Full duplex mode. */ 341 } netc_hw_mii_duplex_t; 342 343 /*! @brief NETC PSFP kc profile configuration, the key size (not include the spmp and portp) is up to 16 bytes */ 344 typedef struct _netc_psfp_kc_profile 345 { 346 bool etp : 1; /*!< 2 Byte Ethertype field present in the key */ 347 bool sqtp : 1; /*!< 1 Byte Sequence Tag present in the key */ 348 bool ipcpp : 1; /*!< inner VLAN header's PCP field present in the key */ 349 bool ividp : 1; /*!< inner VLAN ID present in the key */ 350 bool opcpp : 1; /*!< outer VLAN header's PCP field present in the key */ 351 bool ovidp : 1; /*!< outer VLAN ID present in the key */ 352 bool smacp : 1; /*!< 6 bytes of source MAC address present in the key */ 353 bool dmacp : 1; /*!< 6 bytes of destination MAC address present in the key */ 354 bool spmp : 1; /*!< switch port masquerading flag present in the key */ 355 bool portp : 1; /*!< source port present in the key */ 356 bool valid : 1; /*!< Key Construction is valid */ 357 struct 358 { 359 uint8_t lbMask : 3; /*!< Payload Last Byte Mask */ 360 uint8_t fbMask : 3; /*!< Payload First Byte Mask */ 361 uint8_t byteOffset : 7; /*!< Payload Byte Offset where field extraction begins */ 362 uint8_t numBytes : 4; /*!< Specify the size (numBytes + 1) of the payload key field */ 363 uint8_t pfp : 1; /*!< Payload field Present */ 364 } payload[4]; 365 } netc_isi_kc_rule_t; 366 367 /*! @brief NETC Vlan classification config */ 368 typedef struct _netc_vlan_classify_config 369 { 370 bool enableCustom1; /*!< Enable/Disable custom0 ether type */ 371 uint16_t custom1EtherType; /*!< Ethertype */ 372 bool enableCustom2; /*!< Enable/Disable custom0 ether type */ 373 uint16_t custom2EtherType; /*!< Ethertype */ 374 uint16_t preStandRTAGType; /*!< 802.1CB draft 2.0 R-TAG Ethertype value. PSRTAGETR. Only applicable for switch */ 375 } netc_vlan_classify_config_t; 376 377 /*! @brief NETC Qos Classification profile file (vlan PCP/DEI to IPV/DR map) */ 378 typedef struct _netc_qos_classify_profile 379 { 380 uint8_t ipv[16]; /*!< Index is created from PCP (3 bits) + DEI (1 bit) field. Value is the mapped IPV for Qos. */ 381 uint8_t dr[16]; /*!< Index is created from PCP (3 bits) + DEI (1 bit) field. Value is the mapped DR for QoS. */ 382 } netc_qos_classify_profile_t; 383 384 /*! @brief NETC Ingress Filter config */ 385 typedef struct _netc_ipf_config 386 { 387 bool l2DiscardMCSmac; /*!< DOSL2CR. Discard received frames with Multicast SMAC address */ 388 bool l2DiscardSmacEquDmac; /*!< DOSL2CR. Discard received frames with SMAC = DMAC */ 389 bool l3DiscardSipEquDip; /*!< DOSL3CR. Discard IPV3/IPV6 source address == destination address */ 390 } netc_ipf_config_t; 391 392 /*! @} */ // end of netc_hw 393 #if !(defined(__GNUC__) || defined(__ICCARM__)) 394 #pragma endregion netc_hw 395 #endif 396 397 #if !(defined(__GNUC__) || defined(__ICCARM__)) 398 #pragma region netc_hw_enetc 399 #endif 400 /*! @addtogroup netc_hw_enetc 401 * @{ 402 */ 403 /*! @brief ENETC Port outer/inner VLAN tag */ 404 typedef struct _netc_enetc_vlan_tag_t 405 { 406 uint16_t pcp : 3; /*!< Priority code point */ 407 uint16_t dei : 1; /*!< Drop eligible indicator */ 408 uint16_t vid : 12; /*!< VLAN identifier */ 409 netc_vlan_tpid_select_t tpid : 2; /*!< Tag protocol identifier */ 410 } netc_enetc_vlan_tag_t; 411 412 /*! @brief PORT discard count statistic */ 413 typedef struct _netc_enetc_discard_statistic 414 { 415 uint32_t ingressDR[4]; /*!< Discard count for port ingress congestion different DR */ 416 uint32_t broadcastReject; /*!< Broadcast frame drops count due to all SI enable broadcast reject */ 417 uint32_t smacPruning; /*!< Frames discard count due to port MAC source address pruning */ 418 uint32_t unicastMacFilt; /*!< Unicast frame discard count due to port MAC filtering */ 419 uint32_t multicastMacFilt; /*!< Multicast frame discard count due to MAC filtering */ 420 uint32_t unicastVlanFilt; /*!< Unicast frame discard count due to VLAN filtering */ 421 uint32_t multicastVlanFilt; /*!< Multicast frame discard count due to VLAN filtering */ 422 uint32_t boradcastVlanFilt; /*!< Broadcast frame discard count due to VLAN filtering */ 423 } netc_enetc_port_discard_statistic_t; 424 425 /*! @brief ENETC Port outer/inner native VLAN config */ 426 typedef struct _netc_enetc_native_vlan_config_t 427 { 428 bool enUnderZeroVid; /*!< Enable use the port default VLAN VID when the VID in the packet's is zero */ 429 bool enUnderNoVlan; /*!< Enable use the port default VLAN VID when the VLAN tag is not present */ 430 netc_enetc_vlan_tag_t 431 vlanTag; /*!< Port native outer/inner VLAN tag, valid when enUnderZeroVid or enUnderNoVlan is true */ 432 } netc_enetc_native_vlan_config_t; 433 434 /*! @brief ENETC parser configuration */ 435 typedef struct _netc_enetc_parser_config_t 436 { 437 bool disL3Checksum; /*!< Disable Layer 3 IPv4 Header checksum validation. */ 438 bool disL4Checksum; /*!< Disable Layer 4 TCP and UDP checksum validation. */ 439 struct 440 { 441 uint16_t etype; /*!< Custom Ethertype value. Upon detecting this ether type the associated code point will be 442 mapped to the parse summary as a Non IP code point. */ 443 bool en; /*!< Enables the detection and mapping. */ 444 uint8_t cp; /*!< This value is mapped to the parse summary as a Non IP code point. */ 445 } custEtype[4]; 446 } netc_enetc_parser_config_t; 447 448 /*! @} */ // end of netc_hw_enetc 449 #if !(defined(__GNUC__) || defined(__ICCARM__)) 450 #pragma endregion netc_hw_enetc 451 #endif 452 453 #if !(defined(__GNUC__) || defined(__ICCARM__)) 454 #pragma region netc_hw_port 455 #endif 456 /*! @addtogroup netc_hw_port 457 * @{ 458 */ 459 460 /*! @brief Port time gate scheduling gate list status */ 461 typedef enum _netc_port_tgsl_status 462 { 463 kNETC_OperListActive = 0x1U, /*!< Port operational gate control list is active. */ 464 kNETC_AdminListPending = 465 0x2U /*!< Administrative gate control list is pending (configured but not installed yet). */ 466 } netc_port_tgsl_status_t; 467 468 /*! @brief Port Tx/Rx discard counter in the datapath processing pipeline or bridge forwarding processing function*/ 469 typedef enum _netc_port_discard_tpye 470 { 471 kNETC_RxDiscard = 0U, /*!< Discarded frames in the receive port datapath processing pipeline. */ 472 kNETC_TxDiscard, /*!< Discarded frames in the egress datapath processing pipeline, only for switch. */ 473 kNETC_BridgeDiscard /*!< Discarded frames in the bridge forwarding processing function, only for switch. */ 474 } netc_port_discard_tpye_t; 475 476 /*! @brief Defines Port TPID acceptance */ 477 typedef enum _netc_port_tpidlist 478 { 479 kNETC_OuterStanCvlan = 0x1U, /*!< Accept outer Standard C-VLAN 0x8100. */ 480 kNETC_OuterStanSvlan = 0x2U, /*!< Accept outer Standard S-VLAN 0x88A8. */ 481 kNETC_OuterCustomVlan1 = 0x4U, /*!< Accept outer Custom VLAN as defined by CVLANR1[ETYPE]. */ 482 kNETC_OuterCustomVlan2 = 0x8U, /*!< Accept outer Custom VLAN as defined by CVLANR2[ETYPE]. */ 483 kNETC_InnerStanCvlan = 0x1U, /*!< Accept inner Standard C-VLAN 0x8100. */ 484 kNETC_InnerStanSvlan = 0x2U, /*!< Accept inner Standard S-VLAN 0x88A8. */ 485 kNETC_InnerCustomVlan1 = 0x4U, /*!< Accept inner Custom VLAN as defined by CVLANR1[ETYPE]. */ 486 kNETC_InnerCustomVlan2 = 0x8U, /*!< Accept inner Custom VLAN as defined by CVLANR2[ETYPE]. */ 487 } netc_port_tpidlist_t; 488 489 /*! @brief Defines port timestamp selection. */ 490 typedef enum _netc_port_ts_select 491 { 492 kNETC_SyncTime = 0U, /*!< Synchronized time. */ 493 kNETC_FreeRunningTime /*!< Free running time. */ 494 } netc_port_ts_select_t; 495 496 /*! @brief Port Qos mode */ 497 typedef struct _netc_port_qos_mode 498 { 499 uint8_t qosVlanMap : 4; /*!< Transmit QoS to VLAN PCP Mapping Profile index, only active on switch port */ 500 uint8_t vlanQosMap : 4; /*!< Receive VLAN PCP/DE to QoS Mapping Profile index, only active on switch port */ 501 uint8_t defaultIpv : 3; /*!< Port default IPV */ 502 uint8_t defaultDr : 2; /*!< Port default DR */ 503 bool enVlanInfo : 1; /*!< Enable use VLAN info to determine IPV and DR (base on VLANIPVMPaR0/1 and VLANDRMPaR) */ 504 bool vlanTagSelect : 1; /*!< True: Outer VLAN, False: Innner VLAN. Active when enVlanInfo is true */ 505 } netc_port_qos_mode_t; 506 507 /*! @brief Port Parser config */ 508 typedef struct _netc_port_parser_config 509 { 510 uint8_t l2PloadCount : 5; /*!< L2 payload fields size in bytes */ 511 bool enableL3Parser : 1; /*!< Enable/Disable parser for L3 */ 512 uint8_t l3PayloadCount : 5; /*!< L3 payload fields size in bytes */ 513 bool enableL4Parser : 1; /*!< Enable/Disable parser for L4 */ 514 uint8_t l4PayloadCount : 5; /*!< L4 payload fields size in bytes */ 515 } netc_port_parser_config_t; 516 517 /*! @brief Port time gate config */ 518 typedef struct _netc_port_tg_config 519 { 520 uint16_t advOffset; /*!< Advance time offset in ns. */ 521 uint32_t holdSkew; /*!< Hold-Skew in ns, not effective on ports connected to a pseudo-MAC */ 522 } netc_port_tg_config_t; 523 524 /*! @brief Port MAC preemption mode */ 525 typedef enum _netc_hw_preemption_mode 526 { 527 kNETC_PreemptDisable = 0U, /*!< Frame preemption is not enabled */ 528 kNETC_PreemptOn64B, /*!< Frame preemption is enabled, but transmit only preempts frames on 64B boundaries */ 529 kNETC_PreemptOn4B /*!< Frame preemption is enabled, but transmit only preempts frames on 4B boundaries */ 530 } netc_hw_preemption_mode_t; 531 532 /*! @brief Configuration for the Credit Based Shaped for port TC. 533 * 534 * @note The 802.1Qav bandwidth availability parameters is is calculated as follows: 535 * - idleSlope (bits) = portTxRate * bwWeight / 100 536 * - sendSlope (bits) = portTxRate * (100 - bwWeight) / 100 537 * - lowCredit (bits) = tcMaxFrameSize * (100 - bwWeight) / 100 538 * - hiCredit (bits) calculation formula depends on the traffic class, Please refer to the Reference manual. 539 * - hiCredit (credits) = (enetClockFrequency / portTxRate) * 100 * hiCredit (bits) 540 */ 541 typedef struct _netc_port_tc_cbs_config 542 { 543 uint8_t bwWeight; /*!< Percentage units of the port transmit rate and the credit-based shaper (range from 0 ~ 100), 544 the sum of all traffic class credit-based shaper's bandwidth cannot exceed 100 */ 545 uint32_t hiCredit; /*!< The maximum allowed accumulation of credits when conflicting transfers occur, 546 in credit units ((enetClockFrequency / portTxRate) * 100) */ 547 } netc_port_tc_cbs_config_t; 548 549 /*! @brief Type of PDU/SDU (Protocol/Service Data Unit). 550 * 551 * @note Overhead values which adding to the transmitted frame of Length are specified by Port SDU config as follows: 552 * - PPDU = add rxPpduBco/txPpduBco + rxMacsecBco/txMacsecBco bytes 553 * - MPDU = add rxMacsecBco/txMacsecBco bytes 554 * - MSDU = minus 16B (12B MAC Header + 4B FCS) 555 */ 556 typedef enum _netc_tc_sdu_type 557 { 558 kNETC_PDU = 0U, /*!< Physical Layer PDU, Preamble, IFG, SFD along with MPDU. Not supported if cut-through frames are 559 expected */ 560 kNETC_MPDU, /*!< MAC PDU, MAC Header, MSDU and FCS */ 561 kNETC_MSDU /*!< MAC SDU, MPDU minus 12B MAC Header and 4B FCS. Not supported if cut-through frames are expected */ 562 } netc_tc_sdu_type_t; 563 564 typedef struct _netc_port_tc_sdu_config 565 { 566 bool enTxMaxSduCheck; /*!< Enable Tx Max SDU check for Store and Forward frames, the frame which greater than 567 maxSduSized wiil be discarded, Cut-Through frames will always perform Max SDU check */ 568 netc_tc_sdu_type_t 569 sduType; /*!< Specifies the type of PDU/SDU whose length is being validated as seen on the link */ 570 uint16_t maxSduSized; /*!< Transmit Maximum SDU size in bytes, the dequeued frame will be discarded when it SDU size 571 exceeds this value */ 572 } netc_port_tc_sdu_config_t; 573 574 /*! @brief Configuration for the port Tx Traffic Class */ 575 typedef struct _netc_port_tx_tc_config 576 { 577 bool enPreemption : 1; /*!< Frames from traffic class are transmitted on the preemptable MAC, not supported on 578 internal port (ENETC 1 port and Switch port 4)*/ 579 bool enTcGate : 1; /*!< Enable the traffic class gate when no gate control list is operational, or when time gate 580 scheduling is disabled. */ 581 bool enableTsd : 1; /*!< Enable Time Specific Departure traffic class, only applicable to ENETC */ 582 bool enableCbs : 1; /*!< Enable Credit based shaper for traffic class */ 583 netc_port_tc_sdu_config_t sduCfg; 584 netc_port_tc_cbs_config_t cbsCfg; /*!< Configure transmit traffic class credit based shaper (PTC0CBSR0/PTC0CBSR1) if 585 enableCbs set to ture */ 586 } netc_port_tx_tc_config_t; 587 588 /*! @brief Switch or ENETC port Tx/Rx/Bridge discard statistic / reason */ 589 typedef struct _netc_port_discard_statistic 590 { 591 uint32_t count; /*!< Count of discarded frames. PRXDCR, PTXDCR or BPDCR. */ 592 uint32_t reason0; /*!< Discard Reason. Find bit detail from PT/RXDCRR0 or BPDCRR0. */ 593 uint32_t reason1; /*!< Discard Reason. Find bit detail from PT/RXDCRR1 or BPDCRR1.*/ 594 } netc_port_discard_statistic_t; 595 596 /*! @brief Port accepted Vlan classification config */ 597 typedef struct _netc_port_vlan_classify_config 598 { 599 uint8_t innerMask : 4; /*!< Bitmap identifying which TPIDs are acceptable as Inner VLAN tag. See PTAR */ 600 uint8_t outerMask : 4; /*!< Bitmap identifying which TPIDs are acceptable as Outter VLAN tag. See PTAR */ 601 } netc_port_vlan_classify_config_t; 602 603 /*! @brief Port Qos Classification Config */ 604 typedef struct _netc_port_qos_classify_configs 605 { 606 uint8_t vlanQosMap : 4; /*!< Receive VLAN PCP/DE to QoS Mapping Profile index */ 607 uint8_t defaultIpv : 3; /*!< Port default IPV */ 608 uint8_t defaultDr : 2; /*!< Port default DR */ 609 bool enVlanInfo : 1; /*!< Enable use VLAN info to determine IPV and DR ,base on VLAN to IPV map (VLANIPVMPaR0/1) and 610 VLAN to DR map (VLANDRMPaR) */ 611 bool vlanTagSelect : 1; /*!< True: Use received Outer VLAN, False: Use received Innner VLAN. Active when enVlanInfo 612 is true */ 613 } netc_port_qos_classify_config_t; 614 615 /*! @brief Port Ingress Filter Config */ 616 typedef struct _netc_port_ipf_config_t 617 { 618 bool enL2Dos : 1; /*!< Enable port L2 Ethernet DoS Protection */ 619 bool enL3Dos : 1; /*!< Enable port L3 IP DoS Protection */ 620 bool enIPFTable : 1; /*!< Enable port IPF lookup */ 621 } netc_port_ipf_config_t; 622 623 /*! @brief PSFP port config */ 624 /*! 625 * @brief Port ingress stream identification config 626 * 627 * @note The first stream identification find IS_EID has higher precedence value than the second, and the priority of 628 * the IS_EID found by the IPF is specified by the IPF entry RRR bit. The possible orderings are as follows 629 * - RRR = 00b : IPF > enKC0 > enKC1 > defaultISEID 630 * - RRR = 01b : enKC0 > IPF > enKC1 > defaultISEID 631 * - RRR = 10b : enKC0 > enKC1 > IPF > defaultISEID 632 */ 633 typedef struct _netc_port_psfp_isi_config 634 { 635 uint16_t defaultISEID; /*!< Default Ingress Stream Entry ID, has lower precedence value than ISI entry and IPF entry 636 defined IS_EID. 0xFFFF means NULL */ 637 bool enKC1 : 1; /*!< Enable do the second stream identification with key construction rule 1 or rule 3 */ 638 bool enKC0 : 1; /*!< Enable do the first stream identification with key construction rule 0 or rule 2 */ 639 bool kcPair : 1; /*!< Indicates which Key Construction pair to use for this port, false - user pair0. true - use 640 pair1 only applicable for Switch */ 641 } netc_port_psfp_isi_config; 642 643 typedef struct _netc_port_ethmac 644 { 645 bool enableRevMii : 1; /*!< Enable RevMII mode. */ 646 netc_port_ts_select_t txTsSelect : 1; /*!< Tx timestamp clock source. */ 647 bool isTsPointPhy : 1; /*!< True: Timestamp is captured based on PHY SFD detect pulse on Rx and Tx for 2-step timestamping. 648 False: Based on SFD detect at boundary of MAC merge layer and pins/protocol gaskets. */ 649 netc_hw_mii_mode_t miiMode : 3; /*!< MII mode. */ 650 netc_hw_mii_speed_t miiSpeed : 3; /*!< MII Speed. */ 651 netc_hw_mii_duplex_t miiDuplex : 1; /*!< MII duplex. */ 652 bool enTxPad : 1; /*!< Enable ETH MAC Tx Padding, which will pad the frame to a minimum of 60 bytes and append 4 653 octets of FCS. */ 654 uint8_t rxMinFrameSize : 7; /*!< Receive Minimum Frame Length size in bytes, range in 18 ~ 64, received frames 655 shorter than 18B are discarded silently. Both for express MAC and preemptable MAC. */ 656 uint16_t rxMaxFrameSize; /*!< Receive Maximum Frame Length size in bytes, up to 2000, received frames that exceed 657 this stated maximum are truncated. Both for express MAC and preemptable MAC. */ 658 bool enMergeVerify : 1; /*!< Enable verify the merged preemption frame, need to enable when preemptMode is not zero 659 */ 660 uint8_t mergeVerifyTime : 7; /*!< The nominal wait time between verification attempts in milliseconds, range in 1 ~ 661 128 */ 662 netc_hw_preemption_mode_t preemptMode : 2; /*!< When set to not zero, PMAC frames may be preempted by EMAC frames */ 663 bool rgmiiClkStop : 1; /*!< True: RGMII transmit clock is stoppable during low power idle. False: It's not stoppable. */ 664 #if !(defined(FSL_FEATURE_NETC_HAS_ERRATA_051255) && FSL_FEATURE_NETC_HAS_ERRATA_051255) 665 bool enOneStepTS : 1; /*!< Enable IEEE-1588 Single-Step timestamp */ 666 bool enChUpdate : 1; /*!< Enable correction UDP checksum when enable Single-Step timestamp */ 667 uint16_t oneStepOffset : 10; /*!< Start offset from the beginning of a frame where the field to update is found 668 (index to MS byte) */ 669 #endif 670 bool enableHalfDuplexFlowCtrl : 1; /*!< Enable/Disable half-duplex flow control. */ 671 uint16_t maxBackPressOn; /*!< Maximum amount of time backpressure can stay asserted before stopping to prevent excess 672 defer on link partner, in byte times. */ 673 uint16_t minBackPressOff; /*!< Minimum amount of time backpressure will stay off after reaching the ON max, before 674 backpressure can reassert after checking if icm_pause_notification is still or again 675 asserted, in byte times. */ 676 } netc_port_ethmac_t; 677 678 /*! @brief Defines the Port's Stream Gate Open Gate Check mode. */ 679 typedef enum _netc_port_sg_ogc_mode 680 { 681 kNETC_SGCheckSFD = 0U, /*!< Check whether frame SFD is within the open gate interval. */ 682 kNETC_SGCheckEntire /*!< Check whether the entire frame is within the open gate interval. */ 683 } netc_port_sg_ogc_mode_t; 684 685 /*! @brief Port common configuration */ 686 typedef struct _netc_port_common 687 { 688 netc_port_vlan_classify_config_t acceptTpid; /*!< Port acceptable VLAN tpid configure. */ 689 netc_port_ts_select_t rxTsSelect; /*!< Eth MAC Rx or pseudo MAC Tx timestamp clock source */ 690 uint16_t pSpeed; /*!< Transmit Port Speed = 10Mbps * (pSpeed+1), Used by ETS, Qbu and to determine if cut-through is 691 permissable */ 692 uint8_t rxMacsecBco; /*!< Port receive MACSec byte count overhead which due to MACSec encapsulation */ 693 uint8_t rxPpduBco; /*!< Port receive PPDU Byte count overhead which includes IPG, SFD and Preamble */ 694 uint8_t txMacsecBco; /*!< Port transmit MACSec byte count overhead which due to MACSec encapsulation */ 695 uint8_t txPpduBco; /*!< Port transmit PPDU Byte count overhead which includes IPG, SFD and Preamble */ 696 #if (defined(FSL_FEATURE_NETC_HAS_PORT_FCSEA) && FSL_FEATURE_NETC_HAS_PORT_FCSEA) 697 bool stompFcs : 1; /*!< Enable stomp the FCS error frame, not effective on ports connected to a pseudo-MAC, only 698 applies to device with ASIL-B safety requirements */ 699 #endif 700 netc_port_sg_ogc_mode_t ogcMode : 1; /*!< Stream Gate Open Gate Check mode, 0b is check whether SFD is within the 701 open gate interval, 1b is check whether the entire frame is within the open gate interval */ 702 uint32_t pDelay : 24; /*!< Link propagation delay in ns */ 703 uint8_t macAddr[6]; /*!< Port MAC address, used for Switch egress frame modification action or ENETC SI0 primary MAC 704 address */ 705 netc_port_qos_classify_config_t qosMode; /*!< Port Rx Qos Classification config */ 706 netc_port_ipf_config_t ipfCfg; /*!< Port ingress port filter configuration */ 707 netc_port_tg_config_t timeGate; /*!< Port Tx time gate config */ 708 netc_port_parser_config_t parser; /*!< Port Rx Parser config */ 709 } netc_port_common_t; 710 711 /*! @} */ // end of netc_hw_port 712 #if !(defined(__GNUC__) || defined(__ICCARM__)) 713 #pragma endregion netc_hw_port 714 #endif 715 716 #if !(defined(__GNUC__) || defined(__ICCARM__)) 717 #pragma region netc_hw_port_mac 718 #endif 719 /*! @addtogroup netc_hw_port_mac 720 * @{ 721 */ 722 723 /*! @brief Defines the Ethernet MAC physical port type. */ 724 typedef enum _netc_port_phy_mac_type 725 { 726 kNETC_ExpressMAC = 0U, /*!< The MAC which handles express traffic when frame preemption is enabled or handles all 727 traffic when frame preemption is disabled. */ 728 kNETC_PreemptableMAC /*!< The MAC which handles preemptive traffic when frame preemption is enabled. */ 729 } netc_port_phy_mac_type_t; 730 731 /*! @brief Definesthe state of the mac merge sublayer with respect to verification as defined in IEEE Std 802.3br-2016. 732 */ 733 typedef enum _netc_port_preemption_verify_status 734 { 735 kNETC_VerifyDisable = 0U, /*!< Verification is disabled */ 736 kNETC_VerifyInProgress = 2U, /*!< Verification is in progress */ 737 kNETC_VerifySuccess, /*!< Verification was successful */ 738 kNETC_VerifyFaile, /*!< Verification failed */ 739 kNETC_VerifyUndefined /*!< Verification is in an undefined state */ 740 } netc_port_preemption_verify_status_t; 741 742 /*! @brief Port MAC preemption Status */ 743 typedef struct _netc_port_phy_mac_preemption_status 744 { 745 bool mergeActive; /*!< Transmit preemption is active or not */ 746 netc_port_preemption_verify_status_t verifyStatus; /*!< Transmit preemption is active or not */ 747 } netc_port_phy_mac_preemption_status_t; 748 749 /*! @brief Ethernet MAC physical port traffic (Tx/Rx) statistics counters, when enable frame preemption, one physical 750 * MAC will be divided into a pMAC and a eMAC and statistics counters will also have two groups */ 751 typedef struct _netc_port_phy_mac_traffic_statistic 752 { 753 uint64_t totalOctet; /*!< Count of MAC received/transmitted good/error Ethernet octets. */ 754 uint64_t validOctet; /*!< Count of MAC received/transmitted good Ethernet octets. */ 755 uint64_t pauseFrame; /*!< Count of MAC received/transmitted valid PAUSE frames. */ 756 uint64_t validFrame; /*!< Count of MAC received/transmitted valid frames. */ 757 uint64_t vlanFrame; /*!< Count of MAC received/transmitted valid VLAN tagged frames. */ 758 uint64_t unicastFrame; /*!< Count of MAC received/transmitted valid unicast frames. */ 759 uint64_t multicastFrame; /*!< Count of MAC received/transmitted valid multicast frames. */ 760 uint64_t boradcastFrame; /*!< Count of MAC received/transmitted valid broadcast frames. */ 761 uint64_t totalPacket; /*!< Count of MAC received/transmitted good/error packets. */ 762 uint64_t rxMinPacket; /*!< Count of MAC received min to 63-octet packets. */ 763 uint64_t total64BPacket; /*!< Count of MAC received/transmitted 64 octet packets. */ 764 uint64_t total65To127BPacket; /*!< Count of MAC received/transmitted 65 to 127 octet packets. */ 765 uint64_t total128To255BPacket; /*!< Count of MAC received/transmitted 128 to 255 octet packets. */ 766 uint64_t total256To511BPacket; /*!< Count of MAC received/transmitted 256 to 511 octet packets. */ 767 uint64_t total511To1023BPacket; /*!< Count of MAC received/transmitted 512 to 1023 octet packets. */ 768 uint64_t total1024To1522BPacket; /*!< Count of MAC received/transmitted 1024 to 1522 octet packets. */ 769 uint64_t total1523ToMaxBPacket; /*!< Count of MAC received/transmitted 1523 to Max octet packets. */ 770 uint64_t controlPacket; /*!< Count of MAC received/transmitted control packets. */ 771 } netc_port_phy_mac_traffic_statistic_t; 772 773 /*! @brief Ethernet MAC physical port frame discard/errors status statistics counters, when enable frame preemption, one 774 * physical MAC will be divided into a pMAC and a eMAC and statistics counters will also have two groups */ 775 typedef struct _netc_port_phy_mac_discard_statistic 776 { 777 uint64_t rxError; /*!< Count of MAC received error frames. */ 778 uint64_t rxUndersized; /*!< Count of MAC received undersized frames. */ 779 uint64_t rxOversized; /*!< Count of MAC received oversized frames. */ 780 uint64_t rxErrorFCS; /*!< Count of MAC received check sequence (FCS) error frames. */ 781 uint64_t rxFragment; /*!< Count of MAC frames which is shorter than the MIN length and received with a 782 wrong FCS/CRC. */ 783 uint64_t rxJabber; /*!< Count of MAC frames which is larger than the MAX length and received with a 784 wrong FCS/CRC. */ 785 uint64_t rxDiscard; /*!< Count of MAC drops frame. */ 786 uint64_t rxDiscardNoTruncated; /*!< Count of MAC non-truncated drops frame. */ 787 uint64_t txErrorFCS; /*!< Count of MAC transmitted bad FCS frames. */ 788 uint64_t txUndersized; /*!< Count of MAC transmitted less than 64B with good FCS frames. */ 789 } netc_port_phy_mac_discard_statistic_t; 790 791 /*! @brief Ethernet physical MAC port preemption (Tx/Rx) related statistics counters */ 792 typedef struct _netc_port_phy_mac_preemption_statistic 793 { 794 uint32_t rxReassembledFrame; /*!< Count of MAC frames that were successfully reassembled and delivered to 795 the MAC. */ 796 uint32_t rxReassembledError; /*!< Count of MAC frames with reassembly errors. */ 797 uint32_t rxMPacket; /*!< Count of the number of additional mPackets received due to preemption. */ 798 uint32_t rxSMDError; /*!< Count of received MAC frames / MAC frame fragments rejected due to unknown SMD. */ 799 uint32_t txPreemptionReq; /*!< Count of the number of tx preemption HOLD requests. */ 800 uint32_t txMPacket; /*!< Count of the number of additional mPackets transmitted due to preemption. */ 801 } netc_port_phy_mac_preemption_statistic_t; 802 803 /*! @brief Ethernet pseudo MAC port traffic (Tx/Rx) statistics counters */ 804 typedef struct _netc_port_pseudo_mac_traffic_statistic 805 { 806 uint64_t totalOctet; /*!< Count of MAC received/transmitted octets. */ 807 uint64_t unicastFrame; /*!< Count of MAC received/transmitted unicast frames. */ 808 uint64_t multicastFrame; /*!< Count of MAC received/transmitted multicast frames. */ 809 uint64_t boradcastFrame; /*!< Count of MAC received/transmitted broadcast frames . */ 810 } netc_port_pseudo_mac_traffic_statistic_t; 811 812 /*! @} */ // end of netc_hw_port_mac 813 #if !(defined(__GNUC__) || defined(__ICCARM__)) 814 #pragma endregion netc_hw_port_mac 815 #endif 816 817 #if !(defined(__GNUC__) || defined(__ICCARM__)) 818 #pragma region netc_hw_table 819 #endif 820 /*! @addtogroup netc_hw_table 821 * @{ 822 */ 823 824 /*! @brief Table index */ 825 typedef enum _netc_tb_index 826 { 827 kNETC_TGSTable = 5U, /*!< Time Gate Scheduling table index */ 828 kNETC_RPTable = 10U, /*!< Rate Policer table index */ 829 kNETC_IPFTable = 13U, /*!< Ingress Port filter table index */ 830 kNETC_FDBTable = 15U, /*!< FDB table index */ 831 kNETC_L2MCFTable = 16U, /*!< L2 IPV4 Multicast Filter table index */ 832 kNETC_VFTable = 18U, /*!< VLAN Filter table index */ 833 kNETC_ECQTable = 22U, /*!< ETM Class Queue table index */ 834 kNETC_ECSTable = 23U, /*!< ETM Class Scheduler table index */ 835 kNETC_ISITable = 30U, /*!< Ingress Stream Identification table index */ 836 kNETC_ISTable = 31U, /*!< Ingress Stream table index */ 837 kNETC_ISFTable = 32U, /*!< Ingress Stream Filter table index */ 838 kNETC_ETTable = 33U, /*!< Egress Treatment table index */ 839 kNETC_ISGTable = 34U, /*!< Ingress Sequence Generation table index */ 840 kNETC_ESRTable = 35U, /*!< Egress Sequence Recovery table index */ 841 kNETC_SGITable = 36U, /*!< Stream Gate Instance table index */ 842 kNETC_SGCLTable = 37U, /*!< Stream Gate Control List table index */ 843 kNETC_ISCTable = 38U, /*!< Ingress Stream Count table index */ 844 kNETC_ECTable = 39U, /*!< Egress Count table index */ 845 kNETC_FMTable = 40U, /*!< Frame Modification table index */ 846 kNETC_BPTable = 41U, /*!< Buffer Pool table index */ 847 kNETC_SBPTable = 42U, /*!< Shared Buffer Pool table index */ 848 kNETC_ECGTable = 43U, /*!< ETM Class Group table index */ 849 kNETC_FMDTable = 44U /*!< Frame Modification Data table index */ 850 } netc_tb_index_t; 851 852 /*! @brief Table management command operations */ 853 typedef enum _netc_tb_cmd 854 { 855 kNETC_DeleteEntry = 0x1U, /*!< Delete operation */ 856 kNETC_UpdateEntry = 0x2U, /*!< Update operation */ 857 kNETC_QueryEntry = 0x4U, /*!< Query operation */ 858 kNETC_QueryAndDeleteEntry = 0x5U, /*!< Query operation followed by a delete operation */ 859 kNETC_QueryAndUpdateEntry = 0x6U, /*!< Query operation followed by a update operation */ 860 kNETC_AddEntry = 0x8U, /*!< Add operation */ 861 kNETC_AddOrUpdateEntry = 0xAU, /*!< If the entry exists, is update operation, if not exist, is the Add operation*/ 862 kNETC_AddAndQueryEntry = 0xCU, /*!< Add operation followed by a query operation */ 863 kNETC_AddQueryAndUpdateEntry = 864 0xEU /*!< Add operation followed by a query operation, Then, if the entry existed 865 prior to the Add operation of this command, the Update operation will be performed. */ 866 } netc_tb_cmd_t; 867 868 /*! @brief Table Access Method */ 869 typedef enum _netc_tb_access_mode 870 { 871 kNETC_EntryIDMatch = 0U, /*!< Entry ID Match */ 872 kNETC_ExactKeyMatch, /*!< Exact Match Key Element Match */ 873 kNETC_Search, /*!< Search with search criteria*/ 874 kNETC_TernaryKeyMatch /*!< Ternary Match Key Element Match */ 875 } netc_tb_access_mode_t; 876 877 /*! @brief NTMP version */ 878 typedef enum _netc_cbd_version 879 { 880 kNETC_NtmpV1_0 = 0U, /*!< NTMP Version 1.0 */ 881 kNETC_NtmpV2_0 /*!< NTMP Version 2.0 */ 882 } netc_cbd_version_t; 883 884 /*! @brief Table command response error status */ 885 typedef enum _netc_cmd_error 886 { 887 /* Version 1.0 NTMP Table error status */ 888 kNETC_FormatError = 0x1U, /*!< Format error : 1. Illegal class or command. 2. Invalid SF bit setting. 3. LENGTH is 889 zero for long format. 4. LENGTH is too small for buffer size. */ 890 kNETC_SizeError = 0x2U, /*!< Size error : 1. Invalid table index, out of range. 2. Table overflow, no additional 891 entries available. */ 892 kNETC_AccessError = 0x4U, /*!< Access violation error, the entity is not allowed to perform the task requested */ 893 kNETC_ClassError = 0x8U, /*!< Class specific error */ 894 kNETC_IntegrityError = 0x10U, /*!< Integrity error, the command did not execute due to a data integrity error (ECC 895 on internal memory or AXI read/write error) */ 896 /* Version 2.0 NTMP Table Generic error status */ 897 kNETC_InvTableID = 0x80U, /*!< Invalid table ID */ 898 kNETC_InvAccMethod = 0x81U, /*!< Invalid Access method */ 899 kNETC_TableIdxOutRange = 0x82U, /*!< Table index out of range */ 900 kNETC_DBNotEnough = 0x83U, /*!< Request data buffer size or response data buffer size is not sufficient */ 901 kNETC_InvCmd = 0x84U, /*!< Invalid command */ 902 kNETC_ReqDBError = 0x85U, /*!< Request Data buffer error */ 903 kNETC_MultiBitError = 0x86U, /*!< Multi-bit ECC or parity error observed during command processing */ 904 kNETC_HashEntryLimit = 0x87U, /*!< Exceeded hash entry limit */ 905 kNETC_HashChainLimit = 0x88U, /*!< Exceeded maximum hash collision chain limit and the CAM if present is full */ 906 kNETC_InvHWGenEntryID = 0x89U, /*!< Invalid ENTRY_ID for ENTRY_ID generated by hardware */ 907 kNETC_SrchResDBNotEnough = 0x8AU, /*!< Search command filled the response data buffer before completing the 908 command */ 909 kNETC_CmdIdxTableWithITM = 0x8BU, /*!< Command for index table before OSR[ITM_STATE]=0 */ 910 kNETC_InvQueryAction = 0x8CU, /*!< Invalid Query action */ 911 kNETC_InvTableAccPrivilege = 0x8DU, /*!< Invalid table access privilege */ 912 kNETC_ReadSysBusErr = 0x8EU, /*!< System Bus Read Error */ 913 kNETC_WriteSysBusErr = 0x8FU, /*!< System Bus Write Error */ 914 kNETC_ClientErr = 0x90U, /*!< Client encountered a fault */ 915 /* Time Gate Scheduling Table error status */ 916 kNETC_TGSCmdIssue = 0xD0U, /*!< Command issued when time gating function is disabled for the port. */ 917 kNETC_TGSUpdateExistList = 0xD1U, /*!< Update action attempted on an existing admin gate control list. (should 918 delete admin gate control list first before creating a new admin list) */ 919 kNETC_TGSUpdateOverLength = 0xD2U, /*!< Update action attempted exceeds TGSTCAPR[MAX_GCL_LEN] */ 920 kNETC_TGSUpdateOverSize = 0xD3U, /*!< Update action attempted exceeds TGSTCAPR[NUM_WORDS]. */ 921 kNETC_TGSEntryNotEnough = 0xD4U, /*!< Insufficient resources to perform the requested operation (not enough free 922 time gate list entries) */ 923 kNETC_TGSUpdateNSList = 0xD5U, /*!< Update action attempted with ADMIN_CYCLE_TIME, ADMIN_TIME_INTERVAL_GE_i or 924 truncated ADMIN_TIME_INTERVAL_GE_n due ADMIN_CYCLE_TIME specified is not sufficient to transmit 64 925 byte of frame data + header overhead. */ 926 kNETC_TGSUpdateEarlierStartTime = 0xD6U, /*!< Update action attempted with ADMIN_BASE_TIME specified s more than one 927 second in the past from tcs advance time. */ 928 kNETC_TGSUpdateOverflowCycle = 0xD7U, /*!< Update action attempted with ADMIN_CYCLE_TIME + ADMIN_CYCLE_TIME_EXT is 929 greater than 2^32-1. */ 930 kNETC_TGSQueryBeforeListActive = 0xD8U, /*!< Query action issued when config change occurred. Retry query.*/ 931 kNETC_TGSUpdateInvGateValue = 0xD9U, /*!< Update action attempted with ADMIN_HR_CB_GE_i set to an invalid value */ 932 /* Rate Policer Table error status */ 933 kNETC_RPSDUTypeOutRange = 0x120U, /*!< SDU_TYPE specified in entry CFGE_DATA is out of range */ 934 /* Ingress Port Filter Table error status */ 935 kNETC_IPFInvHR = 0x150U, /*!< HR value not valid. Only checked if command issued from the Switch 936 and FLTFA=0x2 or FLTFA=0x3 */ 937 kNETC_IPFEntryNotFit = 0x151U, /*!< Entry being added does not fit in table */ 938 kNETC_IPFWithoutSTSE = 0x152U, /*!< CFGE_DATA update without STSE_DATA update */ 939 kNETC_IPFInvRPP = 0x154U, /*!< RPR set to a reserved value. Only checked if FLTA=0x2. */ 940 kNETC_IPFFLTATGTOutRange = 0x155U, /*!< FLTA_TGT is outside valid range and not NULL. Only checked if FLTA>0x0 */ 941 kNETC_IPFInvSwtFLTA = 0x156U, /*!< FLTA=0x3 when command issued from the Switch. */ 942 kNETC_IPFInvEnetcFLTA = 0x157U, /*!< FLTFA>0x1 when command issued from an ENETC PF. */ 943 /* FDB Table error status */ 944 kNETC_FDBReachPortLimit = 0x171U, /*!< Failed to add or update and entry because the Port BPCR[DYN_LIMIT] has 945 been reached */ 946 kNETC_FDBReachSwtLimit = 0x172U, /*!< Failed to add entry because the Switch FDBHTMCR[DYN_LIMIT] has been 947 reached. */ 948 kNETC_FDBInvEPORT = 0x173U, /*!< EPORT value not valid. Only checked if (OETEID=0x1 OR CTD=0x1) */ 949 kNETC_FDBETEIDOutRange = 0x174U, /*!< ET_EID is out of range and not NULL. Only checked if OETEID>0x0 */ 950 kNETC_FDBParityErr = 0x175U, /*!< Parity error encountered when adding guaranteed entry */ 951 /* L2 IPv4 Multicast Filter Table error status */ 952 kNETC_L2MCFInvEPORT = 0x181U, /*!< EPORT value not valid. Only checked if (OETEID=0x1 OR CTD=0x1) */ 953 kNETC_L2MCFETEIDOutRange = 0x182U, /*!< ET_EID is not NULL or within the valid range. Only checked if OETEID>0x0. */ 954 kNETC_L2MCFInvKEYTYPE = 0x183U, /*!< KEY_TYPE value not valid */ 955 /* VLAN Filter Table error status */ 956 kNETC_VFBASEETEIDOutRange = 0x1A0U, /*!< BASE_ET_EID is out of range or MLO is not valid. */ 957 /* ETM Class Queue Table error status */ 958 kNETC_ECQCQ2CGMAPOutRange = 0x1E0U, /*!< CQ2CG_MAP value out-of-range in update command. */ 959 /* Ingress Stream Identification Table error status */ 960 kNETC_ISIPortIDOutRange = 0x260U, /*!< Port ID specified in KEYE_DATA is out of range. */ 961 kNETC_ISIInvISEID = 0x261U, /*!< IS_EID in invalid. */ 962 /* Ingress Stream Table error status */ 963 kNETC_ISInvOpt = 0x270U, /*!< Option specified in one or more of the following fields is not valid – FA, CTD or 964 ISQA, SDU_TYPE. */ 965 kNETC_ISInvID = 0x271U, /*!< One or more of following : 1. Entry IDs are not in valid range or Entry ID is not 966 Null. 2. Check valid ranges specified for these Entry IDs in Ingress Stream table entry – 967 RP_EID, SGI_EID, ISQ_EID, ET_EID or EPORT. 3. ET_EID is checked if (FA =010b .. 101b) & 968 (OETEID!=0). 4. EPORT is checked if (FA = 010b .. 101b) & (OETEID= 0x1 OR CTD= 0x1). 5. 969 HR is chked if FA = 001b, 100b, or 101b. HR specified cannot be 0x0*/ 970 kNETC_ISInvFMEID = 0x272U, /*!< FM_EID format or index is out of range : 1. FM_EID format option type is invalid. 2. 971 FM_EID format is option 1 and the Index is out of range and not Null, or FM_EID format 972 is option 2 and VUDA or SQTA is out of range.*/ 973 /* Ingress Stream Filter Table error status */ 974 kNETC_ISFInvISEID = 0x280U, /*!< IS_EID in KEYE_DATA is invalid. */ 975 kNETC_ISFInvCFGE = 0x281U, /*!< Any of the following in CFGE_DATA is invalid : 1. One or more of following Entry IDs 976 are not in valid range or Entry ID specified is not Null. Checks are performed for 977 following Entry IDs CFGE DATA – RP_EID, SGI_EID, ISC_EID. 2. SDU_TYPE is invalid */ 978 /* Egress Treatment Table error status */ 979 kNETC_ETInvOpt = 0x290U, /*!< Command option specified is invalid or not supported. ESQA is not 00 or 10 (others are 980 reserved), or ECA > 1 (reserved). */ 981 kNETC_ETInvFMEID = 0x291U, /*!< FM_EID format or index is out of range. Check performed is as follows : 1. EFM_EID 982 format option type is invalid, or EFM_EID format is option 1 and the Index is out of 983 range and not Null, or EFM_EID format is option 2 and VUDA or SQTA is out of range 984 . 2. the Egress Counter Table index EC_EID is out of range. 3. The Egress Sequence 985 Actions Target Entry ID ESQA_TGT_EID is out of range*/ 986 /* Ingress Sequence Generation Table error status */ 987 kNETC_ISGInvQSTAG = 0x2A0U, /*!< SQ_TAG specified is not valid */ 988 /* Stream Gate Instance Table error status */ 989 kNETC_SGISGCLEIDOutRange = 0x2C0U, /*!< SGCL_EID specified in out of range for Add or Update operation. */ 990 kNETC_SGIInvSDUTYPE = 0x2C1U, /*!< SDU_TYPE is specified is invalid for Add or Update operation. */ 991 kNETC_SGISGCLEIDNotAlloc = 0x2C2U, /*!< Either the SGCL_EID specified as admin gate control list in Add or Update 992 operation has not been allocated or SGCL_EID is not the first entry in gate control 993 list or the reference count in SGCL entry is not 0. */ 994 kNETC_SGIInvSGCLEID = 0x2C3U, /*!< SGCL_EID specified for Update operation is in invalid. */ 995 kNETC_SGIInvADMINBASETIME = 0x2C4U, /*!< ADMIN_BASE_TIME specified for Add or Update operation is more than 2^30ns 996 in the past. */ 997 kNETC_SGIInvCYCLETIME = 0x2C5U, /*!< Cumulated time value of CYCLE_TIME in Stream gate Control list plus 998 CYCLE_TIME_EXT specified in Add or Update operation is >=2^30ns or 999 CYCLE_TIME specified is 0. */ 1000 /* Stream Gate Control List Table error status */ 1001 kNETC_SGCLOverLength = 0x2D0U, /*!< Number words required for the LIST_LENGTH specified for the Add operation 1002 exceeds the number of words allocated for SGCL table */ 1003 kNETC_SGCLTimeIntervalZero = 0x2D1U, /*!< TIME_INTERVAL_GE_N specified in Add operation is 0. Note that upper 1004 2 bits of TIME_INTERVAL_GE_N are ignored, TIME_INTERVAL_GE_N[29:0] must not be 0. */ 1005 kNETC_SGCLTimeIntervalOverflow = 0x2D2U, /*!< Cumulated time value of TIME_INTERVAL_GE_N[29:0] for the gate list 1006 specified in Add operation is >= 2^30ns. */ 1007 /* Frame Modification Table error status */ 1008 kNETC_FMInvEMEID = 0x300U, /*!< FM_EID format is invalid */ 1009 kNETC_FMOptOutRange = 0x301U, /*!< Following fields specified are out of range - MAC_HDR_ACT, VLAN_HDR_ACT, SQT_ACT, 1010 OUTER_PCP_DEI_ACT, PLD_ACT. */ 1011 kNETC_FMFMDOutRange = 0x302U, /*!< FMD_EID,FMD_BYTES specified is out of range. When FMD_EID is not set to Null, 1012 valid range is FMD_EID[15:0]*24 + FMD_BYTES <= (FMDITCAPR[NUM_WORDS]*24).*/ 1013 /* Buffer Pool Table error status */ 1014 kNETC_BPSBPEIDOutRange = 0x310U, /*!< SBP_EN is 1 and SBP_EID value is out-of-range in update command */ 1015 } netc_cmd_error_t; 1016 1017 /*! @brief The Switch/SI command BD data structure */ 1018 typedef union _netc_cmd_bd 1019 { 1020 struct 1021 { 1022 uint64_t addr; /*!< The request and response data buffers address */ 1023 struct 1024 { 1025 uint32_t resLength : 20; /*!< The length of the Response Data Buffer */ 1026 uint32_t reqLength : 12; /*!< The length of the Request Data Buffer */ 1027 }; 1028 struct 1029 { 1030 netc_tb_cmd_t cmd : 4; /*!< Access table entry command, see @ref netc_tb_cmd_t . */ 1031 uint32_t : 8; 1032 netc_tb_access_mode_t accessType : 2; /*!< Access table entry method, see @ref netc_tb_access_mode_t. */ 1033 uint32_t : 2; /*!< RSS Hash high field value. */ 1034 netc_tb_index_t tableId : 8; 1035 uint32_t version : 6; /*!< Protocol Version. */ 1036 uint32_t enCompInt : 1; /*!< Command Completion Interrupt. */ 1037 uint32_t resReady : 1; /*!< Response Ready. */ 1038 }; 1039 uint32_t reserved[3]; 1040 struct 1041 { 1042 uint32_t : 15; 1043 uint32_t npf : 1; /*!< NTMP Protocol Format. */ 1044 uint32_t : 16; 1045 }; 1046 } req; 1047 struct 1048 { 1049 uint32_t reserved1[3]; 1050 struct 1051 { 1052 uint32_t numMatched : 16; /*!< Number of Entries Matched. */ 1053 uint32_t error : 12; /*!< Error status. */ 1054 uint32_t : 3; 1055 uint32_t resReady : 1; /*!< Response Ready. */ 1056 }; 1057 uint32_t reserved2[4]; 1058 } resp; 1059 struct 1060 { 1061 uint64_t addr; /*!< Data. */ 1062 uint32_t : 31; 1063 uint32_t en : 1; /*!< Enable entry. */ 1064 uint32_t reserved[2]; 1065 uint32_t siBitMap : 16; /*!< Station interfaces 15-0 for which this filter applies. */ 1066 uint32_t : 16; 1067 uint32_t index : 16; /*!< The index refers to an entry location within a table. */ 1068 uint32_t length : 16; /*!< NA */ 1069 uint32_t cmd : 8; /*!< Command. */ 1070 uint32_t class : 8; /*!< Class of command. */ 1071 uint32_t : 8; 1072 uint32_t status : 6; /*!< Status. */ 1073 uint32_t ci : 1; /*!< Completion interrupt. */ 1074 uint32_t sf : 1; /*!< Short format. */ 1075 } generic; 1076 } netc_cmd_bd_t; 1077 1078 /*! @brief Configuration for the Switch/SI command BD Ring Configuration */ 1079 typedef struct _netc_cmd_bdr_config 1080 { 1081 netc_cmd_bd_t *bdBase; /*!< BDR base address which shall be 128 bytes aligned */ 1082 uint16_t bdLength; /*!< Size of BD ring which shall be multiple of 8 BD */ 1083 bool enCompInt; /*!< Enable/Disable command BD completion interrupt */ 1084 } netc_cmd_bdr_config_t; 1085 1086 /*! @brief The Switch/SI command BD ring handle data structure */ 1087 typedef struct _netc_cmd_bdr 1088 { 1089 netc_cmd_bd_t *bdBase; /*!< BDR base address which shall be 128 bytes aligned */ 1090 uint16_t bdLength; /*!< Size of BD ring */ 1091 uint16_t producerIndex; /*!< Current index for execution. */ 1092 uint16_t cleanIndex; /*!< Current index for cleaning. */ 1093 bool bdrEnable; /*!< Current command BD ring is enable or not. */ 1094 } netc_cmd_bdr_t; 1095 1096 /*! @brief Table request data buffer common header */ 1097 typedef struct _netc_tb_common_header 1098 { 1099 uint32_t updateActions : 16; /*!< Update Actions */ 1100 uint32_t : 8; 1101 uint32_t queryActions : 4; /*!< Query Actions */ 1102 uint32_t : 4; 1103 } netc_tb_common_header_t; 1104 1105 /*! 1106 * @brief Frame Modification VLAN Update/Delete Action 1107 * @note Misconfiguration error if replace or delete action is specified and if VLAN tag is not present in frame. 1108 */ 1109 typedef enum _netc_fm_vlan_ud_act 1110 { 1111 kNETC_NoUDVlanAction = 0U, /*!< No Update/Delete VLAN action */ 1112 kNETC_ReplVlanPcpAndDei, /*!< Replace outer VLAN's PCP/DEI based on the port's PPCPDEIMR. The tag's original VID and 1113 TPID are preserved */ 1114 kNETC_DelVlan /*!< Delete outer VLAN Tag */ 1115 1116 } netc_fm_vlan_ud_act_t; 1117 1118 /*! 1119 * @brief Frame Modification Sequence Tag Action 1120 * @note Must be set to 000b for Ingress frame modification, otherwise misconfiguration error.. 1121 */ 1122 typedef enum _netc_fm_sqt_act 1123 { 1124 kNETC_NoSqtAction = 0U, /*!< No SQT action */ 1125 kNETC_ReomveRTag /*!< Remove R-TAG/draft 2.0 R-TAG/HSR tag, If R-TAG/HSR tag not present, misconfiguration error. */ 1126 } netc_fm_sqt_act_t; 1127 1128 /*! 1129 * @brief Frame Modification VLAN Add/Replace Action 1130 * @note For ingress frame modificaion with 00b or 01b, use the ingress port to select PCP and DEI from the Bridge port 1131 * default VLAN register (BPDVR). For egress frame modification with 00b or 01b, use the internal QoS associated 1132 * with the frame (IPV, DR) to access the QoS to PCP mapping profile (PQOSMR[QVMP] , QOSVLANMPaR0/1/2/3) to set 1133 * the new PCP value. Use internal DR associated with frame to access the DR to DEI mapping profile 1134 * (PPCPDEIMR[DRnDEI]) to set the new DEI value. 1135 */ 1136 typedef enum _netc_fm_vlan_ar_act 1137 { 1138 kNETC_AddCVlanPcpAndDei = 0U, /*!< Add outer VLAN with VID and PCP/DEI updated as described above. TPID=0x8100 */ 1139 kNETC_AddSVlanPcpAndDei, /*!< Add outer VLAN with VID and PCP/DEI updated as described above. TPID=0x88A8 */ 1140 kNETC_ReplVidOnly, /*!< Replace VLAN with VID. The tag's original PCP, DEI and TPID are preserved */ 1141 kNETC_ReplVidPcpAndDei /*!< Replace VLAN with VID and PCP/DEI updated by port's PPCPDEIMR. The tag's original 1142 TPID is preserved */ 1143 1144 } netc_fm_vlan_ar_act_t; 1145 1146 /*! 1147 * @brief Frame Modification Entry ID encode options 1148 * @note sqta should be netc_fm_sqt_act_t type, vuda should be netc_fm_vlan_ud_act_t type and vara should be 1149 * netc_fm_vlan_ar_act_t type. 1150 */ 1151 #define NETC_FD_EID_ENCODE_OPTION_0(entryId) ((uint32_t)(entryId)&0xFFFU) 1152 #define NETC_FD_EID_ENCODE_OPTION_1(sqta, vuda) ((((uint32_t)(sqta)&0x7U) << 2U) | ((uint32_t)(vuda)&0x3U) | 0x2000U) 1153 #define NETC_FD_EID_ENCODE_OPTION_2(vara, vid) ((((uint32_t)(vara)&0x3U) << 12U) | ((uint32_t)(vid)&0xFFFU) | 0x4000U) 1154 1155 /*! 1156 * @brief Define FDB/L2MCF/IS table entry access the primary Egress Treatment table entry group mode 1157 * @note The FDB/L2 IPv4 Multicast filter table has precedence over any assignment made via the Ingress Stream table. 1158 * For Mulit port mode, the index to access the Egress Treatment table is computed by adding an offset to the 1159 * base index of the Egress Treatment group. That offset is derived from the applicability bitmap as follows: 1160 * starting from the lowest significant bit of the bitmap, the first encountered bit set to 1, corresponds to 1161 * offset 0, and so on. This continues till the destination port location in the bitmap is reached 1162 */ 1163 typedef enum _netc_tb_eteid_access_mode 1164 { 1165 kNETC_NoETAccess = 0x0U, /*!< No Egress Treatment table access */ 1166 kNETC_SinglePortETAccess, /*!< Only frame sent to a special port (define in ePort) can access a single Egress 1167 Treatment table entry, the applicability bitmap specified by FDB/L2MCF/IS ePort field 1168 */ 1169 kNETC_MulitPortPackedETAccess, /*!< Only frames sent to a special set of ports (ports set to 1 in ePortBitmap) can 1170 access the Egress Treatment table, the applicability bitmap = IS ePortBitmap field 1171 or FDB/L2MCF portBitmap field */ 1172 kNETC_MulitPortAbsETAccess /*!< Frames sent to all of ports can access the Egress Treatment table, means the 1173 applicability bitmap is set with 1 for all ports */ 1174 } netc_tb_eteid_access_mode_t; 1175 1176 #if !(defined(__GNUC__) || defined(__ICCARM__)) 1177 #pragma region Ingress Port Filter Table 1178 #endif 1179 1180 /*! @brief Ingress Port Filter Table Update Actions */ 1181 typedef enum _netc_tb_ipf_update_action 1182 { 1183 kNETC_IPFCfgEUpdate = 0x1U, /*!< Configuration Element Update */ 1184 kNETC_IPFStsEUpdate = 0x2U /*!< Statistics Element Update */ 1185 } netc_tb_ipf_update_action_t; 1186 1187 /*! @brief Ingress Port Filter frame attribute mask */ 1188 typedef enum _netc_tb_ipf_attr_mask 1189 { 1190 kNETC_IPFSwtPortMasMask = 0x1U, /*!< Switch port masquerading Mask */ 1191 kNETC_IPFEthernetMask = 0x2U, /*!< Ethernet type Mask */ 1192 kNETC_IPFOuterVlanMask = 0x4U, /*!< Outer VLAN Mask */ 1193 kNETC_IPFInnerVlanMask = 0x8U, /*!< Inner VLAN Mask */ 1194 kNETC_IPFSeqTagMask = 0x70U, /*!< Sequence Tag Code Mask */ 1195 kNETC_IPFIpHeaderMask = 0x80U, /*!< IP Header Mask */ 1196 kNETC_IPFIpVersionMask = 0x100U, /*!< IP Version Mask */ 1197 kNETC_IPFIpExtMask = 0x200U, /*!< IPv4 option / IPv6 extension Mask */ 1198 kNETC_IPFL4HeaderMask = 0x400U, /*!< L4 Code Mask */ 1199 kNETC_IPFWakeOnLanMask = 0x800U /*!< Wake-on-LAN Magic Packet Mask */ 1200 } netc_tb_ipf_attr_mask_t; 1201 1202 /*! @brief Ingress Port Filter frame attribute Sequence Tag Code */ 1203 typedef enum _netc_tb_ipf_seq_tag 1204 { 1205 kNETC_IPFNoRtag = 0x0U, /*!< R-TAG/HSR tag is not present */ 1206 kNETC_IPFDraftRtag, /*!< 802.1CB draft 2.0 R-TAG is present */ 1207 kNETC_IPFRtag, /*!< 802.1CB R-TAG is present */ 1208 kNETC_IPFHsrTag /*!< HSR Tag is present */ 1209 } netc_tb_ipf_seq_tag_t; 1210 1211 /*! @brief Ingress Port Filter frame attribute L4 Header Code */ 1212 typedef enum _netc_tb_ipf_l4_header 1213 { 1214 kNETC_IPFOtherL4 = 1215 0x0U, /*!< The L4 Header is considered as other L4 if it is not one of the following L4 Headers */ 1216 kNETC_IPFTcp, /*!< TCP header is present */ 1217 kNETC_IPFUdp, /*!< UDP header is present */ 1218 kNETC_IPFSctp /*!< SCTP header is present */ 1219 } netc_tb_ipf_l4_header_t; 1220 1221 /*! @brief Ingress Port Filter key element */ 1222 typedef struct _netc_tb_ipf_keye 1223 { 1224 uint16_t precedence; /*!< Precedence value of an entry*/ 1225 uint8_t res0[6]; 1226 struct 1227 { 1228 uint16_t swtPortMas : 1; /*!< Switch port masquerading, applicable only if the incoming port is designated 1229 as a switch management port */ 1230 uint16_t ethernet : 1; /*!< Ethernet type Present */ 1231 uint16_t outerVlan : 1; /*!< Outer VLAN Present */ 1232 uint16_t innerVlan : 1; /*!< Inner VLAN Present */ 1233 netc_tb_ipf_seq_tag_t seqTag : 3; /*!< Sequence Tag Code */ 1234 uint16_t ipHeader : 1; /*!< IP Header Present */ 1235 uint16_t ipVersion : 1; /*!< 0b = IPv4, 1b = IPv6 */ 1236 uint16_t ipExt : 1; /*!< IPv4 option / IPv6 extension present */ 1237 netc_tb_ipf_l4_header_t l4Header : 2; /*!< L4 Header code */ 1238 uint16_t wakeOnLan : 1; /*!< Wake-on-LAN Magic Packet Present */ 1239 uint16_t : 3; 1240 } frameAttr; /*!< Frame Attribute flags */ 1241 uint16_t frameAttrMask; /*!< Frame attribute mask, set with OR of @ref netc_tb_ipf_attr_mask_t */ 1242 uint16_t dscp : 6; /*!< Differentiated Services Code Point */ 1243 uint16_t dscpMask : 6; /*!< Differentiated Services Code Point Mask */ 1244 uint16_t res1 : 4; 1245 uint16_t srcPort : 5; /*!< Source Port ID */ 1246 uint16_t srcPortMask : 5; /*!< Source Port ID Mask */ 1247 uint16_t res2 : 6; 1248 uint16_t outerVlanTCI; /*!< Outer VLAN Tag Control Information */ 1249 uint16_t outerVlanTCIMask; /*!< Outer VLAN Tag Control Information Mask */ 1250 uint8_t dmac[6]; /*!< Destination MAC Address */ 1251 uint8_t dmacMask[6]; /*!< Destination MAC Address Mask */ 1252 uint8_t smac[6]; /*!< Source MAC Address */ 1253 uint8_t smacMask[6]; /*!< Source MAC Address Mask */ 1254 uint16_t innerVlanTCI; /*!< Inner VLAN Tag Control Information */ 1255 uint16_t innerVlanTCIMask; /*!< Inner VLAN Tag Control Information Mask */ 1256 uint16_t etherType; /*!< 2-byte EtherType */ 1257 uint16_t etherTypeMask; /*!< EtherType Mask */ 1258 uint8_t IPProtocol; /*!< IP Protocol */ 1259 uint8_t IPProtocolMask; /*!< IP Protocol Mask */ 1260 uint8_t res3[14]; 1261 uint8_t srcIPAddr[16]; /*!< IP Source Address, Bits 127-0: IPv6 source address, Bits 127-96: IPv4 source address */ 1262 uint8_t res4[8]; 1263 uint8_t srcIPAddrMask[16]; /*!< IP Source Address Mask */ 1264 uint16_t l4SrcPort; /*!< L4 Source Port */ 1265 uint16_t l4SrcPortMask; /*!< L4 Source Port Mask */ 1266 uint8_t res5[4]; 1267 uint8_t destIPAddr[16]; /*!< IP Destination Address, Bits 127-0: IPv6 source address, Bits 127-96: IPv4 source 1268 address */ 1269 uint8_t res6[8]; 1270 uint8_t destIPAddrMask[16]; /*!< IP Destination Address Mask*/ 1271 uint16_t l4DestPort; /*!< L4 Destination Port */ 1272 uint16_t l4DestPortMask; /*!< L4 Destination Port Mask */ 1273 uint8_t res7[4]; 1274 struct 1275 { 1276 uint8_t data; /*!< Payload Byte n */ 1277 uint8_t mask; /*!< Payload Byte n Mask */ 1278 } payload[24]; 1279 } netc_tb_ipf_keye_t; 1280 1281 /*! @brief Ingress port filter forwarding Action */ 1282 typedef enum _netc_tb_ipf_forward_action 1283 { 1284 kNETC_IPFForwardDiscard = 0U, /*!< Frame be discard */ 1285 kNETC_IPFForwardPermit, /*!< Frame be permit */ 1286 kNETC_IPFRedirectToMgmtPort, /*!< Redirect frame to switch management port without any frame modification, Switch 1287 only */ 1288 kNETC_IPFCopyToMgmtPort /*!< Copy frame to switch management port without any frame modification, Switch only */ 1289 } netc_tb_ipf_forward_action_t; 1290 1291 /*! @brief Ingress port filter Filter Action */ 1292 typedef enum _netc_tb_ipf_filter_action 1293 { 1294 kNETC_IPFNoAction = 0U, /*!< No action */ 1295 kNETC_IPFWithRatePolicer, /*!< Rate action with the Rate Policer Entry ID (RP_EID) set to the value configured in 1296 the fltaTgt field */ 1297 kNETC_IPFWithIngressStream, /*!< Ingress stream identification action where the Ingress Stream Entry ID (IS_EID) is 1298 set to the value configured in the fltaTgt field */ 1299 kNETC_IPFWithL2Filtering /*!< Setting a pre L2 filtering SI bitmap (set to the value configured in the fltaTgt) 1300 that will be used by the L2 filtering function to determine the final SI bitmap, ENETC 1301 only */ 1302 } netc_tb_ipf_filter_action_t; 1303 1304 /*! @brief Ingress port filter config element */ 1305 typedef struct _netc_tb_ipf_cfge 1306 { 1307 uint32_t ipv : 4; /*!< Internal Priority Value */ 1308 uint32_t oipv : 1; /*!< Overwrite IPV */ 1309 uint32_t dr : 2; /*!< Drop Resilience */ 1310 uint32_t odr : 1; /*!< Overwrite DR */ 1311 netc_tb_ipf_forward_action_t fltfa : 2; /*!< Filter Forwarding action. */ 1312 uint32_t : 1; 1313 uint32_t imire : 1; /*!< Ingress Mirroring Enable */ 1314 uint32_t wolte : 1; /*!< Wake-onLAN trigger enable */ 1315 netc_tb_ipf_filter_action_t flta : 2; /*!< FIlter Action. */ 1316 uint32_t rpr : 2; /*!< Relative Precedent Resolution */ 1317 uint32_t ctd : 1; /*!< Cut through disable. */ 1318 netc_host_reason_t hr : 4; /*!< Host Reason metadata when frame is redirected/copied to 1319 the switch management port */ 1320 uint32_t timecape : 1; /*!< Timestam capture enable */ 1321 uint32_t : 9; 1322 uint32_t fltaTgt; /*!< Target for selected switch forwarding action or filter action*/ 1323 } netc_tb_ipf_cfge_t; 1324 1325 /*! @brief Ingress port filter statistic element */ 1326 typedef struct _netc_tb_ipf_stse 1327 { 1328 uint32_t matchCount[2]; /*!< A count of how many times this entry has been matched. */ 1329 } netc_tb_ipf_stse_t; 1330 1331 /*! @brief Ingress port filter table entry config */ 1332 typedef struct _netc_tb_ipf_req_data 1333 { 1334 netc_tb_common_header_t commonHeader; 1335 union 1336 { 1337 netc_tb_ipf_keye_t keye; 1338 uint32_t entryID; 1339 uint32_t sCriteria; 1340 }; 1341 netc_tb_ipf_cfge_t cfge; 1342 } netc_tb_ipf_req_data_t; 1343 1344 /*! @brief Ingress port filter table response data */ 1345 typedef struct _netc_tb_ipf_rsp_data 1346 { 1347 uint32_t status; 1348 uint32_t entryID; /*!< Present only for commands which perform a query */ 1349 netc_tb_ipf_keye_t keye; /*!< Present only for commands which perform a query */ 1350 netc_tb_ipf_stse_t stse; /*!< Present only for commands which perform a query */ 1351 netc_tb_ipf_cfge_t cfge; /*!< Present only for commands which perform a query */ 1352 } netc_tb_ipf_rsp_data_t; 1353 1354 /*! @brief Ingress Port filter table data buffer */ 1355 typedef struct _netc_tb_ipf_data 1356 { 1357 union 1358 { 1359 netc_tb_ipf_req_data_t request; 1360 netc_tb_ipf_rsp_data_t response; 1361 }; 1362 } netc_tb_ipf_data_t; 1363 1364 /*! @brief Ingress Port filter entry config */ 1365 typedef struct _netc_tb_ipf_config 1366 { 1367 netc_tb_ipf_keye_t keye; 1368 netc_tb_ipf_cfge_t cfge; 1369 } netc_tb_ipf_config_t; 1370 1371 #if !(defined(__GNUC__) || defined(__ICCARM__)) 1372 #pragma endregion Ingress Port Filter Table 1373 #endif 1374 1375 #if !(defined(__GNUC__) || defined(__ICCARM__)) 1376 #pragma region Ingress Stream Identification Table 1377 #endif 1378 1379 /*! @brief 2 Bytes VLAN field which may added to the frame Key */ 1380 #define NETC_ISI_VLAN_FRAME_KEY(valid, pcp, vid) \ 1381 (((uint16_t)((valid)&0x1) << 15U) | ((uint16_t)((pcp)&0x3) << 12U) | ((uint16_t)(vid)&0xFFFU)) 1382 1383 /*! @brief Stream identification table key type */ 1384 typedef enum _netc_tb_isi_key_type 1385 { 1386 kNETC_KCRule0 = 0U, /*!< Use key construction rule 0 (ISIDKC0CR0) */ 1387 kNETC_KCRule1, /*!< Use key construction rule 1 (ISIDKC1CR0) */ 1388 kNETC_KCRule2, /*!< Use key construction rule 2 (ISIDKC2CR0). Only for SWITCH */ 1389 kNETC_KCRule3 /*!< Use key construction rule 3 (ISIDKC3CR0). Only for SWITCH */ 1390 } netc_tb_isi_key_type; 1391 1392 /*! @brief Stream identification table key element */ 1393 typedef struct _netc_tb_isi_keye 1394 { 1395 netc_tb_isi_key_type keyType : 2; /*!< Define the key type used for the current isi entry */ 1396 uint8_t srcPortID : 5; /*!< Source Port ID, used when kc portp filed is 1. Only for SWITCH */ 1397 uint8_t spm : 1; /*!< Source Port Masquerading, used when kc spm filed is 1. Only for SWITCH */ 1398 uint8_t res0[3]; 1399 uint8_t framekey[16]; /*!< Frame portion of the key. */ 1400 } netc_tb_isi_keye_t; 1401 1402 /*! @brief Stream identification table config element */ 1403 typedef struct _netc_tb_isi_cfge 1404 { 1405 uint32_t iSEID; /*!< Ingress stream entry ID, 0xFFFFFFFF means NULL */ 1406 } netc_tb_isi_cfge_t; 1407 1408 /*! @brief Stream identification table request data buffer */ 1409 typedef struct _netc_tb_isi_req_data 1410 { 1411 netc_tb_common_header_t commonHeader; 1412 union 1413 { 1414 uint32_t entryID; 1415 uint32_t sCriteria; 1416 netc_tb_isi_keye_t keye; 1417 }; 1418 netc_tb_isi_cfge_t cfge; 1419 } netc_tb_isi_req_data_t; 1420 1421 /*! @brief Stream identification table request response data buffer */ 1422 typedef struct _netc_tb_isi_rsp_data 1423 { 1424 uint32_t status; 1425 uint32_t entryID; /*!< Only present for query command */ 1426 netc_tb_isi_keye_t keye; /*!< Only present for query command */ 1427 netc_tb_isi_cfge_t cfge; /*!< Only present for query command */ 1428 } netc_tb_isi_rsp_data_t; 1429 1430 /*! @brief Stream identification table data buffer */ 1431 typedef struct _netc_tb_isi_data 1432 { 1433 union 1434 { 1435 netc_tb_isi_req_data_t request; 1436 netc_tb_isi_rsp_data_t response; 1437 }; 1438 } netc_tb_isi_data_t; 1439 1440 /*! @brief Stream identification table entry config */ 1441 typedef struct _netc_tb_isi_config 1442 { 1443 netc_tb_isi_keye_t keye; 1444 netc_tb_isi_cfge_t cfge; 1445 } netc_tb_isi_config_t; 1446 1447 #if !(defined(__GNUC__) || defined(__ICCARM__)) 1448 #pragma endregion Ingress Stream Identification Table 1449 #endif 1450 1451 #if !(defined(__GNUC__) || defined(__ICCARM__)) 1452 #pragma region Ingress Stream Table 1453 #endif 1454 1455 /*! @brief Ingress Stream table Ingress Sequence Action */ 1456 typedef enum _netc_tb_is_isq_action 1457 { 1458 kNETC_ISNotPerformFRER = 0, /*!< Not perform Frame FRER sequence generation function */ 1459 kNETC_ISPerformFRER /*!< Perform Frame FRER sequence generation function */ 1460 } netc_tb_is_isq_action_t; 1461 1462 /*! @brief Ingress Stream table forwarding Action */ 1463 typedef enum _netc_tb_is_forward_action 1464 { 1465 kNETC_ISDiscard = 0U, /*!< Frame be discard */ 1466 kNETC_ISRedirectToMgmtPort = 1U, /*!< Frame be Re-direct frame to switch management port, Switch only */ 1467 kNETC_ISAllow = 1U, /*!< Frame is allow without setting the pre L2 filtering SI bitmap, ENETC only */ 1468 kNETC_ISAllowWithSIMap = 2U, /*!< Frame is allow with setting the pre L2 filtering SI bitmap to the value configured 1469 in the SI_MAP field, ENETC only */ 1470 kNETC_ISStreamForward = 2U, /*!< Frame is forwarded to the port(s) specified in the EGRESS_PORT_BITMAP field, 1471 Switch only */ 1472 kNETC_ISBridgeForward, /*!< Frame is do 802.1Q Bridge forwarding (VLAN processing and L2 forwarding), Switch only */ 1473 kNETC_ISCopyToMgmtPortAndStream, /*!< Copy frame to switch management port with specified HR and stream forwarding, 1474 Switch only */ 1475 kNETC_ISCopyToMgmtPortAndBridge /*!< Copy frame to switch management port with specified HR and Bridge forwarding, 1476 Switch only */ 1477 } netc_tb_is_forward_action_t; 1478 1479 /*! @brief Ingress Stream table Cut-Through Disable mode */ 1480 typedef enum _netc_tb_is_ctd_mode 1481 { 1482 kNETC_ISNoCTD = 0x0U, /*!< Do not override cut-through state */ 1483 kNETC_ISSinglePortCTD, /*!< Disable cut-through for the outgoing port specified in the cfge ePort field */ 1484 kNETC_ISAllPortCTD /*!< Disable cut-through for all ports specified in cfge portBitmap field */ 1485 } netc_tb_is_ctd_mode_t; 1486 1487 /*! @brief Ingress Stream table Override ET_EID mode */ 1488 typedef netc_tb_eteid_access_mode_t netc_tb_is_oeteid_mode_t; 1489 1490 /*! @brief Ingress Stream table config element */ 1491 typedef struct _netc_tb_is_cfge 1492 { 1493 uint32_t sfe : 1; /*!< Stream Filtering Enable */ 1494 uint32_t : 3; 1495 uint32_t ipv : 4; /*!< Internal Priority Value, active when opiv is set to 1 */ 1496 uint32_t oipv : 1; /*!< Override internal priority value */ 1497 uint32_t dr : 2; /*!< Drop Resilience, active when odr is set to 1 */ 1498 uint32_t odr : 1; /*!< Overwrite DR */ 1499 uint32_t imire : 1; /*!< Ingress Mirroring Enable, not applicable to ENETC */ 1500 uint32_t timecape : 1; /*!< Timestamp Capture Enable, not applicable to ENETC */ 1501 uint32_t : 1; 1502 uint32_t sppd : 1; /*!< Source Port Pruning Disable, not applicable to ENETC */ 1503 netc_tb_is_isq_action_t isqa : 2; /*!< Ingress Sequence Action, not applicable to ENETC */ 1504 uint32_t orp : 1; /*!< Override Rate Policer ID */ 1505 uint32_t osgi : 1; /*!< Override stream gate instance entry id (default is NULL) */ 1506 netc_host_reason_t hr : 4; /*!< Host Reason when frame is redirected (fa = 01b) to the switch management port or 1507 copied to the switch management port (fa = 100b or 101b), value specified has to be a software 1508 defined Host Reason (8-15). */ 1509 netc_tb_is_forward_action_t fa : 3; /*!< Forwad Option */ 1510 netc_tc_sdu_type_t sduType : 2; /*!< Service Data Unit Type to user for MSDU */ 1511 uint32_t : 3; 1512 uint32_t msdu : 16; /*!< Maximum Service Data Unit */ 1513 uint32_t ifmeLenChange : 7; /*!< Ingress Frame Modification Entry Frame Length Change, specified in unit of bytes 1514 using a 2's complement notation */ 1515 uint32_t eport : 5; /*!< Egress Port which need do egress packet processing, active when oeteid is set to 1, not 1516 applicable to ENETC */ 1517 netc_tb_is_oeteid_mode_t oETEID : 2; /*!< Override ET_EID (Egress Treatment table entry, which specified egress 1518 packet processing actions) */ 1519 netc_tb_is_ctd_mode_t ctd : 2; /*!< Cut-Through Disable mode, valid if fa = 010b ~ 101b */ 1520 uint32_t isqEID; /*!< Ingress Sequence Generation Entry ID, Valid when isqa is set to 1. 0xFFFF_FFFF is NULL. Not 1521 applicable to ENETC */ 1522 uint32_t rpEID; /*!< Rate Policer Entry ID, Valid when orp =1. 0xFFFF_FFFF is NULL */ 1523 uint32_t sgiEID; /*!< Stream Gate Instance Entry ID, Valid when osgi =1. 0xFFFF_FFFF is NULL */ 1524 uint32_t ifmEID; /*!< Ingress Frame Modification Entry ID. 0xFFFF_FFFF is NULL */ 1525 uint32_t etEID; /*!< Base Egress Treatment Entry ID for primary Egress Treatment group, Valid alid if fa = 010b ~ 1526 101b. 0xFFFF_FFFF is NULL. Not applicable to ENETC */ 1527 uint32_t iscEID; /*!< Ingress Stream counter Index. 0xFFFF_FFFF is NULL. */ 1528 uint32_t ePortBitmap; /*!< Egress Port bitmap, identifies the ports to which the frame is to be forwarding or 1529 ET applicability port bitmap when oETEID = 10b. Not applicable to ENETC */ 1530 uint32_t : 8; 1531 uint32_t siMap : 16; /*!< Station Interface Map, only valid for ENETC function when fa field is set to 10b */ 1532 uint32_t : 16; 1533 } netc_tb_is_cfge_t; 1534 1535 /*! @brief Ingress Stream table request data buffer */ 1536 typedef struct _netc_tb_is_req_data 1537 { 1538 netc_tb_common_header_t commonHeader; 1539 uint32_t entryID; 1540 netc_tb_is_cfge_t cfge; /*!< Only perform for update or add command */ 1541 } netc_tb_is_req_data_t; 1542 1543 /*! @brief Ingress Stream table request response data buffer */ 1544 typedef struct _netc_tb_is_rsp_data 1545 { 1546 uint32_t entryID; /*!< Only perform for query command */ 1547 netc_tb_is_cfge_t cfge; /*!< Only perform for query command */ 1548 } netc_tb_is_rsp_data_t; 1549 1550 /*! @brief Ingress Stream table data buffer */ 1551 typedef struct _netc_tb_is_data 1552 { 1553 union 1554 { 1555 netc_tb_is_req_data_t request; 1556 netc_tb_is_rsp_data_t response; 1557 }; 1558 } netc_tb_is_data_t; 1559 1560 /*! @brief Ingress Stream table entry config */ 1561 typedef struct _netc_tb_is_config 1562 { 1563 uint32_t entryID; 1564 netc_tb_is_cfge_t cfge; 1565 } netc_tb_is_config_t; 1566 1567 #if !(defined(__GNUC__) || defined(__ICCARM__)) 1568 #pragma endregion Ingress Stream Table 1569 #endif 1570 1571 #if !(defined(__GNUC__) || defined(__ICCARM__)) 1572 #pragma region Ingress Stream Filter Table 1573 #endif 1574 1575 /*! @brief Ingress Stream Filter table key element */ 1576 typedef struct _netc_tb_isf_keye 1577 { 1578 uint32_t isEID; /*!< Ingress Stream Entry ID */ 1579 uint8_t pcp : 3; /*!< Priority Code Point, Outer VLAN TAG PCP of the received frame */ 1580 uint8_t : 5; 1581 } netc_tb_isf_keye_t; 1582 1583 /*! @brief Ingress Stream Filter table config element */ 1584 typedef struct _netc_tb_isf_cfge 1585 { 1586 uint32_t ipv : 4; /*!< Internal Priority Value, active when opiv is set to 1 */ 1587 uint32_t oipv : 1; /*!< Override internal priority value */ 1588 uint32_t dr : 2; /*!< Drop Resilience, active when odr is set to 1 */ 1589 uint32_t odr : 1; /*!< Overwrite DR */ 1590 uint32_t imire : 1; /*!< Ingress Mirroring Enable, not applicable to ENETC */ 1591 uint32_t timecape : 1; /*!< Timestamp Capture Enable, not applicable to ENETC */ 1592 uint32_t osgi : 1; /*!< Override stream gate instance entry id */ 1593 uint32_t ctd : 1; /*!< Cut-Through Disable, will disable cut-through for all destined ports when set 1, not 1594 applicable to ENETC */ 1595 uint32_t orp : 1; /*!< Override Rate Policer (instance) ID */ 1596 netc_tc_sdu_type_t sduType : 2; /*!< Service Data Unit Type to user for MSDU */ 1597 uint32_t : 1; 1598 uint32_t msdu : 16; /*!< Maximum Service Data Unit */ 1599 uint32_t rpEID; /*!< Rate Policer Entry ID, Valid when orp =1. 0xFFFF_FFFF is NULL */ 1600 uint32_t sgiEID; /*!< Stream Gate Instance Entry ID, Valid when osgi =1. 0xFFFF_FFFF is NULL */ 1601 uint32_t iscEID; /*!< Ingress Stream counter Index. 0xFFFF_FFFF is NULL. */ 1602 } netc_tb_isf_cfge_t; 1603 1604 /*! @brief Ingress Stream Filter table request data buffer */ 1605 typedef struct _netc_tb_isf_req_data 1606 { 1607 netc_tb_common_header_t commonHeader; 1608 union 1609 { 1610 uint32_t entryID; 1611 uint32_t sCriteria; 1612 netc_tb_isf_keye_t keye; 1613 }; 1614 netc_tb_isf_cfge_t cfge; /*!< Only perform for update or add command */ 1615 } netc_tb_isf_req_data_t; 1616 1617 /*! @brief Ingress Stream Filter table request response data buffer */ 1618 typedef struct _netc_tb_isf_rsp_data 1619 { 1620 uint32_t status; 1621 uint32_t entryID; /*!< Only perform for query command */ 1622 netc_tb_isf_keye_t keye; /*!< Only perform for query command */ 1623 netc_tb_isf_cfge_t cfge; /*!< Only perform for query command */ 1624 } netc_tb_isf_rsp_data_t; 1625 1626 /*! @brief Ingress Stream Filter table data buffer */ 1627 typedef struct _netc_tb_isf_data 1628 { 1629 union 1630 { 1631 netc_tb_isf_req_data_t request; 1632 netc_tb_isf_rsp_data_t response; 1633 }; 1634 } netc_tb_isf_data_t; 1635 1636 /*! @brief Ingress Stream Filter table entry config */ 1637 typedef struct _netc_tb_isf_config 1638 { 1639 netc_tb_isf_keye_t keye; 1640 netc_tb_isf_cfge_t cfge; 1641 } netc_tb_isf_config_t; 1642 1643 #if !(defined(__GNUC__) || defined(__ICCARM__)) 1644 #pragma endregion Ingress Stream Filter Table 1645 #endif 1646 1647 #if !(defined(__GNUC__) || defined(__ICCARM__)) 1648 #pragma region Rate Policer Table 1649 #endif 1650 1651 /*! @brief Rate Policer Table Update Actions */ 1652 typedef enum _netc_tb_rp_update_action 1653 { 1654 kNETC_RPCfgEUpdate = 0x1U, /*!< Configuration Element Update */ 1655 kNETC_RPFeEUpdate = 0x2U, /*!< Functional Enable Element Update */ 1656 kNETC_RPPsEUpdate = 0x4U, /*!< Policer State Element Update Element Update */ 1657 kNETC_RPStsEUpdate = 0x8U /*!< Statistics Element Update */ 1658 } netc_tb_rp_update_action_t; 1659 1660 /*! @brief Rate Policer Table Protocol/Service Data Unit Type */ 1661 typedef netc_tc_sdu_type_t netc_tb_rp_sdu_type_t; 1662 1663 /*! @brief Rate Policer table config element */ 1664 typedef struct _netc_tb_rp_cfge 1665 { 1666 uint32_t cir; /*!< Committed information Rate */ 1667 uint32_t cbs; /*!< Commited Burst Size */ 1668 uint32_t eir; /*!< Excess information Rate */ 1669 uint32_t ebs; /*!< Excess Burst Size */ 1670 uint32_t mren : 1; /*!< Mark All Frames Red Enable, Not valid when ndor=1 */ 1671 uint32_t doy : 1; /*!< Drop on Yellow enable */ 1672 uint32_t cm : 1; /*!< Color mode, 0b = Color blind, 1b = Color aware */ 1673 uint32_t cf : 1; /*!< Coupling flag, enables coupling the Committed (C) bucket and Excess (E) bucket */ 1674 uint32_t ndor : 1; /*!< No drop on red */ 1675 netc_tb_rp_sdu_type_t sduType : 2; /*!< Service Data Unit Type */ 1676 uint32_t : 25; /*!< Reserved */ 1677 } netc_tb_rp_cfge_t; 1678 1679 /*! @brief Rate Policer table Function Enable element */ 1680 typedef struct _netc_tb_rp_fee 1681 { 1682 uint8_t fen : 1; /*!< Function Enable */ 1683 uint8_t : 7; /*!< Reserved */ 1684 } netc_tb_rp_fee_t; 1685 1686 /*! @brief Rate Policer table Policer State element */ 1687 typedef struct _netc_tb_rp_pse 1688 { 1689 uint8_t mr : 1; /*!< Mark Red Flag */ 1690 uint8_t res0 : 7; /*!< Reserved */ 1691 } netc_tb_rp_pse_t; 1692 1693 /*! @brief Rate Policer table statistic element */ 1694 typedef struct _netc_tb_rp_stse 1695 { 1696 uint32_t byteCount[2]; /*!< Number of bytes received by the rate policer instance */ 1697 uint32_t dropFrames[2]; /*!< Number of frames dropped by the rate policer instance */ 1698 uint32_t dr0GrnFrames[2]; /*!< Number of frames marked green with DR=0 by the rate policer instance */ 1699 uint32_t dr1GrnFrames[2]; /*!< Number of frames marked green with DR=1 by the rate policer instance */ 1700 uint32_t dr2GrnFrames[2]; /*!< Number of frames marked yellow with DR=2 by the rate policer instance */ 1701 uint32_t remarkYlwFrames[2]; /*!< Number of frames re-marked from green to yellow by the rate policer instance */ 1702 uint32_t dr3RedFrames[2]; /*!< Number of frames marked red with DR=3 by the rate policer instance */ 1703 uint32_t 1704 remarkRedFrames[2]; /*!< Number of frames re-marked from green or yellow to red by the rate policer instance */ 1705 uint32_t lts; /*!< Last timestamp */ 1706 uint32_t bci : 31; /*!< Committed token bucket contents, integer portion (31 bits) */ 1707 uint32_t bcs : 1; /*!< Committed token bucket sign bit (1 bit) */ 1708 uint32_t bcf; /*!< Committed token bucket contents, fractional portion (31 bits) */ 1709 uint32_t bei; /*!< Excess token bucket contents, integer portion (32 bits) */ 1710 uint32_t bef : 31; /*!< Excess token bucket contents, fractional portion (31 bits) */ 1711 uint32_t bes : 1; /*!< Committed token bucket sign bit */ 1712 } netc_tb_rp_stse_t; 1713 1714 /*! @brief Rate Policer table request data buffer */ 1715 typedef struct _netc_tb_rp_req_data 1716 { 1717 netc_tb_common_header_t commonHeader; /* Common header, contains Update Actions and Query Actions */ 1718 uint32_t entryID; /* Access Key, activer when use Entry ID Match */ 1719 union 1720 { 1721 netc_tb_rp_cfge_t cfge; /*!< Present only for commands which perform an update or add */ 1722 struct 1723 { 1724 uint8_t reserved[18]; 1725 netc_tb_rp_fee_t fee; /*!< Present only for commands which perform an update or add */ 1726 }; 1727 }; 1728 } netc_tb_rp_req_data_t; 1729 1730 /*! @brief Rate Policer table request response data buffer */ 1731 typedef struct _netc_tb_rp_rsp_data 1732 { 1733 uint32_t entryID; /*!< Present only for commands which perform a query */ 1734 netc_tb_rp_stse_t stse; /*!< Present only for commands which perform a query */ 1735 union 1736 { 1737 netc_tb_rp_cfge_t cfge; /*!< Present only for commands which perform a query */ 1738 struct 1739 { 1740 uint8_t reserved1[18]; 1741 netc_tb_rp_fee_t fee; /*!< Present only for commands which perform a query */ 1742 uint8_t reserved2; 1743 }; 1744 struct 1745 { 1746 uint8_t reserved3[19]; 1747 netc_tb_rp_pse_t pse; /*!< Present only for commands which perform a query */ 1748 }; 1749 }; 1750 } netc_tb_rp_rsp_data_t; 1751 1752 /*! @brief Rate Policer table data buffer */ 1753 typedef struct _netc_tb_rp_data 1754 { 1755 union 1756 { 1757 netc_tb_rp_req_data_t request; 1758 netc_tb_rp_rsp_data_t response; 1759 }; 1760 } netc_tb_rp_data_t; 1761 1762 /*! @brief Rate Policer table entry config */ 1763 typedef struct _netc_tb_rp_config 1764 { 1765 uint32_t entryID; 1766 netc_tb_rp_cfge_t cfge; 1767 netc_tb_rp_fee_t fee; 1768 } netc_tb_rp_config_t; 1769 1770 #if !(defined(__GNUC__) || defined(__ICCARM__)) 1771 #pragma endregion Rate Policer Table 1772 #endif 1773 1774 #if !(defined(__GNUC__) || defined(__ICCARM__)) 1775 #pragma region Ingress Stream Count Table 1776 #endif 1777 1778 /*! @brief Ingress Stream Count table statistic element */ 1779 typedef struct _netc_tb_isc_stse 1780 { 1781 uint32_t rxCount; /*!< Receive Count */ 1782 uint32_t res0; 1783 uint32_t msduDropCount; /*!< MSDU Drop Count */ 1784 uint32_t res1; 1785 uint32_t policerDropCount; /*!< Policer Drop Count */ 1786 uint32_t res2; 1787 uint32_t sgDropCount; /*!< Stream Gating Drop Count */ 1788 uint32_t res3; 1789 } netc_tb_isc_stse_t; 1790 1791 /*! @brief Ingress Stream Count table request data buffer */ 1792 typedef struct _netc_tb_isc_req_data 1793 { 1794 netc_tb_common_header_t commonHeader; 1795 uint32_t entryID; 1796 } netc_tb_isc_req_data_t; 1797 1798 /*! @brief Ingress Stream Count table request response data buffer */ 1799 typedef struct _netc_tb_isc_rsp_data 1800 { 1801 uint32_t entryID; 1802 netc_tb_isc_stse_t stse; 1803 } netc_tb_isc_rsp_data_t; 1804 1805 /*! @brief Ingress Stream Count table data buffer */ 1806 typedef struct _netc_tb_isc_data 1807 { 1808 union 1809 { 1810 netc_tb_isc_req_data_t request; 1811 netc_tb_isc_rsp_data_t response; 1812 }; 1813 } netc_tb_isc_data_t; 1814 1815 #if !(defined(__GNUC__) || defined(__ICCARM__)) 1816 #pragma endregion Ingress Stream Count Table 1817 #endif 1818 1819 #if !(defined(__GNUC__) || defined(__ICCARM__)) 1820 #pragma region Stream Gate Instance Table 1821 #endif 1822 1823 /*! @brief Stream Gate Instance table Update Actions */ 1824 typedef enum _netc_tb_sgi_update_action 1825 { 1826 kNETC_SGIAcfEUpdate = 0x1U, /*!< Admin Configuration Element */ 1827 kNETC_SGICfgEUpdate = 0x2U, /*!< Configuration Element Update */ 1828 kNETC_SGISgisEUpdate = 0x4U /*!< Stream Gate Instance State Element Update */ 1829 } netc_tb_sgi_update_action_t; 1830 1831 /*! @brief Stream Gate Instance table Protocol/Service Data Unit Type */ 1832 typedef netc_tc_sdu_type_t netc_tb_sgi_sdu_type_t; 1833 1834 /*! @brief Stream Gate Instance State */ 1835 typedef enum _netc_tb_sgi_state 1836 { 1837 kNETC_GSNotOper = 0x0U, /*!< Gate instance is not operational or Gate instance and lists are not valid */ 1838 kNETC_GSUseDefaultParam, /*!< Gate instance is operational but no stream gate control list specified, use default 1839 Gate Instance parameters */ 1840 kNETC_GSUseDefUntilAdminAct, /*!< Use default Gate Instance parameters until administrative stream gate control 1841 list takes effect */ 1842 kNETC_GSUseOperUntilAdminAct, /*!< Use Operational stream gate control list until new administrative stream gate 1843 control list takes effect */ 1844 kNETC_GSUseOperList /*!< Operational stream gate control list is in effect */ 1845 } netc_tb_sgi_state_t; 1846 1847 /*! @brief Stream Gate Instance table config element */ 1848 typedef struct _netc_tb_sgi_cfge 1849 { 1850 uint8_t oexen : 1; /*!< Octets Exceeded (Gate Closed Due To Octets Exceeded function) Enable */ 1851 uint8_t irxen : 1; /*!< Invalid Receive (Gate Closed Due To Invalid Rx) Enable */ 1852 netc_tb_sgi_sdu_type_t sduType : 2; /*!< The type of PDU/SDU for Interval Octets Maximum check for Gate Entry */ 1853 uint8_t : 4; 1854 } netc_tb_sgi_cfge_t; 1855 1856 /*! @brief Stream Gate Instance table Admin Configuration element */ 1857 typedef struct _netc_tb_sgi_acfge 1858 { 1859 uint32_t adminSgclEID; /*!< Administrative Stream Gate Control List Entry ID, 0xFFFFFFFF is NULL */ 1860 uint32_t adminBaseTime[2]; /*!< Admin Base Time */ 1861 uint32_t adminCycleTimeExt; /*!< Admin Cycle Time Extension */ 1862 } netc_tb_sgi_acfge_t; 1863 1864 /*! @brief Stream Gate Instance table Initial Configuration element */ 1865 typedef struct _netc_tb_sgi_icfge 1866 { 1867 uint8_t ipv : 4; /*!< Internal Priority Value (IPV), Valid if oipv is 1 */ 1868 uint8_t oipv : 1; /*!< Override frame IPV, otherwise the IPV value is determined by the stream gate control list 1869 entry */ 1870 uint8_t gst : 1; /*!< Specifies Gate State before the administrative stream gate control list takes affect, 0b = 1871 Closed; 1b = Open */ 1872 uint8_t ctd : 1; /*!< Specifies Cut Through disable status before the administrative stream gate control list takes 1873 affect , Not applicable to ENETC function*/ 1874 uint8_t : 1; 1875 } netc_tb_sgi_icfge_t; 1876 1877 /*! @brief Stream Gate Instance table stream gate instance state element */ 1878 typedef struct _netc_tb_sgi_sgise 1879 { 1880 uint32_t operSgclEID; /*!< Operational Stream Gate Control List Entry ID */ 1881 uint32_t configChangeTime[2]; /*!< Configuration Change Time */ 1882 uint32_t operBaseTime[2]; /*!< Operational Base Time */ 1883 uint32_t operCycleTimeExt; /*!< Oper Cycle Time Extension */ 1884 uint32_t oex : 1; /*!< Octets Exceeded Flag */ 1885 uint32_t irx : 1; /*!< Invalid Receive Flag */ 1886 netc_tb_sgi_state_t state : 3; /*!< Current Gate Instance State */ 1887 uint32_t : 27; 1888 } netc_tb_sgi_sgise_t; 1889 1890 /*! @brief Stream Gate Instance table request data buffer */ 1891 typedef struct _netc_tb_sgi_req_data 1892 { 1893 netc_tb_common_header_t commonHeader; 1894 uint32_t entryID; 1895 netc_tb_sgi_acfge_t acfge; 1896 netc_tb_sgi_cfge_t cfge; 1897 netc_tb_sgi_icfge_t icfge; 1898 } netc_tb_sgi_req_data_t; 1899 1900 /*! @brief Stream Gate Instance table request response data buffer */ 1901 typedef struct _netc_tb_sgi_rsp_data 1902 { 1903 uint32_t entryID; 1904 union 1905 { 1906 netc_tb_sgi_sgise_t sgise; 1907 struct 1908 { 1909 uint8_t res0[24]; 1910 netc_tb_sgi_cfge_t cfge; 1911 netc_tb_sgi_icfge_t icfge; 1912 uint8_t res1; 1913 }; 1914 }; 1915 netc_tb_sgi_acfge_t acfge; 1916 } netc_tb_sgi_rsp_data_t; 1917 1918 /*! @brief Stream Gate Instance table data buffer */ 1919 typedef struct _netc_tb_sgi_data 1920 { 1921 union 1922 { 1923 netc_tb_sgi_req_data_t request; 1924 netc_tb_sgi_rsp_data_t response; 1925 }; 1926 } netc_tb_sgi_data_t; 1927 1928 /*! @brief Stream Gate Instance table entry config */ 1929 typedef struct _netc_tb_sgi_config 1930 { 1931 uint32_t entryID; 1932 netc_tb_sgi_acfge_t acfge; 1933 netc_tb_sgi_cfge_t cfge; 1934 netc_tb_sgi_icfge_t icfge; 1935 } netc_tb_sgi_config_t; 1936 1937 #if !(defined(__GNUC__) || defined(__ICCARM__)) 1938 #pragma endregion Stream Gate Instance Table 1939 #endif 1940 1941 #if !(defined(__GNUC__) || defined(__ICCARM__)) 1942 #pragma region Stream Gate Control List Table 1943 #endif 1944 /*! @brief Stream Gate Control List Table maximum gate control list length */ 1945 #define NETC_TB_SGCL_MAX_ENTRY (0x100U) 1946 1947 /*! @brief Defines the Stream Gate Control entry structure. */ 1948 typedef struct _netc_sgcl_gate_entry 1949 { 1950 uint32_t timeInterval; /*!< Time Interval for Gate Entry */ 1951 uint32_t iom : 24; /*!< Interval Octets Maximum for Gate Entry, specifies the maximum bytes (octets) allowed to 1952 pass (open), valid if iomen = 1 */ 1953 uint32_t ipv : 4; /*!< Internal Priority Value for Gate Entry */ 1954 uint32_t oipv : 1; /*!< Override Internal Priority Value for Gate Entry */ 1955 uint32_t ctd : 1; /*!< Cut Through Disable for Gate Entry */ 1956 uint32_t iomen : 1; /*!< Interval Octet Maximum Enabled for Gate Entry, 0b = Don'track count, 1b = Track count */ 1957 uint32_t gtst : 1; /*!< Gate State for Gate Entry, 0b = Closed; 1b = Open */ 1958 } netc_sgcl_gate_entry_t; 1959 1960 /*! @brief Stream Gate Control List table config element */ 1961 typedef struct _netc_tb_sgcl_cfge 1962 { 1963 uint32_t cycleTime; /*!< Cycle Time */ 1964 uint8_t listLength; /*!< List Length */ 1965 uint8_t res0; 1966 uint16_t extOipv : 1; /*!< Extension (means the stream gate control list ends and before cycleTime restarts) 1967 Override Internal Priority Value */ 1968 uint16_t extIpv : 4; /*!< List Extension Internal Priority Value, valid if extOipv = 1 */ 1969 uint16_t extCtd : 1; /*!< Extension Cut Through Disabled, 0b = No action, 1b = Disabled */ 1970 uint16_t extGtst : 1; /*!< Extension Gate State, 0b = closed, 1b = Open */ 1971 uint16_t res1 : 9; 1972 netc_sgcl_gate_entry_t ges[]; 1973 } netc_tb_sgcl_cfge_t; 1974 1975 /*! @brief Stream Gate Control List table Stream Gate Control List State element */ 1976 typedef struct _netc_tb_sgcl_sgclse 1977 { 1978 uint8_t refCount; /*!< Reference Count, 1 indicates that the gate control list is an administrative or an 1979 operational gate control list in a stream gate instance */ 1980 } netc_tb_sgcl_sgclse_t; 1981 1982 /*! @brief Stream Gate Control List table request data buffer */ 1983 typedef struct _netc_tb_sgcl_req_data 1984 { 1985 netc_tb_common_header_t commonHeader; 1986 uint32_t entryID; 1987 netc_tb_sgcl_cfge_t cfge; 1988 } netc_tb_sgcl_req_data_t; 1989 1990 /*! @brief Stream Gate Control List table request response data buffer */ 1991 typedef struct _netc_tb_sgcl_rsp_data 1992 { 1993 uint32_t entryID; 1994 netc_tb_sgcl_sgclse_t sgclse; 1995 uint8_t res[3]; 1996 netc_tb_sgcl_cfge_t cfge; 1997 } netc_tb_sgcl_rsp_data_t; 1998 1999 /*! @brief Stream Gate Control List table data buffer */ 2000 typedef struct _netc_tb_sgcl_data 2001 { 2002 union 2003 { 2004 netc_tb_sgcl_req_data_t request; 2005 netc_tb_sgcl_rsp_data_t response; 2006 struct 2007 { 2008 uint32_t rel0[4]; 2009 netc_sgcl_gate_entry_t res1[NETC_TB_SGCL_MAX_ENTRY]; 2010 }; 2011 }; 2012 } netc_tb_sgcl_data_t; 2013 2014 /*! @brief Stream Gate Control List table entry gate control list structure */ 2015 typedef struct _netc_tb_sgcl_gcl 2016 { 2017 uint16_t entryID; 2018 uint16_t extOipv : 1; /*!< Extension (means the stream gate control list ends and before cycleTime restarts) 2019 Override Internal Priority Value */ 2020 uint16_t extIpv : 4; /*!< List Extension Internal Priority Value, valid if extOipv = 1 */ 2021 uint16_t extCtd : 1; /*!< Extension Cut Through Disabled, 0b = No action, 1b = Disabled */ 2022 uint16_t extGtst : 1; /*!< Extension Gate State, 0b = closed, 1b = Open */ 2023 uint32_t cycleTime; /*!< Cycle Time */ 2024 uint32_t numEntries; /*!< Control List entry numbers */ 2025 netc_sgcl_gate_entry_t *gcList; /*!< Pointer to stream gate control list array */ 2026 } netc_tb_sgcl_gcl_t; 2027 2028 #if !(defined(__GNUC__) || defined(__ICCARM__)) 2029 #pragma endregion Stream Gate Control List Table 2030 #endif 2031 2032 #if !(defined(__GNUC__) || defined(__ICCARM__)) 2033 #pragma region Frame Modification Table 2034 #endif 2035 2036 /*! 2037 * @brief Frame Modification table Layer 2 Actions 2038 * @note This field must be set to 0 for traffic destined to a pseudo link. 2039 * This field must be set to 0 for any device with ASIL-B safety requirements. 2040 */ 2041 typedef enum _netc_tb_fm_layer2_act 2042 { 2043 kNETC_UseL2HeaderAct = 0U, /*!< L2 actions are specified in L2 header action fields macHdrAct, 2044 vlanHdrAct and sqtAct */ 2045 kNETC_UseSpecPlayload /*!< The entire L2 PDU is replaced with fmdBytes of data specified in fmdEID, not applicable 2046 for ingress frame modifications */ 2047 } netc_tb_fm_layer2_act_t; 2048 2049 /*! 2050 * @brief Frame Modification table Layer 2 Header MAC Actions 2051 * @note Ingress frame modifications only support kNETC_NoAction or kNETC_ReplDmac. 2052 */ 2053 typedef enum _netc_tb_fm_mac_header_act 2054 { 2055 kNETC_NoMacAction = 0U, /*!< No Mac header action */ 2056 kNETC_ReplSmac = 2U, /*!< Replace SMAC with the contents of the port's PMAR0/1 register, The port is specified by 2057 smacPort field */ 2058 kNETC_ReplSmacAndDmacAct1, /*!< Replace SMAC and DMAC, The content of SMAC is the same as kNETC_ReplaceSMAC, the 2059 DMAC is specified by dmac[6] field */ 2060 kNETC_ReplSmacAndDmacAct2, /*!< Replace SMAC and DMAC, The content of SMAC is the same as kNETC_ReplaceSMAC, the 2061 DMAC is specified by frame's SMAC */ 2062 kNETC_ReplDmac, /*!< Replace DMAC with specified dmac[6] field value */ 2063 kNETC_SwapDmacAndSmac /*!< Swap DMAC and SMAC */ 2064 } netc_tb_fm_mac_header_act_t; 2065 2066 /*! 2067 * @brief Frame Modification table Layer 2 VLAN Actions 2068 * @note For use Delete or Replace action, if no outer VLAN header is present, then a misconfiguration event will be 2069 * generated and handled according to the port's PFMCR register. 2070 */ 2071 typedef enum _netc_tb_fm_vlan_header_act 2072 { 2073 kNETC_NoVlanAction = 0U, /*!< No VLAN header action */ 2074 kNETC_DelOuterVlan, /*!< Delete outer VLAN header */ 2075 kNETC_AddOuterVlan, /*!< Add outer VLAN header (new VLAN data will be inserted in the outer position), the VID, PCP, 2076 DEI and TPID values are specified by outerVidAct, outerPcpAct, outerDeiAct and outerTpidAct 2077 field */ 2078 kNETC_ReplOuterVlan /*!< Replace outer VLAN header, the VID, PCP, DEI and TPID values are specified by outerVidAct, 2079 outerPcpAct, outerDeiAct and outerTpidAct field */ 2080 } netc_tb_fm_vlan_header_act_t; 2081 2082 /*! 2083 * @brief Frame Modification table Layer 2 outer VLAN VID Actions 2084 * @note For use kNETC_UseFrameVID action, if no outer VLAN header is present, then a misconfiguration event will be 2085 * generated and handled according to the port's PFMCR register. 2086 */ 2087 typedef enum _netc_tb_fm_outer_vid_act 2088 { 2089 kNETC_UseFrameVid = 0U, /*!< Use the VID from the valid outer VLAN header of the received frame */ 2090 kNETC_UseSpecVid /*!< Use the VID specified in the outerVlanID field */ 2091 } netc_tb_fm_outer_vid_act_t; 2092 2093 /*! 2094 * @brief Frame Modification table Sequence Tag Action 2095 * @note For use kNETC_ReomveTag action, If R-TAG/draft 2.0 R-TAG/HSR tag not present, then a misconfiguration event 2096 * will be generated and handled according to the port's PFMCR register. 2097 */ 2098 typedef netc_fm_sqt_act_t netc_tb_fm_sqt_act_t; 2099 2100 /*! 2101 * @brief Frame Modification table Outer TPID action 2102 * @note For use kNETC_UseFrameTpid action, If outer VLAN header not present, then a misconfiguration event will be 2103 * generated and handled according to the port's PFMCR register. 2104 */ 2105 typedef enum _netc_tb_fm_outer_tpid_act 2106 { 2107 kNETC_UseFrameTpid = 0U, /*!< Use TPID from outer VLAN header */ 2108 kNETC_UseStdCVlan, /*!< Set TPID to Standard C-VLAN 0x8100 */ 2109 kNETC_UseStdSVlan, /*!< Set TPID to Standard S-VLAN 0x88A8 */ 2110 kNETC_UseCustomCVlan, /*!< Set TPID to Custom C-VLAN as defined by CVLANR1[ETYPE] */ 2111 kNETC_UseCustomSVlan /*!< Set TPID to Custom S-VLAN as defined by CVLANR2[ETYPE] */ 2112 } netc_tb_fm_outer_tpid_act_t; 2113 2114 /*! 2115 * @brief Frame Modification table Outer PCP action 2116 * @note For use kNETC_UseFramePcp/kNETC_UseFramePcpMap action, If outer VLAN header not present, then a 2117 * misconfiguration event will be generated and handled according to the port's PFMCR register. 2118 */ 2119 typedef enum _netc_tb_fm_outer_pcp_act 2120 { 2121 kNETC_UseFramePcp = 0U, /*!< Use PCP from frame outer VLAN header */ 2122 kNETC_UseSpecPcp, /*!< Use the PCP specified in the outerVlanPcp field */ 2123 kNETC_UseFramePcpMap, /*!< The PCP is mapping from frame outer VLAN PCP (do mapping according to the PCP to PCP 2124 mapping profile which specified in PPCPDEIMR[IPCPMP/EPCPMP]) */ 2125 kNETC_UseQosMap /*!< The PCP is mapping from internal QoS (IPV, DR) (do mapping according to the QOS to PCP mapping 2126 profile which specified in QOSVLANMPaR0/1/2/3), not applicable for ingress frame modifications */ 2127 } netc_tb_fm_outer_pcp_act_t; 2128 2129 /*! 2130 * @brief Frame Modification table Outer DEI action 2131 * @note For use kNETC_UseFrameDei action, If outer VLAN header not present, then a misconfiguration event will be 2132 * generated and handled according to the port's PFMCR register. 2133 */ 2134 typedef enum _netc_tb_fm_outer_dei_act 2135 { 2136 kNETC_UseFrameDei = 0U, /*!< Use DEI from frame outer VLAN header */ 2137 kNETC_UseSpecDei, /*!< Use the DEI specified in the outerVlanDei field */ 2138 kNETC_UseDrMap /*!< The DEI is mapping from internal DR (do mapping according to the DR to DEI mapping 2139 profile which specified in PPCPDEIMR[DRnDEI], not applicable for ingress frame modifications */ 2140 } netc_tb_fm_outer_dei_act_t; 2141 2142 /*! 2143 * @brief Frame Modification table Payload Actions 2144 * @note This field must be set to 0 for traffic destined to a pseudo link. 2145 * This field must be set to 0 for any device with ASIL-B safety requirements. 2146 */ 2147 typedef enum _netc_tb_fm_payload_act 2148 { 2149 kNETC_NoAction = 0U, /*!< No Action */ 2150 kNETC_ReplAllEthPld, /*!< Remove entire Ethernet payload and insert with fmdBytes of data specified in fmdEID */ 2151 kNETC_ReplPldWithOffset /*!< Replace fmdBytes of raw data in the Ethernet payload starting at pldOffset, data 2152 specified in fmdEID */ 2153 } netc_tb_fm_payload_act_t; 2154 2155 /*! @brief Frame Modification table config element */ 2156 typedef struct _netc_tb_fm_cfge 2157 { 2158 netc_tb_fm_layer2_act_t l2Act : 1; /*!< Layer 2 Actions */ 2159 netc_tb_fm_mac_header_act_t macHdrAct : 3; /*!< Layer 2 Header MAC Actions */ 2160 netc_tb_fm_vlan_header_act_t vlanHdrAct : 2; /*!< Layer 2 VLAN Actions */ 2161 netc_tb_fm_outer_vid_act_t outerVidAct : 2; /*!< Outer VID Actions */ 2162 netc_tb_fm_sqt_act_t sqtAct : 3; /*!< Sequence Tag Action, Not applicable for ingress frame modifications */ 2163 uint16_t smacPort : 5; /*!< Source MAC Address Register Port, valid if macHdrAct=010b,011b,100b */ 2164 uint8_t dmac[6]; /*!< Destination MAC Address, valid if macHdrAct = 011b,101b */ 2165 uint32_t outerVlanID : 12; /*!< Outer VLAN VID, valid if outerVidAct = 01b */ 2166 uint32_t outerVlanPcp : 3; /*!< Outer VLAN PCP, valid if outerPcpAct = 01b */ 2167 uint32_t outerVlanDei : 1; /*!< Outer VLAN DEI, valid if outerDeiAct = 01b */ 2168 netc_tb_fm_outer_tpid_act_t outerTpidAct : 3; /*!< Outer TPID action */ 2169 netc_tb_fm_outer_pcp_act_t outerPcpAct : 3; /*!< Outer PCP action */ 2170 netc_tb_fm_outer_dei_act_t outerDeiAct : 2; /*!< Outer DEI action */ 2171 netc_tb_fm_payload_act_t pldAct : 3; /*!< Payload Actions, Not applicable for ingress frame modifications */ 2172 uint32_t : 5; 2173 uint8_t pldOffset; /*!< Payload Offset, valid if outerPldAct = 010b */ 2174 uint8_t res1[3]; 2175 uint16_t fmdBytes; /*!< Frame Modification Bytes, valid if outerPldAct = 001b,010b or l2Act = 1b */ 2176 uint16_t res2; 2177 uint32_t fmdEID; /*!< Frame Modification Data Entry ID, valid if outerPldAct = 001b,010b or l2Act = 1b. 0xFFFF is 2178 null pointer */ 2179 } netc_tb_fm_cfge_t; 2180 2181 /*! @brief Frame Modification table request data buffer */ 2182 typedef struct _netc_tb_fm_req_data 2183 { 2184 netc_tb_common_header_t commonHeader; 2185 uint32_t entryID; 2186 netc_tb_fm_cfge_t cfge; 2187 } netc_tb_fm_req_data_t; 2188 2189 /*! @brief Frame Modification table request response data buffer */ 2190 typedef struct _netc_tb_fm_rsp_data 2191 { 2192 uint32_t entryID; 2193 netc_tb_fm_cfge_t cfge; 2194 } netc_tb_fm_rsp_data_t; 2195 2196 /*! @brief Frame Modification table data buffer */ 2197 typedef struct _netc_tb_fm_data 2198 { 2199 union 2200 { 2201 netc_tb_fm_req_data_t request; 2202 netc_tb_fm_rsp_data_t response; 2203 }; 2204 } netc_tb_fm_data_t; 2205 2206 /*! @brief Frame Modification table entry config */ 2207 typedef struct _netc_tb_fm_config 2208 { 2209 uint32_t entryID; 2210 netc_tb_fm_cfge_t cfge; 2211 } netc_tb_fm_config_t; 2212 2213 #if !(defined(__GNUC__) || defined(__ICCARM__)) 2214 #pragma endregion Frame Modification DataTable 2215 #endif 2216 2217 #if !(defined(__GNUC__) || defined(__ICCARM__)) 2218 #pragma region Frame Modification Data Table 2219 #endif 2220 /*! @brief TFrame Modification Data table update config Data Buffer length, x is the number of update data bytes */ 2221 #define NETC_TB_FMD_UPDATE_CONFIG_LENGTH(x) (8U + (x)) 2222 2223 /*! @brief Frame Modification Data table request data buffer */ 2224 typedef struct _netc_tb_fmd_req_data 2225 { 2226 netc_tb_common_header_t commonHeader; 2227 uint32_t entryID; 2228 uint8_t cfge[]; /*!< Configuration Element Data size is variable */ 2229 } netc_tb_fmd_req_data_t; 2230 2231 /*! @brief Frame Modification Data table request response data buffer */ 2232 typedef struct _netc_tb_fmd_rsp_data 2233 { 2234 uint32_t entryID; 2235 uint8_t cfge[]; /*!< Configuration Element Data size is variable */ 2236 } netc_tb_fmd_rsp_data_t; 2237 2238 /*! @brief Frame Modification Data table data buffer */ 2239 typedef struct _netc_tb_fmd_data 2240 { 2241 union 2242 { 2243 netc_tb_fmd_req_data_t request; 2244 netc_tb_fmd_rsp_data_t response; 2245 }; 2246 } netc_tb_fmd_data_t; 2247 2248 /*! @brief Frame Modification data table entry update config */ 2249 typedef struct _netc_tb_fmd_update_config 2250 { 2251 uint32_t res; /*!< Hold for request->commonHeader */ 2252 uint32_t entryID; 2253 uint8_t cfge[]; /*!< Configuration Element Data size is variable */ 2254 } netc_tb_fmd_update_config_t; 2255 2256 /*! @brief Frame Modification data table entry query data buffer */ 2257 typedef struct _netc_tb_fmd_query_buffer 2258 { 2259 uint32_t entryID; /*!< EntryID of the queried entry */ 2260 uint8_t cfge[]; /*!< Configuration Element Data size is variable */ 2261 } netc_tb_fmd_query_buffer_t; 2262 2263 #if !(defined(__GNUC__) || defined(__ICCARM__)) 2264 #pragma endregion Frame Modification Data Table 2265 #endif 2266 2267 #if !(defined(__GNUC__) || defined(__ICCARM__)) 2268 #pragma region Vlan Filter Table 2269 #endif 2270 2271 /*! @brief Vlan Filter table key element */ 2272 typedef struct _netc_tb_vf_keye 2273 { 2274 uint32_t vid : 12; 2275 uint32_t : 20; 2276 } netc_tb_vf_keye_t; 2277 2278 /*! @brief Vlan Filter table config element */ 2279 typedef struct _netc_tb_vf_cfge 2280 { 2281 uint32_t portMembership : 24; /*!< Port Membership Bitmap */ 2282 uint32_t stgID : 4; /*!< Spanning Tree Group Member ID */ 2283 uint32_t : 4; 2284 uint32_t fid : 12; /*!< Filtering ID */ 2285 uint32_t : 4; 2286 uint32_t mlo : 3; /*!< MAC Learning Options */ 2287 uint32_t mfo : 2; /*!< MAC Forwarding Options */ 2288 uint32_t : 1; 2289 uint32_t ipmfe : 1; /*!< IP Multicast Filtering Enable */ 2290 uint32_t ipmfle : 1; /*!< IP Multicast Flooding Enable */ 2291 uint32_t : 8; 2292 uint32_t etaPortBitmap : 24; /*!< Egress Treatment Applicability Port Bitmap for the secondary 2293 Egress Treatment group */ 2294 uint32_t : 8; 2295 uint32_t baseETEID; /*!< Base Egress Treatment Entry ID for the secondary Egress Treatment group */ 2296 } netc_tb_vf_cfge_t; 2297 2298 /*! @brief Vlan Filter table search criteria format */ 2299 typedef struct _netc_tb_vf_search_criteria 2300 { 2301 uint32_t resumeEntryId; /*!< Resume Entry ID, when starting a search, pass the NULL Entry ID. */ 2302 } netc_tb_vf_search_criteria_t; 2303 2304 /*! @brief Vlan Filter table request data buffer */ 2305 typedef struct _netc_tb_vf_req_data 2306 { 2307 netc_tb_common_header_t commonHeader; 2308 union 2309 { 2310 uint32_t entryID; 2311 netc_tb_vf_search_criteria_t sCriteria; /*!< Active when access method is kNETC_Search */ 2312 netc_tb_vf_keye_t keye; 2313 }; 2314 netc_tb_vf_cfge_t cfge; /*!< Present only for update or add commands */ 2315 } netc_tb_vf_req_data_t; 2316 2317 /*! @brief Vlan Filter table request response data buffer */ 2318 typedef struct _netc_tb_vf_rsp_data 2319 { 2320 uint32_t status; /*!< Present only for query command with search access method */ 2321 uint32_t entryID; /*!< Present only for query command */ 2322 netc_tb_vf_keye_t keye; /*!< Present only for query command */ 2323 netc_tb_vf_cfge_t cfge; /*!< Present only for query command */ 2324 } netc_tb_vf_rsp_data_t; 2325 2326 /*! @brief Vlan Filter table data buffer */ 2327 typedef struct _netc_tb_vf_data 2328 { 2329 union 2330 { 2331 netc_tb_vf_req_data_t request; 2332 netc_tb_vf_rsp_data_t response; 2333 }; 2334 } netc_tb_vf_data_t; 2335 2336 /*! @brief Vlan Filter table entry config */ 2337 typedef struct _netc_tb_vf_config 2338 { 2339 netc_tb_vf_keye_t keye; 2340 netc_tb_vf_cfge_t cfge; 2341 } netc_tb_vf_config_t; 2342 2343 #if !(defined(__GNUC__) || defined(__ICCARM__)) 2344 #pragma endregion Vlan Filter Table 2345 #endif 2346 2347 #if !(defined(__GNUC__) || defined(__ICCARM__)) 2348 #pragma region FDB Table 2349 #endif 2350 2351 /*! @brief FDB table Update Actions */ 2352 typedef enum _netc_tb_fdb_update_action 2353 { 2354 kNETC_FDBCfgEUpdate = 0x1U, /*!< Configuration Element Update */ 2355 kNETC_FDBActEUpdate = 0x2U /*!< Activity Element Update */ 2356 } netc_tb_fdb_update_action_t; 2357 2358 /*! @brief FDB table entry defined the egress packet processing actions (will cover the actions which specified in the 2359 * Egress Treatment table )*/ 2360 typedef netc_tb_eteid_access_mode_t netc_tb_fdb_oeteid_mode_t; 2361 2362 /*! @brief FDB table Cut-Through Disable mode */ 2363 typedef enum _netc_tb_fdb_ctd_mode 2364 { 2365 kNETC_FDBNoCTD = 0x0U, /*!< Do not override cut-through state */ 2366 kNETC_FDBSinglePortCTD = 0x1U, /*!< Disable cut-through for the outgoing port specified in the cfge ePort field */ 2367 kNETC_FDBAllPortCTD = 0x2U /*!< Disable cut-through for all ports specified in cfge portBitmap field */ 2368 } netc_tb_fdb_ctd_mode_t; 2369 2370 typedef struct _netc_tb_fdb_keye 2371 { 2372 uint8_t macAddr[6]; /*!< Destination MAC address of the frame for MAC forwarding lookups and the source MAC address 2373 of the frame for MAC learning lookups */ 2374 uint8_t res0[2]; 2375 uint32_t fid : 12; /*!< Filtering ID, is obtained from an ingress lookup into the VLAN Filter table */ 2376 uint32_t : 20; 2377 } netc_tb_fdb_keye_t; 2378 2379 /*! @brief FDB table configuration element */ 2380 typedef struct _netc_tb_fdb_cfge 2381 { 2382 uint32_t 2383 portBitmap : 24; /*!< Forwarding destination Port Bitmap and ET applicability port bitmap when oETEID = 10b */ 2384 uint32_t : 8; 2385 netc_tb_fdb_oeteid_mode_t oETEID : 2; /*!< Override ET_EID option */ 2386 uint32_t ePort : 5; /*!< Egress Ports, active when oETEid = 01b or ctd = 01b */ 2387 uint32_t iMirE : 1; /*!< Ingress Mirroring Enable */ 2388 uint32_t : 1; 2389 netc_tb_fdb_ctd_mode_t ctd : 2; /*!< Cut-Through Disable */ 2390 uint32_t dynamic : 1; /*!< Static or Dynamic Entry, 0b = Static entry, 1b = Dynamic entry */ 2391 uint32_t timeCapE : 1; /*!< Timestamp Capture Enable when set */ 2392 uint32_t : 19; 2393 uint32_t etEID; /*!< Base egress treatment table entry id for primary Egress Treatment group, is valid if the oETEID 2394 field is set to value other than kNETC_FDBNoEPP. 0xFFFFFFFF is NULL. */ 2395 } netc_tb_fdb_cfge_t; 2396 2397 /*! @brief FDB table Activity element */ 2398 typedef struct _netc_tb_fdb_acte 2399 { 2400 uint8_t actCnt : 7; /*!< Activity Counter */ 2401 uint8_t actFlag : 1; /*!< Activity Flag */ 2402 } netc_tb_fdb_acte_t; 2403 2404 /*! @brief FDB table search criteria Key Element Match Criteria */ 2405 typedef enum _netc_tb_fdb_sc_keye_mc 2406 { 2407 kNETC_FDBKeyeMacthAny = 0x0, /*!< Match any Key Element Criteria */ 2408 kNETC_FDBKeyeMacthFID = 0x1, /*!< Match Key Element FID */ 2409 kNETC_FDBKeyeMacthMacMulticast = 0x2, /*!< Match Key Element MAC Multicast bit (MAC_ADDR most 2410 significant byte's least significant bit) */ 2411 kNETC_FDBKeyeMacthBoth = 0x3 /*!< Match both FID field and MAC Multicast bit */ 2412 } netc_tb_fdb_sc_keye_mc_t; 2413 2414 /*! @brief FDB table search criteria Configuration Element Match Criteria */ 2415 typedef enum _netc_tb_fdb_sc_cfge_mc 2416 { 2417 kNETC_FDBCfgeMacthAny = 0x0, /*!< Match any Configuration Element Criteria */ 2418 kNETC_FDBCfgeMacthDynamic = 0x1, /*!< Match Configuration Element dynamic field */ 2419 kNETC_FDBCfgeMacthPortBitmap = 0x2, /*!< Match Configuration Element portBitmap field */ 2420 kNETC_FDBCfgeMacthBoth = 0x3 /*!< Match both dynamic field and portBitmap */ 2421 } netc_tb_fdb_sc_cfge_mc_t; 2422 2423 /*! @brief FDB table search criteria Activity Element Match Criteria */ 2424 typedef enum _netc_tb_fdb_sc_acte_mc 2425 { 2426 kNETC_FDBActeMacthAny = 0x0, /*!< Match any Activity Element Criteria */ 2427 kNETC_FDBActeMatchExact = 0x1 /*!< Exact match with Activity Element */ 2428 } netc_tb_fdb_sc_acte_mc_t; 2429 2430 /*! @brief FDB table search criteria format */ 2431 typedef struct _netc_tb_fdb_search_criteria 2432 { 2433 uint32_t resumeEntryId; /*!< Resume Entry ID, pass the NULL Entry ID when starting a search */ 2434 netc_tb_fdb_keye_t keye; /*!< Key Element data which used to match against the table entries */ 2435 netc_tb_fdb_cfge_t cfge; /*!< Configuration Element data which used to match against the table entries */ 2436 struct 2437 { 2438 netc_tb_fdb_acte_t acte; /*!< Activity Element data which used to match against the table entries */ 2439 netc_tb_fdb_sc_keye_mc_t keyeMc : 2; /*!< Key Element data match criteria */ 2440 uint8_t : 6; 2441 netc_tb_fdb_sc_cfge_mc_t cfgeMc : 3; /*!< Configuration Element data match criteria */ 2442 uint8_t : 5; 2443 netc_tb_fdb_sc_acte_mc_t acteMc : 1; /*!< Activity Element data match criteria */ 2444 uint8_t : 7; 2445 }; 2446 } netc_tb_fdb_search_criteria_t; 2447 2448 /*! @brief FDB table request data buffer */ 2449 typedef struct _netc_tb_fdb_req_data 2450 { 2451 netc_tb_common_header_t commonHeader; /*!< Define update actions (use netc_tb_fdb_update_action_t) 2452 and query actions */ 2453 union 2454 { 2455 uint32_t entryID; /*!< Active when access method is kNETC_EntryIDMatch */ 2456 netc_tb_fdb_keye_t keye; /*!< Active when access method is kNETC_ExactKeyMatch */ 2457 netc_tb_fdb_search_criteria_t sCriteria; /*!< Active when access method is kNETC_Search */ 2458 }; 2459 netc_tb_fdb_cfge_t cfge; /*!< Present only for commands which perform an update or add */ 2460 } netc_tb_fdb_req_data_t; 2461 2462 /*! @brief FDB table request response data buffer */ 2463 typedef struct _netc_tb_fdb_rsp_data 2464 { 2465 uint32_t status; /*!< RESUME_ENTRY_ID, valid only in responses for commands which use the Search Access Method */ 2466 uint32_t entryID; /*!< Present only for query command */ 2467 netc_tb_fdb_keye_t keye; /*!< Present only for query command */ 2468 netc_tb_fdb_cfge_t cfge; /*!< Present only for query command */ 2469 netc_tb_fdb_acte_t acte; /*!< Present only for query command */ 2470 } netc_tb_fdb_rsp_data_t; 2471 2472 /*! @brief FDB table data buffer */ 2473 typedef struct _netc_tb_fdb_data 2474 { 2475 union 2476 { 2477 netc_tb_fdb_req_data_t request; 2478 netc_tb_fdb_rsp_data_t response; 2479 }; 2480 } netc_tb_fdb_data_t; 2481 2482 /*! @brief FDB table entry config */ 2483 typedef struct _netc_tb_fdb_config 2484 { 2485 netc_tb_fdb_keye_t keye; 2486 netc_tb_fdb_cfge_t cfge; 2487 } netc_tb_fdb_config_t; 2488 2489 #if !(defined(__GNUC__) || defined(__ICCARM__)) 2490 #pragma endregion FDB Table 2491 #endif 2492 2493 #if !(defined(__GNUC__) || defined(__ICCARM__)) 2494 #pragma region L2 IPV4 Multicast Filter Table 2495 #endif 2496 2497 /*! @brief L2 IPV4 Multicast Filter table key type */ 2498 typedef enum _netc_tb_l2mcf_key_type 2499 { 2500 kNETC_IPv4ASMKey = 0U, /*!< Key consists of a filtering ID (FID) and destination multicast IPv4 address */ 2501 kNETC_IPv4SSMKey /*!< Key consists of a filtering ID (FID), IPv4 source address and multicast IPv4 destination 2502 address */ 2503 } netc_tb_l2mcf_key_type_t; 2504 2505 /*! @brief L2 IPV4 Multicast Filter table key element */ 2506 typedef struct _netc_tb_l2mcf_keye 2507 { 2508 netc_tb_l2mcf_key_type_t keyType : 4; /*!< Key Type */ 2509 uint32_t : 12; 2510 uint32_t fid : 12; /*!< Filtering ID */ 2511 uint32_t : 4; 2512 uint32_t ipv4DestAddr; /*!< IPv4 Destination Address */ 2513 uint32_t ipv4SrcAddr; /*!< IPv4 Source Address */ 2514 } netc_tb_l2mcf_keye_t; 2515 2516 /*! @brief L2 IPV4 Multicast Filter table search criteria Key Element Match Criteria */ 2517 typedef enum _etc_tb_l2mcf_sc_keye_mc 2518 { 2519 kNETC_L2MCFKeyeMacthAny = 0x0, /*!< Match any Key Element Criteria */ 2520 kNETC_L2MCFKeyeMacthFID = 0x1 /*!< Match Key Element FID */ 2521 } etc_tb_l2mcf_sc_keye_mc_t; 2522 2523 /*! @brief L2 IPV4 Multicast Filter table search criteria Configuration Element Match Criteria */ 2524 typedef enum _etc_tb_l2mcf_sc_cfge_mc 2525 { 2526 kNETC_L2MCFCfgeMacthAny = 0x0, /*!< Match any Configuration Element Criteria */ 2527 kNETC_L2MCFCfgeMacthDynamic = 0x1, /*!< Match Configuration Element dynamic field */ 2528 kNETC_L2MCFCfgeMacthPortBitmap = 0x2, /*!< Match Configuration Element portBitmap field */ 2529 kNETC_L2MCFCfgeMacthBoth = 0x3 /*!< Match both dynamic field and portBitmap */ 2530 } etc_tb_l2mcf_sc_cfge_mc_t; 2531 2532 /*! @brief FDB table search criteria Activity Element Match Criteria */ 2533 typedef enum _etc_tb_l2mcf_sc_acte_mc 2534 { 2535 kNETC_L2MCFActeMacthAny = 0x0, /*!< Match any Activity Element Criteria */ 2536 kNETC_L2MCFActeMatchExact = 0x1 /*!< Exact match with Activity Element */ 2537 } etc_tb_l2mcf_sc_acte_mc_t; 2538 2539 /*! @brief L2 IPV4 Multicast Filter table config element */ 2540 typedef netc_tb_fdb_cfge_t netc_tb_l2mcf_cfge_t; 2541 2542 /*! @brief L2 IPV4 Multicast Filter table activity lement */ 2543 typedef netc_tb_fdb_acte_t netc_tb_l2mcf_acte_t; 2544 2545 /*! @brief L2 IPV4 Multicast Filter table search criteria format */ 2546 typedef struct _etc_tb_l2mcf_search_criteria 2547 { 2548 uint32_t resumeEntryId; /*!< Resume Entry ID, pass the NULL Entry ID when starting a search */ 2549 netc_tb_l2mcf_keye_t keye; /*!< Key Element data which used to match against the table entries */ 2550 netc_tb_l2mcf_cfge_t cfge; /*!< Configuration Element data which used to match against the table entries */ 2551 struct 2552 { 2553 netc_tb_l2mcf_acte_t acte; /*!< Activity Element data which used to match against the table entries */ 2554 etc_tb_l2mcf_sc_keye_mc_t keyeMc : 1; /*!< Key Element data match criteria */ 2555 uint8_t : 7; 2556 etc_tb_l2mcf_sc_cfge_mc_t cfgeMc : 3; /*!< Configuration Element data match criteria */ 2557 uint8_t : 5; 2558 etc_tb_l2mcf_sc_acte_mc_t acteMc : 1; /*!< Activity Element data match criteria */ 2559 uint8_t : 7; 2560 }; 2561 } netc_tb_l2mcf_search_criteria_t; 2562 2563 /*! @brief L2 IPV4 Multicast Filter table request data buffer */ 2564 typedef struct _netc_tb_l2mcf_req_data 2565 { 2566 netc_tb_common_header_t commonHeader; 2567 union 2568 { 2569 uint32_t entryID; 2570 netc_tb_l2mcf_search_criteria_t sCriteria; 2571 netc_tb_l2mcf_keye_t keye; 2572 }; 2573 netc_tb_l2mcf_cfge_t cfge; 2574 } netc_tb_l2mcf_req_data_t; 2575 2576 /*! @brief L2 IPV4 Multicast Filter table request response data buffer */ 2577 typedef struct _netc_tb_l2mcf_rsp_data 2578 { 2579 uint32_t status; 2580 uint32_t entryID; 2581 netc_tb_l2mcf_keye_t keye; 2582 netc_tb_l2mcf_cfge_t cfge; 2583 netc_tb_l2mcf_acte_t acte; 2584 } netc_tb_l2mcf_rsp_data_t; 2585 2586 /*! @brief L2 IPV4 Multicast Filter table data buffer */ 2587 typedef struct _netc_tb_l2mcf_data 2588 { 2589 union 2590 { 2591 netc_tb_l2mcf_req_data_t request; 2592 netc_tb_l2mcf_rsp_data_t response; 2593 }; 2594 } netc_tb_l2mcf_data_t; 2595 2596 /*! @brief L2 IPV4 Multicast Filter table entry config */ 2597 typedef struct _netc_tb_l2mcf_config 2598 { 2599 netc_tb_l2mcf_keye_t keye; 2600 netc_tb_l2mcf_cfge_t cfge; 2601 } netc_tb_l2mcf_config_t; 2602 2603 #if !(defined(__GNUC__) || defined(__ICCARM__)) 2604 #pragma endregion L2 IPV4 Multicast Filter Table 2605 #endif 2606 2607 #if !(defined(__GNUC__) || defined(__ICCARM__)) 2608 #pragma region Ingress Sequence Generation Table 2609 #endif 2610 2611 /*! @brief Sequence Tag Type */ 2612 typedef enum _netc_tb_iseqg_sqtag 2613 { 2614 kNETC_SqDraftRTag = 1U, /*!< 802.1CB draft 2.0 R-TAG. */ 2615 kNETC_SqRTag, /*!< 802.1CB R-TAG. */ 2616 kNETC_SqHsrTag, /*!< HSR Tag. */ 2617 } netc_tb_iseqg_sqtag_t; 2618 2619 /*! @brief Ingress Sequence Generation table config element */ 2620 typedef struct _netc_tb_iseqg_cfge 2621 { 2622 netc_tb_iseqg_sqtag_t sqTag : 3; /*!< Sequence Tag Type. */ 2623 uint8_t : 5; /*!< Reserved. */ 2624 } netc_tb_iseqg_cfge_t; 2625 2626 /*! @brief Ingress Sequence Generation table Sequence generation state element */ 2627 typedef struct _netc_tb_iseqg_sgse 2628 { 2629 uint16_t sqgNum; /*!< Sequence Generation Number */ 2630 } netc_tb_iseqg_sgse_t; 2631 2632 /*! @brief Ingress Sequence Generation table request data buffer */ 2633 typedef struct _netc_tb_iseqg_req_data 2634 { 2635 netc_tb_common_header_t commonHeader; 2636 uint32_t entryID; 2637 netc_tb_iseqg_cfge_t cfge; 2638 } netc_tb_iseqg_req_data_t; 2639 2640 /*! @brief Ingress Sequence Generation table request response data buffer */ 2641 typedef struct _netc_tb_iseqg_rsp_data 2642 { 2643 uint32_t entryID; 2644 netc_tb_iseqg_cfge_t cfge; 2645 uint8_t : 8; 2646 netc_tb_iseqg_sgse_t sgse; 2647 } netc_tb_iseqg_rsp_data_t; 2648 2649 /*! @brief Ingress Sequence Generation table data buffer */ 2650 typedef struct _netc_tb_iseqg_data 2651 { 2652 union 2653 { 2654 netc_tb_iseqg_req_data_t request; 2655 netc_tb_iseqg_rsp_data_t response; 2656 }; 2657 } netc_tb_iseqg_data_t; 2658 2659 /*! @brief Ingress Sequence Generation table entry config */ 2660 typedef struct _netc_tb_iseqg_config 2661 { 2662 uint32_t entryID; 2663 netc_tb_iseqg_cfge_t cfge; 2664 } netc_tb_iseqg_config_t; 2665 2666 #if !(defined(__GNUC__) || defined(__ICCARM__)) 2667 #pragma endregion Ingress Sequence Generation Table 2668 #endif 2669 2670 #if !(defined(__GNUC__) || defined(__ICCARM__)) 2671 #pragma region Egress Sequence Recovery Table 2672 #endif 2673 /*! @brief Egress Sequence Recovery table Sequence Tag Type */ 2674 typedef enum _netc_tb_eseqr_sqtag 2675 { 2676 kNETC_AcceptAnyTag = 0U, /*!< Accept any incoming tag type (802.1CB draft 2.0 R-TAG, 802.1CB R-TAG or HSR Tag) */ 2677 kNETC_AcceptDraftRTag = 1U, /*!< 802.1CB draft 2.0 R-TAG. */ 2678 kNETC_AcceptRTag, /*!< 802.1CB R-TAG. */ 2679 kNETC_AcceptHsrTag, /*!< HSR Tag. */ 2680 } netc_tb_eseqr_sqtag_t; 2681 2682 /*! @brief Egress Sequence Recovery table config element */ 2683 typedef struct _netc_tb_eseqr_cfge 2684 { 2685 netc_tb_eseqr_sqtag_t sqTag : 3; /*!< Sequence Tag, specify the expected sequence tag type in the frame */ 2686 uint32_t sqrTnsq : 1; /*!< Sequence Recovery Take No Sequence */ 2687 uint32_t sqrAlg : 1; /*!< Sequence Recovery Algorithm, 0b = Vector algorithm, 1b = Match algorithm */ 2688 uint32_t sqrType : 1; /*!< Sequence Recovery Function type, 0b = Sequence recovery function, 1b = Individual 2689 recovery function */ 2690 uint32_t : 2; 2691 uint32_t sqrHl : 7; /*!< Sequence Recovery History Length, valid if sqrAlg = 0b */ 2692 uint32_t : 1; 2693 uint32_t sqrFwl : 12; /*!< Sequence Recovery Future Window Length, valid if sqrAlg = 0b */ 2694 uint32_t : 4; 2695 uint32_t sqrTp : 12; /*!< Sequence Timeout Period, the unit is 1.048576 milliseconds */ 2696 uint32_t : 20; 2697 } netc_tb_eseqr_cfge_t; 2698 2699 /*! @brief Egress Sequence Recovery table statistic element */ 2700 typedef struct _netc_tb_eseqr_stse 2701 { 2702 uint32_t inOrderPackets[2]; /*!< In Order Packets */ 2703 uint32_t outOfOrderPackets[2]; /*!< Out of Order Packets */ 2704 uint32_t roguePackets[2]; /*!< Rogue Packets */ 2705 uint32_t duplicatePackets[2]; /*!< Duplicate Packets */ 2706 uint32_t lostPackets[2]; /*!< Lost Packets */ 2707 uint32_t taglessPackets[2]; /*!< Tag-Less Packets */ 2708 uint32_t esqrResetCounts; /*!< Sequence Recovery Resets */ 2709 } netc_tb_eseqr_stse_t; 2710 2711 /*! @brief Egress Sequence Recovery table sequence recovery state element */ 2712 typedef struct _netc_tb_eseqr_srse 2713 { 2714 uint32_t sqrNum : 16; /*!< Sequence Recovery Number */ 2715 uint32_t takeAny : 1; /*!< Take Any */ 2716 uint32_t lce : 1; /*!< Lost Count Enable */ 2717 uint32_t sqrTs : 12; /*!< Sequence Recovery Timestamp */ 2718 uint32_t : 2; 2719 uint32_t sqrHistory[4]; /*!< Recovery History bit vector, each bit corresponding to sequence numbers, bit 1 means a 2720 packet with that sequence number has been previously received */ 2721 } netc_tb_eseqr_srse_t; 2722 2723 /*! @brief Egress Sequence Recovery table request data buffer */ 2724 typedef struct _netc_tb_eseqr_req_data 2725 { 2726 netc_tb_common_header_t commonHeader; 2727 uint32_t entryID; 2728 netc_tb_eseqr_cfge_t cfge; 2729 } netc_tb_eseqr_req_data_t; 2730 2731 /*! @brief Egress Sequence Recovery table request response data buffer */ 2732 typedef struct _netc_tb_eseqr_rsp_data 2733 { 2734 uint32_t entryID; 2735 netc_tb_eseqr_stse_t stse; 2736 netc_tb_eseqr_cfge_t cfge; 2737 netc_tb_eseqr_srse_t srse; 2738 } netc_tb_eseqr_rsp_data_t; 2739 2740 /*! @brief Egress Sequence Recovery table data buffer */ 2741 typedef struct _netc_tb_eseqr_data 2742 { 2743 union 2744 { 2745 netc_tb_eseqr_req_data_t request; 2746 netc_tb_eseqr_rsp_data_t response; 2747 }; 2748 } netc_tb_eseqr_data_t; 2749 2750 /*! @brief Egress Sequence Recovery table entry config */ 2751 typedef struct _netc_tb_eseqr_config 2752 { 2753 uint32_t entryID; 2754 netc_tb_eseqr_cfge_t cfge; 2755 } netc_tb_eseqr_config_t; 2756 2757 #if !(defined(__GNUC__) || defined(__ICCARM__)) 2758 #pragma endregion Egress Sequence Recovery Table 2759 #endif 2760 2761 #if !(defined(__GNUC__) || defined(__ICCARM__)) 2762 #pragma region Time Gate Scheduling Table 2763 #endif 2764 2765 /*! @brief Time Gate Scheduling Table maximum gate control list length (TGSTCAPR[MAX_GCL_LEN]) */ 2766 #define NETC_TB_TGS_MAX_ENTRY (0x100U) 2767 2768 /*! @brief Time Gate Scheduling table entry ID for switch and ENETC */ 2769 typedef enum _netc_tb_tgs_entry_id 2770 { 2771 kNETC_TGSSwtPort0 = 0U, /*!< Switch PORT 0 entry ID */ 2772 kNETC_TGSSwtPort1, /*!< Switch PORT 1 entry ID */ 2773 kNETC_TGSSwtPort2, /*!< Switch PORT 2 entry ID */ 2774 kNETC_TGSSwtPort3, /*!< Switch PORT 3 entry ID */ 2775 kNETC_TGSSwtPort4, /*!< Switch PORT 4 entry ID */ 2776 kNETC_TGSEnetc0Port, /*!< ENETC 0 port entry ID */ 2777 kNETC_TGSEnetc1Port /*!< ENETC 1 port entry ID */ 2778 } netc_tb_tgs_entry_id_t; 2779 2780 /*! @brief Administrative gate operation type */ 2781 typedef enum _netc_tb_tgs_gate_type 2782 { 2783 kNETC_SetGateStates = 0U, /*!< HoldRequest is unchanged */ 2784 kNETC_SetAndHoldMac, /*!< HoldRequest is set to value hold, only active when enable preemption */ 2785 kNETC_SetAndReleaseMac /*!< HoldRequest is set to value release, only active when enable preemption */ 2786 } netc_tb_tgs_gate_type_t; 2787 2788 /*! @brief Defines the Time Gate Scheduling gate control entry structure. */ 2789 typedef struct _netc_tgs_gate_entry 2790 { 2791 uint32_t interval; /*!< Entry Time Interval */ 2792 union 2793 { 2794 struct 2795 { 2796 uint32_t tcGateState : 8; /*!< Traffic Class Gate States for Gate Entry, 8 bits for 8 Traffic 2797 Class , 0b means Gate closed, 1b means Gate open */ 2798 uint32_t : 8; 2799 netc_tb_tgs_gate_type_t operType : 4; /*!< Gate operation type ( IEEE 802.1Q-2018) field for gate 2800 control list entry i */ 2801 uint32_t : 12; 2802 }; 2803 uint32_t gate; /*!< Entry Gate Mask*/ 2804 }; 2805 } netc_tgs_gate_entry_t; 2806 2807 /*! @brief Time Gate Scheduling table config element */ 2808 typedef struct _netc_tb_tgs_cfge 2809 { 2810 uint64_t adminBaseTime; /*!< Administrative Base Time */ 2811 uint32_t adminCycleTime; /*!< Administrative Cycle Time */ 2812 uint32_t adminCycleTimeExt; /*!< Administrative Cycle Time Extension */ 2813 uint32_t adminControlListLength; /*!< Administrative Control List Length */ 2814 netc_tgs_gate_entry_t adminGcl[]; /*!< Administrative Gate control list */ 2815 } netc_tb_tgs_cfge_t; 2816 2817 /*! @brief Time Gate Scheduling table statistic element */ 2818 typedef struct _netc_tb_tgs_olse 2819 { 2820 uint64_t configChangeTime; /*!< The time at which this operational gate control list became active */ 2821 uint64_t configChangeError; /*!< Count of error configuration changes */ 2822 uint64_t operBaseTime; /*!< Operational Base Time */ 2823 uint32_t operCycleTime; /*!< Operational Cycle Time */ 2824 uint32_t operCycleTimeExt; /*!< Operational Cycle Time Extension */ 2825 uint32_t operControlListLength; /*!< Operational Control List Length */ 2826 netc_tgs_gate_entry_t operGcl[]; /*!< Operational Gate control list */ 2827 } netc_tb_tgs_olse_t; 2828 2829 /*! @brief Time Gate Scheduling table request data buffer */ 2830 typedef struct _netc_tb_tgs_req_data 2831 { 2832 netc_tb_common_header_t commonHeader; 2833 netc_tb_tgs_entry_id_t entryID; 2834 netc_tb_tgs_cfge_t cfge; /*!< Present only for commands which perform a update */ 2835 } netc_tb_tgs_req_data_t; 2836 2837 #if (defined(__CC_ARM) || defined(__ARMCC_VERSION)) 2838 /* Ignore the "field with variable sized type not at the end of a struct or class" warning. */ 2839 #pragma clang diagnostic push 2840 #pragma clang diagnostic ignored "-Wgnu-variable-sized-type-not-at-end" 2841 #endif 2842 /*! @brief Time Gate Scheduling table request response data buffer */ 2843 typedef struct _netc_tb_tgs_rsp_data 2844 { 2845 uint64_t configChangeTime; 2846 uint32_t res0; 2847 uint32_t entryID; /*!< Present only for commands which perform a query */ 2848 netc_tb_tgs_cfge_t cfge; /*!< Present only for commands which perform a query */ 2849 netc_tb_tgs_olse_t olse; /*!< Present only for commands which perform a query */ 2850 } netc_tb_tgs_rsp_data_t; 2851 #if (defined(__CC_ARM) || defined(__ARMCC_VERSION)) 2852 #pragma clang diagnostic pop 2853 #endif 2854 2855 /*! @brief Time Gate Scheduling table data buffer, set with max size */ 2856 typedef struct _netc_tb_tgs_data 2857 { 2858 union 2859 { 2860 netc_tb_tgs_req_data_t request; 2861 netc_tb_tgs_rsp_data_t response; 2862 struct 2863 { 2864 uint32_t rel0[18]; 2865 netc_tgs_gate_entry_t res1[NETC_TB_TGS_MAX_ENTRY]; 2866 }; 2867 }; 2868 } netc_tb_tgs_data_t; 2869 2870 /*! @brief Time Gate Scheduling table entry gate control list structure */ 2871 typedef struct _netc_tb_tgs_gcl 2872 { 2873 netc_tb_tgs_entry_id_t entryID; 2874 uint64_t baseTime; /*!< Base Time */ 2875 uint32_t cycleTime; /*!< Cycle Time */ 2876 uint32_t extTime; /*!< Cycle Time Extension */ 2877 uint32_t numEntries; /*!< Control List entry numbers */ 2878 netc_tgs_gate_entry_t *gcList; /*!< Pointer to time gate control list array */ 2879 } netc_tb_tgs_gcl_t; 2880 2881 #if !(defined(__GNUC__) || defined(__ICCARM__)) 2882 #pragma endregion Time Gate Scheduling Table 2883 #endif 2884 2885 #if !(defined(__GNUC__) || defined(__ICCARM__)) 2886 #pragma region Egress Treatment Table 2887 #endif 2888 /*! @brief Egress Frame Modification entry mode */ 2889 typedef enum _netc_tb_et_efm_mode 2890 { 2891 kNETC_NormalMode = 0U, /*!< Egress Frame Modification entry use normal/Default mode */ 2892 kNETC_L2Act1, /*!< Egress Frame Modification entry l2Act = kNETC_UseSpecPlayload */ 2893 kNETC_PldAct1 /*!< Egress Frame Modification entry pldAct = kNETC_ReplAllEthPld */ 2894 } netc_tb_et_efm_mode_t; 2895 2896 /*! @brief Egress Sequence Actions */ 2897 typedef enum _netc_tb_et_esq_act 2898 { 2899 kNETC_NoEsqAction = 0U, /*!< No Egress Sequence Action required */ 2900 kNETC_HasEsqAction = 2U, /*!< Has Egress Sequence Recovery action */ 2901 } netc_tb_et_esq_act_t; 2902 2903 /*! @brief Egress Counter Action */ 2904 typedef enum _netc_tb_et_ec_act 2905 { 2906 kNETC_NoEcCounter = 0U, /*!< Do not increment egress frame counter */ 2907 kNETC_HasEcCounter /*!< Increment egress frame counter */ 2908 } netc_tb_et_ec_act_t; 2909 2910 /*! @brief Egress Treatment table config element */ 2911 typedef struct _netc_tb_et_cfge 2912 { 2913 netc_tb_et_efm_mode_t efmMode : 2; /*!< Egress Frame Modification mode */ 2914 uint8_t : 2; 2915 netc_tb_et_esq_act_t esqa : 2; /*!< Egress Sequence Actions */ 2916 netc_tb_et_ec_act_t eca : 2; /*!< Egress Counter Action */ 2917 uint8_t : 1; /*!< Reserve for data align */ 2918 uint8_t efmLenChange : 7; /*!< Egress Frame Modification Length Change, specified in units of bytes using a 2's 2919 complement notation */ 2920 uint16_t efmDataLen : 11; /*!< Egress Frame Modification Data Length */ 2921 uint16_t : 5; 2922 uint32_t efmEID; /*!< Egress Frame Modification Entry Id */ 2923 uint32_t ecEID; /*!< Egress Count Table Entry ID */ 2924 uint32_t esqaTgtEID; /*!< Egress Sequence Actions Target Entry ID, active when esqa = 10b */ 2925 } netc_tb_et_cfge_t; 2926 2927 /*! @brief Egress Treatment table request data buffer */ 2928 typedef struct _netc_tb_et_req_data 2929 { 2930 netc_tb_common_header_t commonHeader; 2931 uint32_t entryID; 2932 netc_tb_et_cfge_t cfge; 2933 } netc_tb_et_req_data_t; 2934 2935 /*! @brief Egress Treatment table request response data buffer */ 2936 typedef struct _netc_tb_et_rsp_data 2937 { 2938 uint32_t entryID; 2939 netc_tb_et_cfge_t cfge; 2940 } netc_tb_et_rsp_data_t; 2941 2942 /*! @brief Egress Treatment table data buffer */ 2943 typedef struct _netc_tb_et_data 2944 { 2945 union 2946 { 2947 netc_tb_et_req_data_t request; 2948 netc_tb_et_rsp_data_t response; 2949 }; 2950 } netc_tb_et_data_t; 2951 2952 /*! @brief Egress Treatment table entry config */ 2953 typedef struct _netc_tb_et_config 2954 { 2955 uint32_t entryID; 2956 netc_tb_et_cfge_t cfge; 2957 } netc_tb_et_config_t; 2958 2959 #if !(defined(__GNUC__) || defined(__ICCARM__)) 2960 #pragma endregion Egress Treatment Table 2961 #endif 2962 2963 #if !(defined(__GNUC__) || defined(__ICCARM__)) 2964 #pragma region ETM Class Queue Table 2965 #endif 2966 /*! @brief ETM Class Queue table entry ID macro, cqID is represents the Class Queue ID ,rang in 0 ~ 7, portID is Switch 2967 * ID, rang in 0 ~ 4 */ 2968 #define NETC_TB_ETM_CQ_ENTRY_ID(portID, cqID) (((uint32_t)(portID) << 4U) | ((cqID)&0x7U)) 2969 2970 /*! @brief ETM Class Queue table Update Actions */ 2971 typedef enum _netc_tb_etmcq_update_action 2972 { 2973 kNETC_CQCfgEUpdate = 0x1U, /*!< Configuration Element Update */ 2974 kNETC_CQStsEUpdate = 2975 0x2U /*!< Statistics Element Update, all counters (except FRM_CNT) within the Statistics Element are reset */ 2976 } netc_tb_etmcq_update_action_t; 2977 2978 /*! @brief ETM Class Queue table config element */ 2979 typedef struct _netc_tb_etmcq_cfge 2980 { 2981 netc_hw_etm_class_queue_idx_t cq2cgMap : 4; /*!< Class Queue to Congestion Group Mapping */ 2982 uint8_t res0 : 4; 2983 } netc_tb_etmcq_cfge_t; 2984 2985 /*! @brief ETM Class Queue table statistic element */ 2986 typedef struct _netc_tb_etmcq_stse 2987 { 2988 uint32_t rejByteCnt[2]; /*!< Reject Byte Count */ 2989 uint32_t rejFrameCnt[2]; /*!< Reject Frame Count */ 2990 uint32_t deqByteCnt[2]; /*!< Dequeue Byte Count */ 2991 uint32_t deqFrameCnt[2]; /*!< Dequeue Frame Count */ 2992 uint32_t dropByteCnt[2]; /*!< Dropped Frames, Memory Lost */ 2993 uint32_t dropFrameCnt[2]; /*!< Dropped Frames, Memory Recovered */ 2994 uint32_t frmCnt; /*!< Frame Count */ 2995 } netc_tb_etmcq_stse_t; 2996 2997 /*! @brief ETM Class Queue table request data buffer */ 2998 typedef struct _netc_tb_etmcq_req_data 2999 { 3000 netc_tb_common_header_t commonHeader; 3001 uint32_t entryID; 3002 netc_tb_etmcq_cfge_t cfge; 3003 } netc_tb_etmcq_req_data_t; 3004 3005 /*! @brief ETM Class Queue table request response data buffer */ 3006 typedef struct _netc_tb_etmcq_rsp_data 3007 { 3008 uint32_t entryID; 3009 netc_tb_etmcq_stse_t stse; 3010 netc_tb_etmcq_cfge_t cfge; 3011 } netc_tb_etmcq_rsp_data_t; 3012 3013 /*! @brief ETM Class Queue table data buffer */ 3014 typedef struct _netc_tb_etmcq_data 3015 { 3016 union 3017 { 3018 netc_tb_etmcq_req_data_t request; 3019 netc_tb_etmcq_rsp_data_t response; 3020 }; 3021 } netc_tb_etmcq_data_t; 3022 3023 /*! @brief ETM Class Queue table entry config */ 3024 typedef struct _netc_tb_etmcq_config 3025 { 3026 uint32_t entryID; /*!< Need use NETC_TB_ETM_CQ_ENTRY_ID macro to create entry ID */ 3027 netc_tb_etmcq_cfge_t cfge; 3028 } netc_tb_etmcq_config_t; 3029 3030 #if !(defined(__GNUC__) || defined(__ICCARM__)) 3031 #pragma endregion ETM Class Queue Table 3032 #endif 3033 3034 #if !(defined(__GNUC__) || defined(__ICCARM__)) 3035 #pragma region ETM Class Scheduler Table 3036 #endif 3037 3038 /*! @brief ETM Class Scheduler table entry ID */ 3039 typedef enum _netc_tb_etmcs_entry_id 3040 { 3041 kNETC_CSSwtPort0 = 0U, /*!< CS Switch PORT 0 entry ID */ 3042 kNETC_CSSwtPort1, /*!< CS Switch PORT 1 entry ID */ 3043 kNETC_CSSwtPort2, /*!< CS Switch PORT 2 entry ID */ 3044 kNETC_CSSwtPort3, /*!< CS Switch PORT 3 entry ID */ 3045 kNETC_CSSwtPort4 /*!< CS Switch PORT 4 entry ID */ 3046 } netc_tb_etmcs_entry_id_t; 3047 3048 /*! @brief ETM Class Scheduler table Class queue assignment to scheduler inputs mode */ 3049 typedef enum _netc_tb_etmcs_ca_assg 3050 { 3051 kNETC_CQ7AssignToSchedIn15 = 0U, /*!< CQ 7 assignment to scheduler input 15, means all CQ use strict priority */ 3052 kNETC_CQ7AssignToSchedIn14, /*!< CQ 7 assignment to scheduler input 14 */ 3053 kNETC_CQ7AssignToSchedIn13, /*!< CQ 7 assignment to scheduler input 13 */ 3054 kNETC_CQ7AssignToSchedIn12, /*!< CQ 7 assignment to scheduler input 12 */ 3055 kNETC_CQ7AssignToSchedIn11, /*!< CQ 7 assignment to scheduler input 11 */ 3056 kNETC_CQ7AssignToSchedIn10, /*!< CQ 7 assignment to scheduler input 10 */ 3057 kNETC_CQ7AssignToSchedIn9, /*!< CQ 7 assignment to scheduler input 9 */ 3058 kNETC_CQ7AssignToSchedIn8, /*!< CQ 7 assignment to scheduler input 8 */ 3059 kNETC_CQ7AssignToSchedIn7 /*!< CQ 7 assignment to scheduler input 7, means all CQ use weighted fair */ 3060 } netc_tb_etmcs_ca_assg_t; 3061 3062 /*! @brief ETM Class Scheduler table config element */ 3063 typedef struct _netc_tb_etmcs_cfge 3064 { 3065 netc_tb_etmcs_ca_assg_t cqAssg : 4; /*!< Class Queue Assignment, input 0 to 7 are weighted fair whereby input 8 to 3066 15 are strict priority */ 3067 uint32_t : 12; 3068 uint32_t oal : 11; /*!< Overead accounting length */ 3069 uint32_t : 5; 3070 struct 3071 { 3072 uint8_t xCode : 3; /*!< Weight code x value */ 3073 uint8_t yCode : 5; /*!< Weight code y value */ 3074 } wbfsWeight[8]; /*!< Weight for scheduler input 0 ~ 7, effective weight is: (2^x)/(1-(y/64)) */ 3075 } netc_tb_etmcs_cfge_t; 3076 3077 /*! @brief ETM Class Scheduler table request data buffer */ 3078 typedef struct _netc_tb_etmcs_req_data 3079 { 3080 netc_tb_common_header_t commonHeader; 3081 netc_tb_etmcs_entry_id_t entryID; /*!< One class scheduler entry per port */ 3082 netc_tb_etmcs_cfge_t cfge; 3083 } netc_tb_etmcs_req_data_t; 3084 3085 /*! @brief ETM Class Scheduler table request response data buffer */ 3086 typedef struct _netc_tb_etmcs_rsp_data 3087 { 3088 netc_tb_etmcs_entry_id_t entryID; 3089 netc_tb_etmcs_cfge_t cfge; 3090 } netc_tb_etmcs_rsp_data_t; 3091 3092 /*! @brief ETM Class Scheduler table data buffer */ 3093 typedef struct _netc_tb_etmcs_data 3094 { 3095 union 3096 { 3097 netc_tb_etmcs_req_data_t request; 3098 netc_tb_etmcs_rsp_data_t response; 3099 }; 3100 } netc_tb_etmcs_data_t; 3101 3102 /*! @brief ETM Class Scheduler table entry config */ 3103 typedef struct _netc_tb_etmcs_config 3104 { 3105 netc_tb_etmcs_entry_id_t entryID; /*!< One class scheduler entry per port */ 3106 netc_tb_etmcs_cfge_t cfge; 3107 } netc_tb_etmcs_config_t; 3108 3109 #if !(defined(__GNUC__) || defined(__ICCARM__)) 3110 #pragma endregion ETM Class Scheduler Table 3111 #endif 3112 3113 #if !(defined(__GNUC__) || defined(__ICCARM__)) 3114 #pragma region ETM Congestion Group Table 3115 #endif 3116 /*! @brief ETM Congestion Group table entry ID macro, cgID is represents the Congestion Group ID ,rang in 0 ~ 7, portID 3117 * is Switch ID, rang in 0 ~ 4 */ 3118 #define NETC_TB_ETM_CG_ENTRY_ID(portID, cgID) (((uint32_t)(portID) << 4U) | ((cgID)&0x7U)) 3119 3120 /*! @brief ETM Congestion Group table config element */ 3121 typedef struct _netc_tb_etmcg_cfge 3122 { 3123 uint16_t tdDr0En : 1; /*!< Tail drop enable for DR0 Frame */ 3124 uint16_t tdDr1En : 1; /*!< Tail drop enable for DR1 Frame */ 3125 uint16_t tdDr2En : 1; /*!< Tail drop enable for DR2 Frame */ 3126 uint16_t tdDr3En : 1; /*!< Tail drop enable for DR3 Frame */ 3127 uint16_t oal : 12; /*!< Overhead accounting length, 2's complement value (range -2048 to +2047) */ 3128 struct 3129 { 3130 uint16_t tn : 5; /*!< TA */ 3131 uint16_t ta : 8; /*!< Tn */ 3132 uint16_t : 3; 3133 } tdDRThresh[4]; /*!< Tail Drop Threshold (TA * 2^Tn) for DR0 ~ DR3 Frames, valid if tdDrnEn = 1b */ 3134 } netc_tb_etmcg_cfge_t; 3135 3136 /*! @brief ETM Congestion Group table statistic element */ 3137 typedef struct _netc_tb_etmcg_stse 3138 { 3139 uint32_t byteCount[2]; /*!< Number of bytes currently in use in all class queues that are members of this group. */ 3140 } netc_tb_etmcg_stse_t; 3141 3142 /*! @brief ETM Congestion Group table request data buffer */ 3143 typedef struct _netc_tb_etmcg_req_data 3144 { 3145 netc_tb_common_header_t commonHeader; 3146 uint32_t entryID; 3147 netc_tb_etmcg_cfge_t cfge; 3148 } netc_tb_etmcg_req_data_t; 3149 3150 /*! @brief ETM Congestion Group table request response data buffer */ 3151 typedef struct _netc_tb_etmcg_rsp_data 3152 { 3153 uint32_t entryID; 3154 netc_tb_etmcg_stse_t stse; 3155 netc_tb_etmcg_cfge_t cfge; 3156 } netc_tb_etmcg_rsp_data_t; 3157 3158 /*! @brief ETM Congestion Group table data buffer */ 3159 typedef struct _netc_tb_etmcg_data 3160 { 3161 union 3162 { 3163 netc_tb_etmcg_req_data_t request; 3164 netc_tb_etmcg_rsp_data_t response; 3165 }; 3166 } netc_tb_etmcg_data_t; 3167 3168 /*! @brief ETM Congestion Group table entry config */ 3169 typedef struct _netc_tb_etmcg_config 3170 { 3171 uint32_t entryID; /*!< Need use NETC_TB_ETM_CG_ENTRY_ID macro to create entry ID */ 3172 netc_tb_etmcg_cfge_t cfge; 3173 } netc_tb_etmcg_config_t; 3174 3175 #if !(defined(__GNUC__) || defined(__ICCARM__)) 3176 #pragma endregion ETM Congestion Group Table 3177 #endif 3178 3179 #if !(defined(__GNUC__) || defined(__ICCARM__)) 3180 #pragma region Egress Count Table 3181 #endif 3182 3183 /*! @brief Egress Count table statistic element */ 3184 typedef struct _netc_tb_ec_stse 3185 { 3186 uint32_t enqFrmCnt[2]; /*!< Enqueued Frame Count */ 3187 uint32_t rejFrmCnt[2]; /*!< Rejected Frame Count */ 3188 } netc_tb_ec_stse_t; 3189 3190 /*! @brief Egress Count table request data buffer */ 3191 typedef struct _netc_tb_ec_req_data 3192 { 3193 netc_tb_common_header_t commonHeader; 3194 uint32_t entryID; 3195 } netc_tb_ec_req_data_t; 3196 3197 /*! @brief Egress Count table request response data buffer */ 3198 typedef struct _netc_tb_ec_rsp_data 3199 { 3200 uint32_t entryID; 3201 netc_tb_ec_stse_t stse; 3202 } netc_tb_ec_rsp_data_t; 3203 3204 /*! @brief Egress Count table data buffer */ 3205 typedef struct _netc_tb_ec_data 3206 { 3207 union 3208 { 3209 netc_tb_ec_req_data_t request; 3210 netc_tb_ec_rsp_data_t response; 3211 }; 3212 } netc_tb_ec_data_t; 3213 3214 #if !(defined(__GNUC__) || defined(__ICCARM__)) 3215 #pragma endregion Egress Count Table 3216 #endif 3217 3218 #if !(defined(__GNUC__) || defined(__ICCARM__)) 3219 #pragma region Buffer Pool Table 3220 #endif 3221 3222 /*! @brief Buffer pool and shared buffer pool threshold macro, the threshold = MANT*2^EXP, uint is internal memory words 3223 * (avergae of 20 bytes each) */ 3224 #define NETC_TB_BP_THRESH(mant, exp) (((uint32_t)((mant)&0xFF) << 4U) | ((exp)&0xF)) 3225 3226 /*! @brief Buffer Pool Flow Control (FC) Configuration */ 3227 typedef enum _netc_tb_bp_fc_cfg 3228 { 3229 kNETC_FlowCtrlDisable = 0U, /*!< Flow Control disabled */ 3230 kNETC_FlowCtrlWithBP, /*!< Flow Control enabled using only buffer pool FC state. */ 3231 kNETC_FlowCtrlWithSBP, /*!< Flow Control enabled using only shared buffer pool FC state. */ 3232 kNETC_FlowCtrlWithBPAndSBP /*!< Flow Control enabled using both buffer pool and shared buffer pool FC state, only 3233 both 1 trigger the Flow Control ON */ 3234 } netc_tb_bp_fc_cfg_t; 3235 3236 /*! @brief Buffer Pool table config element */ 3237 typedef struct _netc_tb_bp_cfge 3238 { 3239 bool sbpEn : 1; /*!< Shared Buffer Pool Enable, set true measn a shared buffer pool is associated with this buffer 3240 pool */ 3241 netc_tb_bp_fc_cfg_t gcCfg : 2; /*!< Flow Control (FC) Configuration */ 3242 uint8_t : 5; 3243 uint8_t pfcVector; /*!< Priority Flow Control (PFC) Vector, not support in NETC 3.0 and 3.1 version */ 3244 uint16_t maxThresh : 12; /*!< Maximum Threshold, value 0 means disable maximum threshold checking, use 3245 NETC_TB_BP_THRESH macro to set this value */ 3246 uint16_t : 4; 3247 uint16_t fcOnThresh : 12; /*!< Flow Control On Threshold, If the buffer pool usage crosses this threshold, and if 3248 fcOnThresh is greater than fcOffThresh, the flow control state of the buffer pool 3249 is set to 1, use NETC_TB_BP_THRESH macro to set this value. */ 3250 uint16_t : 4; 3251 uint16_t fcOffThresh : 12; /*!< Flow Control Off Threshold, If buffer pool usage drops to this threshold or below, 3252 the flow control state of the buffer pool is set to 0, , use NETC_TB_BP_THRESH 3253 macro to set this value */ 3254 uint16_t : 4; 3255 uint32_t sbpThresh : 12; /*!< Shared Buffer Pool Threshold, use NETC_TB_BP_THRESH macro to set this value */ 3256 uint32_t : 20; 3257 uint32_t sbpEid; /*!< Shared Buffer Pool Entry ID, valid if sbpEn is true */ 3258 uint32_t fcPorts; /*!< Flow Control Port bitmap, indicates which ports are to be flow controlled for this 3259 buffer pool */ 3260 } netc_tb_bp_cfge_t; 3261 3262 /*! @brief Buffer Pool table State Element Data*/ 3263 typedef struct _netc_tb_bp_bpse 3264 { 3265 uint32_t amountUsed; /*!< Amount Used, number of internal memory words (average of 20 bytes each) currently in use 3266 in this buffer pool. */ 3267 uint32_t amountUsedHWM; /*!< Amount Used High Watermark, value sticks at the highest AMOUNT_USED seen since the last 3268 watermark reset */ 3269 uint32_t fcState : 1; /*!< Flow Control (FC) State, ON (1) or OFF (0) */ 3270 uint32_t bpd : 1; /*!< Buffer Pool Disabled, 1 means the buffer pool has been disabled due to an uncorrectable ECC 3271 error */ 3272 uint32_t : 30; 3273 } netc_tb_bp_bpse_t; 3274 3275 /*! @brief Buffer Pool table request data buffer */ 3276 typedef struct _netc_tb_bp_req_data 3277 { 3278 netc_tb_common_header_t commonHeader; 3279 uint32_t entryID; 3280 netc_tb_bp_cfge_t cfge; 3281 } netc_tb_bp_req_data_t; 3282 3283 /*! @brief Buffer Pool table request response data buffer */ 3284 typedef struct _netc_tb_bp_rsp_data 3285 { 3286 uint32_t entryID; 3287 netc_tb_bp_bpse_t bpse; 3288 netc_tb_bp_cfge_t cfge; 3289 } netc_tb_bp_rsp_data_t; 3290 3291 /*! @brief Buffer Pool table data buffer */ 3292 typedef struct _netc_tb_bp_data 3293 { 3294 union 3295 { 3296 netc_tb_bp_req_data_t request; 3297 netc_tb_bp_rsp_data_t response; 3298 }; 3299 } netc_tb_bp_data_t; 3300 3301 /*! @brief Buffer Pool table entry config */ 3302 typedef struct _netc_tb_bp_config 3303 { 3304 uint32_t entryID; /*!< Buffer pool ID, range in 0 ~ (SWT_GetBPTableEntryNum() - 1) */ 3305 netc_tb_bp_cfge_t cfge; /*!< Buffer Pool table config element */ 3306 } netc_tb_bp_config_t; 3307 3308 #if !(defined(__GNUC__) || defined(__ICCARM__)) 3309 #pragma endregion Buffer Pool Table 3310 #endif 3311 3312 #if !(defined(__GNUC__) || defined(__ICCARM__)) 3313 #pragma region Shared Buffer Pool Table 3314 #endif 3315 /*! @brief Shared Buffer Pool table config element */ 3316 typedef struct _netc_tb_sbp_cfge 3317 { 3318 uint32_t : 16; 3319 uint32_t maxThresh : 12; /*!< Maximum Threshold, If shared buffer pool usage is greater than or equal to this 3320 threshold, use NETC_TB_BP_THRESH macro to set this value */ 3321 uint32_t : 4; 3322 uint16_t fcOnThresh : 12; /*!< Flow Control On Threshold, If the shared buffer pool usage crosses this threshold, 3323 and if fcOnThresh is greater than fcOffThresh, the flow control state of the buffer pool 3324 is set to 1, use NETC_TB_BP_THRESH macro to set this value. */ 3325 uint16_t : 4; 3326 uint16_t fcOffThresh : 12; /*!< Flow Control Off Threshold, If shared buffer pool usage drops to this threshold or 3327 below, the flow control state of the buffer pool is set to 0, use NETC_TB_BP_THRESH 3328 macro to set this value */ 3329 uint16_t : 4; 3330 } netc_tb_sbp_cfge_t; 3331 3332 /*! @brief Shared Buffer Pool table State Element Data*/ 3333 typedef struct _netc_tb_sbp_sbpse 3334 { 3335 uint32_t amountUsed; /*!< Amount Used, number of internal memory words (average of 20 bytes each) currently in use 3336 in this buffer pool. */ 3337 uint32_t amountUsedHWM; /*!< Amount Used High Watermark, value sticks at the highest AMOUNT_USED seen since the last 3338 watermark reset */ 3339 uint32_t fcState : 1; /*!< Flow Control (FC) State, ON (1) or OFF (0) */ 3340 uint32_t : 31; 3341 } netc_tb_sbp_sbpse_t; 3342 3343 /*! @brief Shared Buffer Pool table request data buffer */ 3344 typedef struct _netc_tb_sbp_req_data 3345 { 3346 netc_tb_common_header_t commonHeader; 3347 uint32_t entryID; 3348 netc_tb_sbp_cfge_t cfge; 3349 } netc_tb_sbp_req_data_t; 3350 3351 /*! @brief Shared Buffer Pool table request response data buffer */ 3352 typedef struct _netc_tb_sbp_rsp_data 3353 { 3354 uint32_t entryID; 3355 netc_tb_sbp_sbpse_t sbpse; 3356 netc_tb_sbp_cfge_t cfge; 3357 } netc_tb_sbp_rsp_data_t; 3358 3359 /*! @brief Shared Buffer Pool table data buffer */ 3360 typedef struct _netc_tb_sbp_data 3361 { 3362 union 3363 { 3364 netc_tb_sbp_req_data_t request; 3365 netc_tb_sbp_rsp_data_t response; 3366 }; 3367 } netc_tb_sbp_data_t; 3368 3369 /*! @brief Shared Buffer Pool table entry config */ 3370 typedef struct _netc_tb_sbp_config 3371 { 3372 uint32_t entryID; /*!< Shared Buffer pool ID, range in 0 ~ (SWT_GetSBPTableEntryNum() - 1) */ 3373 netc_tb_sbp_cfge_t cfge; /*!< Shared Buffer Pool table config element */ 3374 } netc_tb_sbp_config_t; 3375 3376 #if !(defined(__GNUC__) || defined(__ICCARM__)) 3377 #pragma endregion Shared Buffer Pool Table 3378 #endif 3379 3380 /*! @brief Table common data buffer */ 3381 typedef union _netc_tb_data_buffer 3382 { 3383 netc_tb_tgs_data_t tgs; /*!< Time Gate Scheduling table data buffer */ 3384 netc_tb_rp_data_t rp; /*!< Rate Policer table data buffer */ 3385 netc_tb_ipf_data_t ipf; /*!< Ingress Port filter table data buffer */ 3386 netc_tb_fdb_data_t fdb; /*!< FDB table data buffer */ 3387 netc_tb_l2mcf_data_t l2mcf; /*!< L2 IPV4 Multicast Filter table data buffer */ 3388 netc_tb_vf_data_t vf; /*!< VLAN Filter table data buffer */ 3389 netc_tb_isi_data_t isi; /*!< Ingress Stream Identification table data buffer */ 3390 netc_tb_is_data_t is; /*!< Ingress Stream table data buffer */ 3391 netc_tb_isf_data_t isf; /*!< Ingress Stream Filter table data buffer */ 3392 netc_tb_isc_data_t isc; /*!< Ingress Stream Count table data buffer */ 3393 netc_tb_sgi_data_t sgi; /*!< Stream Gate Instance table data buffer */ 3394 netc_tb_sgcl_data_t sgcl; /*!< Stream Gate Control List table data buffer */ 3395 netc_tb_fm_data_t fm; /*!< Frame Modification table data buffer */ 3396 netc_tb_fmd_data_t fmd; /*!< Frame Modification Data table data buffer */ 3397 netc_tb_et_data_t et; /*!< Egress Treatment table data buffer */ 3398 netc_tb_ec_data_t ec; /*!< Egress Count table data buffer */ 3399 netc_tb_etmcq_data_t cq; /*!< ETM Class Queue table data buffer */ 3400 netc_tb_etmcs_data_t cs; /*!< ETM Class Scheduler table data buffer */ 3401 netc_tb_etmcg_data_t cg; /*!< ETM Class Group table data buffer */ 3402 netc_tb_iseqg_data_t iseqg; /*!< Ingress Sequence Generation table data buffer */ 3403 netc_tb_eseqr_data_t eseqr; /*!< Egress Sequence Recovery table data buffer */ 3404 netc_tb_bp_data_t bp; /*!< Buffer Pool table data buffer */ 3405 netc_tb_sbp_data_t sbp; /*!< Shared Buffer Pool table data buffer */ 3406 } netc_tb_data_buffer_t; 3407 3408 /*! @} */ // end of netc_hw_table 3409 #if !(defined(__GNUC__) || defined(__ICCARM__)) 3410 #pragma endregion netc_hw_table 3411 #endif 3412 3413 #if !(defined(__GNUC__) || defined(__ICCARM__)) 3414 #pragma region netc_hw_si 3415 #endif 3416 /*! @addtogroup netc_hw_si 3417 * @{ 3418 */ 3419 /*! @brief Macro to cover VLAN PCP, DEI value to internal used pcpDei value. */ 3420 #define NETC_VLAN_PCP_DEI_VALUE(pcp, dei) (((uint8_t)((pcp)&0x7U) << 1U) | ((dei)&0x1U)) 3421 3422 /*! @brief VLAN Ethertypes. */ 3423 typedef enum _netc_hw_enetc_si_vlan_type 3424 { 3425 kNETC_ENETC_StanCVlan = 0x1U, /*!< Standard C-VLAN 0x8100. */ 3426 kNETC_ENETC_StanSVlan = 0x2U, /*!< Standard S-VLAN 0x88A8. */ 3427 kNETC_ENETC_CustomVlan1 = 0x4U, /*!< Custom VLAN as defined by CVLANR1[ETYPE]. */ 3428 kNETC_ENETC_CustomVlan2 = 0x8U /*!< Custom VLAN as defined by CVLANR2[ETYPE]. */ 3429 } netc_hw_enetc_si_vlan_type; 3430 3431 /*! @brief SI receive BD ring group index. */ 3432 typedef enum _netc_hw_enetc_si_rxr_group 3433 { 3434 kNETC_SiBDRGroupOne = 0U, /*!< SI Rx BD ring group index one. */ 3435 kNETC_SiBDRGroupTwo /*!< SI Rx BD ring group index two. */ 3436 } netc_hw_enetc_si_rxr_group; 3437 3438 /*! 3439 * @brief Station Interface configuration. 3440 * 3441 */ 3442 typedef struct _netc_hw_enetc_si_config 3443 { 3444 uint32_t bandWeight : 4; /*!< Station interface traffic class bandwidth weight */ 3445 uint32_t vlanCtrl : 4; /*!< VLAN Ethertypes can be inserted by the SI driver, set with OR of @ref 3446 netc_hw_enetc_si_vlan_type. */ 3447 uint32_t antiSpoofEnable : 1; /*!< Anti-spoofing enable */ 3448 uint32_t vlanInsertEnable : 1; /*!< Software SI-based VLAN Insertion enable, avtive when enSIBaseVlan is true */ 3449 uint32_t vlanExtractEnable : 1; /*!< SI-based VLAN removed from frame enable, avtive when enSIBaseVlan is true */ 3450 uint32_t sourcePruneEnable : 1; /*!< Source pruning enable */ 3451 uint32_t rxRingUse : 7; /*!< Number of Rx Rings to be used, when enable Rx ring group, this equal to the sum of all 3452 Rx group rings. */ 3453 uint32_t txRingUse : 7; /*!< Number of Tx Rings to be used, note that when SI is Switch management ENETC SI, the 3454 number not include Tx ring 0. */ 3455 uint32_t valnToIpvEnable : 1; /*!< Enable the VLAN PCP/DEI value (use NETC_VLAN_PCP_DEI_VALUE marco) to internal 3456 priority value mapping. */ 3457 uint32_t rxBdrGroupNum : 2; /*!< Rx BD ring group number, range in 0 ~ 2. */ 3458 uint32_t ringPerBdrGroup : 3; /*!< The ring number in every Rx BD ring group, range in 1 ~ 8, active when 3459 rxBdrGroupNum not equal zero. */ 3460 netc_hw_enetc_si_rxr_group 3461 defaultRxBdrGroup; /*!< The selected Rx BD ring group, active when rxBdrGroupNum not equal zero. */ 3462 3463 uint8_t vlanToIpvMap[16]; /*!< Frame VLAN pcp|dei to IPV mapping, active when valnToIpvEnable is true. */ 3464 uint8_t ipvToRingMap[8]; /*!< BD ring used within the default Rx BD ring group for IPV n, active when rxBdrGroupNum 3465 not equal zero. */ 3466 uint8_t vsiTcToTC[8]; /*!< Maps the VSI traffic class to transmit traffic class, done after the ENETC txPrio to TC 3467 mapping, only available for VSI. */ 3468 bool enSIBaseVlan; /*!< Enable use SI-based VLAN information. */ 3469 netc_enetc_vlan_tag_t siBaseVlan; /*!< SI-based VLAN information, active when enSIBaseVlan is true. */ 3470 } netc_hw_enetc_si_config_t; 3471 3472 /*! @brief L2 Mac Filter Configuration for SI. */ 3473 typedef struct _netc_si_l2mf_config 3474 { 3475 bool macUCPromis; /*!< Enable/Disable MAC unicast promiscuous. */ 3476 bool macMCPromis; /*!< Enable/Disable MAC multicast promiscuous. */ 3477 bool rejectUC; /*!< Reject Unicast. */ 3478 bool rejectMC; /*!< Reject Multicast. */ 3479 bool rejectBC; /*!< Reject Broadcast. */ 3480 } netc_si_l2mf_config_t; 3481 3482 /*! @brief L2 VLAN Filter Configuration for SI. */ 3483 typedef struct _netc_si_l2vf_config 3484 { 3485 bool acceptUntagged; /*!< Accept/Reject untagged frame. */ 3486 bool enPromis; /*!< Enable/Disable VLAN promiscuous. */ 3487 bool useOuterVlanTag; /*!< Use outer/inner VLAN tag for filtering. */ 3488 } netc_si_l2vf_config_t; 3489 3490 /*! @brief SI frame drop statistic struct. */ 3491 typedef struct _netc_si_discard_statistic 3492 { 3493 uint32_t programError; /*!< Due to programming error ( non-existing BD ring or non-existing group, or SI disabled or 3494 BD ring disabled). */ 3495 uint32_t busError; /*!< Due to system bus error. */ 3496 uint32_t lackBD[14]; /*!< Due to lack of Rx BDs available. */ 3497 } netc_si_discard_statistic_t; 3498 3499 /*! @brief SI traffic statistic struct. */ 3500 typedef struct _netc_si_traffic_statistic 3501 { 3502 uint64_t rxOctet; 3503 uint64_t rxFrame; 3504 uint64_t rxFrameUnicast; 3505 uint64_t rxFrameMulticast; 3506 uint64_t txOctet; 3507 uint64_t txFrame; 3508 uint64_t txFrameUnicast; 3509 uint64_t txFrameMulticast; 3510 } netc_si_traffic_statistic_t; 3511 3512 /*! @brief SI Configuration. */ 3513 typedef struct _netc_si_config 3514 { 3515 uint32_t tcBWWeight; /*!< SI traffic class bandwidth weight. */ 3516 } netc_si_config_t; 3517 3518 /*! 3519 * @brief Transmit Buffer Descriptor format. 3520 * 3521 * A union type cover the BD used as Standard/Extended/WriteBack format. 3522 */ 3523 3524 typedef union _netc_tx_bd 3525 { 3526 struct 3527 { 3528 uint64_t addr; /*!< Address of the buffer. Little Endian. */ 3529 uint16_t bufLen; /*!< Length of buffer specifying effective number of bytes. */ 3530 uint16_t frameLen; /*!< Length of Frame. */ 3531 uint32_t flags : 29; /*!< Flags qualified setting. */ 3532 uint32_t enableInterrupt : 1; /*!< Whether enable interrupt on complete of BD. */ 3533 uint32_t isExtended : 1; /*!< Extended BD format flag. */ 3534 uint32_t isFinal : 1; /*!< Final BD flag. */ 3535 } standard; 3536 struct 3537 { 3538 uint32_t timestamp : 30; /*!< IEEE1588 PTP one-step timestamp. */ 3539 uint32_t : 2; /*!< Ignore 2-bit MSB. */ 3540 uint16_t : 14; 3541 uint16_t tpid : 2; /*!< VLAN TPID type, see @ref netc_vlan_tpid_select_t. */ 3542 uint16_t vid : 12; /*!< VLAN ID. */ 3543 uint16_t dei : 1; /*!< VLAN DEI. */ 3544 uint16_t pcp : 3; /*!< VLAN PCP. */ 3545 uint32_t : 32; 3546 uint16_t : 16; 3547 uint8_t eFlags; /*!< Tx extension flags. */ 3548 uint8_t : 7; 3549 uint8_t isFinal : 1; /*!< Final BD flag. */ 3550 } ext; 3551 struct 3552 { 3553 uint32_t timestamp; /*!< Timestamp write back. */ 3554 uint32_t txtsid : 16; /*!/ Transmit timestamp identifier, only active on Switch management ENETC. */ 3555 uint32_t : 16; 3556 uint32_t : 32; 3557 uint32_t : 16; 3558 uint32_t status : 9; /*!< Status. */ 3559 uint32_t : 1; 3560 uint32_t written : 1; /*!< Write-back flag. */ 3561 uint32_t : 5; 3562 } writeback; 3563 } netc_tx_bd_t; 3564 3565 /*! 3566 * @brief Receive Buffer Descriptor format. 3567 * 3568 */ 3569 typedef union _netc_rx_bd 3570 { 3571 struct 3572 { 3573 uint64_t addr; /*!< Software write address. */ 3574 uint64_t : 64; 3575 } standard; 3576 struct 3577 { 3578 uint16_t internetChecksum; /*!< Internet Checksum. */ 3579 uint16_t parserSummary; /*!< Parser Summary. */ 3580 union 3581 { 3582 struct 3583 { 3584 uint32_t srcPort : 5; /*!< Source port received from switch management port. */ 3585 uint32_t : 3; 3586 uint32_t rssHash : 24; /*!< RSS Hash high field value. */ 3587 }; 3588 uint32_t rssHashSwt; /*!< RSS hash while not used as switch management port. */ 3589 }; 3590 uint16_t bufLen; /*!< Length of received buffer. */ 3591 uint16_t vid : 12; /*!< VLAN ID. */ 3592 uint16_t dei : 1; /*!< VLAN DEI. */ 3593 uint16_t pcp : 3; /*!< VLAN PCP. */ 3594 uint8_t tpid : 2; /*!< VLAN TPID. */ 3595 uint8_t hr : 4; /*!< Host Reason. */ 3596 uint8_t : 2; 3597 uint8_t flags; /*!< Rx information flags. */ 3598 uint8_t error; /*!< Rx error code. */ 3599 uint8_t : 6; 3600 uint8_t isReady : 1; /*!< Received data ready flag. */ 3601 uint8_t isFinal : 1; /*!< Final BD flag. */ 3602 } writeback; 3603 struct 3604 { 3605 uint32_t timestamp; /*!< Rx Timestamp. */ 3606 uint32_t : 32; 3607 uint64_t : 64; 3608 } ext; 3609 struct 3610 { 3611 uint32_t timestamp; /*!< Switch response timestamp. */ 3612 uint32_t : 32; 3613 uint16_t txtsid; /*!< Transmit timestamp identifier. */ 3614 uint16_t : 16; 3615 uint32_t : 2; 3616 uint32_t hr : 4; /*!< Host Reason. */ 3617 uint32_t : 10; 3618 uint32_t error : 8; 3619 uint32_t : 6; 3620 uint32_t isReady : 1; /*!< Received data ready flag. */ 3621 uint32_t isFinal : 1; /*!< Final BD flag. */ 3622 } resp; 3623 } netc_rx_bd_t; 3624 3625 /*! @brief Configuration for the SI Tx Buffer Descriptor Ring Configuration. */ 3626 typedef struct _netc_tx_bdr_config 3627 { 3628 uint32_t len; /*!< Size of BD ring which shall be multiple of 8 BD. */ 3629 netc_tx_bd_t *bdArray; /*!< BDR base address which shall be 128 bytes aligned. */ 3630 netc_tx_frame_info_t *dirtyArray; /*!< Tx cleanup ring. */ 3631 // Interrupt 3632 bool enIntr; /*!< Enable/Disable completion interrupt. */ 3633 bool enThresIntr; /*!< Enable/Disable threshold interrupt. */ 3634 bool enCoalIntr; /*!< Enable/Disable interrupt coalescing. */ 3635 uint32_t intrThreshold; /*!< Interrupt coalescing packet threshold. */ 3636 uint32_t intrTimerThres; /*!< Interrupt coalescing timer threshold, specified in NETC clock cycles. */ 3637 uint8_t msixEntryIdx; /*!< MSIX entry index of Tx ring interrupt. */ 3638 // Configure 3639 bool isVlanInsert; /*!< Enable/Disable VLAN insert offload. */ 3640 bool isUserCRC; /*!< Enable/Disable user provided the CRC32 - FCS at end of frame. */ 3641 uint8_t wrrWeight; /*!< Weight used for arbitration when rings have same priority. */ 3642 uint8_t priority; /*!< Priority of the Tx BDR. */ 3643 } netc_tx_bdr_config_t; 3644 3645 /*! @brief Transmit BD ring handler data structure. */ 3646 typedef struct _netc_tx_bdr 3647 { 3648 netc_tx_bd_t *bdBase; /*!< Tx BDR base address. */ 3649 netc_tx_frame_info_t *dirtyBase; /*!< Tx cleanup ring base address. */ 3650 uint16_t producerIndex; /*!< Current index for transmit. */ 3651 uint16_t cleanIndex; /*!< Current index for tx cleaning. */ 3652 uint32_t len; /*!< Length of this BD ring. */ 3653 } netc_tx_bdr_t; 3654 3655 /*! @brief Status/Interrupts flags for the TX BDR. Each flag get its own bit thus it support bit AND/OR operation. */ 3656 typedef enum _netc_tx_bdr_flags 3657 { 3658 kNETC_TxBDRSystemBusErrorFlag = 0x1, 3659 kNETC_TxBDRBusyFlag = 0x1 << 1U, 3660 kNETC_TxBDRStatusFlagsMask = kNETC_TxBDRBusyFlag | kNETC_TxBDRBusyFlag, 3661 // TODO, Append the interrupt flags 3662 } netc_tx_bdr_flags_t; 3663 3664 /*! @brief Configuration for the SI Rx Buffer Descriptor Ring Configuration. */ 3665 typedef struct _netc_rx_bdr_config 3666 { 3667 // Descriptor data structure 3668 bool extendDescEn; /*!< False - Use 16Bytes standard BD. True - Use 32Bytes extended BD. */ 3669 netc_rx_bd_t *bdArray; /*!< BD ring base address which shall be 128 bytes aligned. */ 3670 uint32_t len; /*!< BD ring length in the unit of 16Bytes standard BD. Shall be multiple of 8/16 for 3671 standard/exteneded BD. */ 3672 uint64_t *buffAddrArray; /*!< Rx buffers array with BD length(half of BD length if use exteneded BD). */ 3673 uint16_t buffSize; /*!< Size of all Rx buffers in this BD ring. */ 3674 // Interrupt 3675 bool enThresIntr; /*!< Enable/Disable threshold interrupt. */ 3676 bool enCoalIntr; /*!< Enable/Disable interrupt coalescing. */ 3677 uint32_t intrThreshold; /*!< Interrupt coalescing packet threshold. */ 3678 uint32_t intrTimerThres; /*!< Interrupt coalescing timer threshold, specified in NETC clock cycles. */ 3679 uint8_t msixEntryIdx; /*!< MSIX entry index of Rx ring interrupt. */ 3680 // Ring configuration 3681 bool disVlanPresent; /*!< Disable/Enable VLAN in BD. */ 3682 bool enVlanExtract; /*!< Enable/Disable VLAN extract. */ 3683 bool isKeepCRC; /*!< Whether user provided the CRC32 - FCS at end of frame. */ 3684 bool congestionMode; /*!< False - lossy. True - lossless. */ 3685 bool enHeaderAlign; /*!< Enable/disable +2B alignment to frame. */ 3686 } netc_rx_bdr_config_t; 3687 3688 /*! @brief Receive BD ring handler data structure. */ 3689 typedef struct _netc_rx_bdr 3690 { 3691 netc_rx_bd_t *bdBase; /*!< Rx BDR base address. */ 3692 bool extendDesc; /*!< Use extended buffer descriptor. */ 3693 uint16_t index; /*!< Current index for read. */ 3694 uint32_t len; /*!< Length of this BD ring, unit of 16Bytes standard BD. */ 3695 uint64_t *buffArray; /*!< Rx buffers array of this ring. */ 3696 uint32_t buffSize; /*!< Rx buffers size for all BDs in this ring. */ 3697 } netc_rx_bdr_t; 3698 3699 /*! @brief Status/Interrupts flags for the RX BDR. Each flag get its own bit thus it support bit AND/OR operation. */ 3700 typedef enum _netc_rx_bdr_flags 3701 { 3702 kNETC_RxBDRSystemBusErrorFlag = 0x1, 3703 kNETC_RxBDREmptyFlag = 0x1 << 1U, 3704 // TODO, Append the interrupts flags 3705 } netc_rx_bdr_flags_t; 3706 3707 /*! @brief Configuration for the buffer descriptors ring */ 3708 typedef struct _netc_bdr_config 3709 { 3710 netc_rx_bdr_config_t *rxBdrConfig; /*!< Receive buffer ring configuration array. */ 3711 netc_tx_bdr_config_t *txBdrConfig; /*!< Transmit buffer ring configuration array. */ 3712 } netc_bdr_config_t; 3713 3714 /*! 3715 * @brief PSI message interrupt type. 3716 */ 3717 typedef enum _netc_psi_msg_flags_t 3718 { 3719 kNETC_PsiRxMsgFromVsi1Flag = 0x2, /*!< Message receive interrupt enable, initiated by VSI1. */ 3720 kNETC_PsiRxMsgFromVsi2Flag = 0x4, /*!< Message receive interrupt enable, initiated by VSI2. */ 3721 kNETC_PsiFLRFromVsi1Flag = 0x20000, /*!< Function level reset interrupt enable, initiated by VSI1. */ 3722 } netc_psi_msg_flags_t; 3723 3724 /*! 3725 * @brief VSI message interrupt flags. 3726 */ 3727 typedef enum _netc_vsi_msg_flags 3728 { 3729 kNETC_VsiMsgTxFlag = 0x1, /*!< Message sent to PSI has completed and response received. */ 3730 kNETC_VsiMsgRxFlag = 0x1 << 1U, /*!< Message received from PSI. */ 3731 } netc_vsi_msg_flags_t; 3732 3733 /*! 3734 * @brief VSI number bit map, VSI1 starts from bit1. 3735 */ 3736 typedef enum _netc_vsi_number 3737 { 3738 kNETC_Vsi1 = 0x1 << 1U, 3739 kNETC_Vsi2 = 0x1 << 2U, 3740 /* Reserved for multiple VSIs. */ 3741 } netc_vsi_number_t; 3742 3743 /*! 3744 * @brief PSI receive message information 3745 */ 3746 typedef struct _netc_psi_rx_msg 3747 { 3748 uint8_t *msgBuff; /*!< The buffer address application set before receiving message. */ 3749 uint32_t msgLen; /*!< Received message length. */ 3750 } netc_psi_rx_msg_t; 3751 3752 /*! 3753 * @brief VSI message transmit status 3754 */ 3755 typedef struct _netc_vsi_msg_tx_status 3756 { 3757 bool txBusy; /*!< The VSI Tx busy flag, become idle when the PSI receive and clear the related status. */ 3758 bool isTxErr; /*!< Tx error flag. */ 3759 uint16_t msgCode; /*!< The error code or user-defined content. */ 3760 } netc_vsi_msg_tx_status_t; 3761 3762 /*! @} */ // end of netc_hw_si 3763 #if !(defined(__GNUC__) || defined(__ICCARM__)) 3764 #pragma endregion netc_hw_si 3765 #endif 3766 3767 #if !(defined(__GNUC__) || defined(__ICCARM__)) 3768 #pragma region netc_hw_switch 3769 #endif 3770 /*! @addtogroup netc_hw_switch 3771 * @{ 3772 */ 3773 /*! @brief The switch port bitmap */ 3774 typedef enum _netc_swt_port_bitmap 3775 { 3776 kNETC_SWTPort0Bit = 0x1U, /*!< Switch port0 bitmap */ 3777 kNETC_SWTPort1Bit = 0x2U, /*!< Switch port1 bitmap */ 3778 kNETC_SWTPort2Bit = 0x4U, /*!< Switch port2 bitmap */ 3779 kNETC_SWTPort3Bit = 0x8U, /*!< Switch port3 bitmap */ 3780 kNETC_SWTPort4Bit = 0x10U, /*!< Switch port4 (internal port) bitmap */ 3781 } netc_swt_port_bitmap_t; 3782 /*! @brief The switch ingress mirror destination port */ 3783 typedef enum _netc_swt_imr_dest_port 3784 { 3785 kNETC_SWTPort0 = 0U, /*!< Switch port0 */ 3786 kNETC_SWTPort1 = 1U, /*!< Switch port1 */ 3787 kNETC_SWTPort2 = 2U, /*!< Switch port2 */ 3788 kNETC_SWTPort3 = 3U, /*!< Switch port3 */ 3789 kNETC_SWTPort4 = 4U, /*!< Switch port4 */ 3790 kNETC_SWTMPort = 5U /*!< Switch management port */ 3791 } netc_swt_imr_dest_port_t; 3792 3793 /*! @brief The switch MAC forwarding options */ 3794 typedef enum _netc_swt_mac_forward_mode 3795 { 3796 kNETC_NoFDBLookUp = 1U, /*!< No FDB lookup is performed, the frame is flooded. */ 3797 kNETC_FDBLookUpWithFlood = 2U, /*!< FDB lookup is performed, and if there is no match, the frame is flooded to the 3798 port bitmap in VLAN filter entry. */ 3799 kNETC_FDBLookUpWithDiscard = 3U, /*!< FDB lookup is performed, and if there is no match, the frame is discarded. */ 3800 } netc_swt_mac_forward_mode_t; 3801 3802 /*! @brief The switch MAC learning options */ 3803 typedef enum _netc_swt_mac_learn_mode 3804 { 3805 kNETC_DisableMACLearn = 1U, /*!< Disable MAC learning. SMAC FDB lookup is by-passed. */ 3806 kNETC_HardwareMACLearn, /*!< Hardware MAC learning is enabled. */ 3807 kNETC_SeSoftwareMACLearn, /*!< Software MAC learning secure. FDB lookup based on FID and SMAC is performed and if an 3808 entry is not found, the frame is redirected to the switch management port. */ 3809 kNETC_UnseSoftwareMACLearn, /*!< Software MAC learning unsecure. FDB lookup based on FID and SMAC is performed and 3810 if an entry is not found, the frame is copied to the switch management port. */ 3811 kNETC_DisableMACLearnWithSMAC /*!< Disable MAC learning with SMAC validation. FDB lookup based on FID and SMAC is 3812 performed and if an entry is not found, the frame is discarded. */ 3813 } netc_swt_mac_learn_mode_t; 3814 3815 /*! @brief Switch transmit Bridge Port VLAN Tag Action */ 3816 typedef enum _netc_swt_port_tx_vlan_act 3817 { 3818 kNETC_NoTxVlanModify = 0U, /*!< No egress VLAN modification performed */ 3819 kNETC_TxDelOuterVlan, /*!< Delete outer VLAN tag */ 3820 kNETC_TxReplOuterVlanVid /*!< Replace outer VLAN tag's VID with 0; frame to be transmitted as a priority tag frame 3821 */ 3822 } netc_swt_port_tx_vlan_act_t; 3823 3824 /*! @brief Switch port spanning tree group work mode */ 3825 typedef enum _netc_swt_port_stg_mode 3826 { 3827 kNETC_DiscardFrame = 0U, /*!< Tx or RX Frames on this port with current spanning tree group ID will be discarded */ 3828 kNETC_LearnWithoutFowrad, /*!< RX Frames on this port with current spanning tree group ID will do Learn SMAC, but do 3829 not forward, Tx Frame will be discarded */ 3830 kNETC_ForwardFrame /*!< RX Frames on this port with current spanning tree group ID will do both MAC learning and 3831 forwarding, , Tx Frame will be forwarded. */ 3832 } netc_swt_port_stg_mode_t; 3833 3834 /*! @brief Switch Ingress mirror destination config */ 3835 typedef struct _etc_swt_imr_config 3836 { 3837 bool enMirror; /*!< Enable ingress mirroring */ 3838 netc_swt_imr_dest_port_t destPort; /*!< Port where ingress mirrored frames are sent */ 3839 uint8_t dr; /*!< Mirrored packet's DR (drop resilience) */ 3840 uint8_t ipv; /*!< Mirrored packet's IPV (internal priority value) */ 3841 uint8_t efmLengthChange; /*!< Egress Frame Modification Frame Length change in 2s complement notation, Vaild if 3842 efmEntryID is noy null */ 3843 uint16_t efmEntryID; /*!< Egress Frame Modification Entry Id, note 0xFFFF is a Null Frame Modification Entry, Only 3844 applicable if destPort != kNETC_SWTMPort */ 3845 } netc_swt_imr_config_t; 3846 3847 /*! @brief Switch port bridge configuration */ 3848 typedef struct _netc_swt_port_config 3849 { 3850 netc_swt_port_tx_vlan_act_t 3851 txVlanAction : 2; /*!< Only applies for the frame outer VLAN tag's VID is equal to the port default VID */ 3852 bool isRxVlanAware : 1; /*!< Receive VLAN Aware Mode */ 3853 bool acceptUntag : 1; /*!< Accept untagged frame */ 3854 bool acceptPriorityTag : 1; /*!< Accept priority tagged frame (VID = 0) */ 3855 bool acceptSingleTag : 1; /*!< Accept single tagged frame */ 3856 bool acceptDoubleTag : 1; /*!< Accept double tagged frame (ounter and inner) */ 3857 struct 3858 { 3859 uint32_t : 15; 3860 uint32_t vid : 12; /*!< Vlan Identifier. */ 3861 uint32_t dei : 1; /*!< Drop eligible indicator */ 3862 uint32_t pcp : 3; /*!< Priority code point. */ 3863 uint32_t tpid : 1; /*!< Tag protocol identifier, 0 = Standard C-VLAN 0x8100, 1 = Standard S-VLAN 0x88A8. */ 3864 } defaultVlan; 3865 netc_swt_port_stg_mode_t 3866 stgMode[16]; /* Port spanning tree protocol state for spanning tree protocol group 0 ~ 15 */ 3867 bool enSrcPortPrun : 1; /*!< Enable/Disable received frame be transmitted to same port it was received */ 3868 bool enMacStationMove : 1; /*!< Enable/Disable received frame which ingress port not match the FDB entry Destination 3869 Port Bitmap */ 3870 bool enBcastStormCtrl : 1; /*!< Enable/Disable Storm control for broadcast frames */ 3871 bool enMcastStormCtrl : 1; /*!< Enable/Disable Storm control for multicast frames */ 3872 bool enUnMcastStormCtrl : 1; /*!< Enable/Disable Storm control for unknown multicast frames */ 3873 bool enUnUcastStormCtrl : 1; /*!< Enable/Disable Storm control for unknown unicast frames */ 3874 uint32_t bcastRpEntryID; /*!< Broadcast rate policer entry ID. Valid if enBroadStormCtrl = true */ 3875 uint32_t mcastEntryID; /*!< Known multicast rate policer entry ID. Valid if enBroadStormCtrl = true */ 3876 uint32_t unMcastRpEntryID; /*!< Unknown multicast policer entry ID. Valid if enUnMultiStormCtrl = true */ 3877 uint32_t unUcastRpEntryID; /*!< Unknown unicast rate policer entry ID. Valid if enUnUniStormCtrl = true */ 3878 uint16_t maxDynaFDBEntry; /*!< The maximium number of dynamic entries in the FDB table, 0 means no limit */ 3879 } netc_swt_port_bridge_config_t; 3880 3881 /*! @brief Switch Port level Frame Modification configuration (PPCPDEIMR and PQOSMR[QVMP])*/ 3882 typedef struct _netc_swt_port_fm_config 3883 { 3884 bool ignoreFMMiscfg : 1; /*!< Enable/Disable ignore the Frame Modification Misconfiguration Action */ 3885 bool enEgressPcpMap : 1; /*!< Enable egress frame modification of outer VLAN tag's PCP value is mapped to a new 3886 value based on egressPcpMap, used for Frame Modification VLAN Outer PCP action */ 3887 bool enIngressPcpMap : 1; /*!< Enable ingress frame modification of outer VLAN tag's PCP value is mapped to a 3888 new value based on egressPcpMap, used for Frame Modification VLAN Outer PCP action */ 3889 bool enUpdateVlanDei : 1; /*!< Enable update DR value in the outer VLAN based on DEnDEI field, used for egress 3890 Frame Modification Outer DEI action */ 3891 uint8_t drToDeiMap : 4; /*!< Mapping of internal QoS's DR value n to VLAN DEI, The 4 bits correspond to the DR3 ~ 3892 DR0, and 1 means DRn mapping to DEI 1, 0 means DRn mapping to DEI 0 */ 3893 uint8_t egressPcpMap : 4; /*!< Egress PCP to PCP Mapping Profile instance, active when enEgressPcpMap is true */ 3894 uint8_t ingressPcpMap : 4; /*!< Ingress PCP to PCP Mapping Profile instance, active when enIngressPcpMap is true */ 3895 uint8_t qosVlanMap : 4; /*!< Transmit QoS to VLAN PCP Mapping Profile index, used for egress Frame Modification VLAN 3896 Add/Replace Action */ 3897 } netc_swt_port_fm_config_t; 3898 3899 /*! @brief Switch VLAN filter hash table default entry configuration, which determines the default entry when not found 3900 * in VLAN filter lookup */ 3901 typedef struct _netc_swt_default_vlan_filter 3902 { 3903 bool enIPMFlood; /*!< Enable IP Multicast Flooding */ 3904 bool enIPMFilter; /*!< Enable IP Multicast Filtering */ 3905 uint8_t stgID; /*!< Spanning Tree Group Member ID, range in 0 ~ 15 */ 3906 uint8_t portMembership; /*!< The bit 0 ~ 4 correspond to the 5 ports, When bit set (0b1), means the port is a member 3907 of this VLAN. Port membership is used for source/destination pruning */ 3908 bool enUseFilterID; /*!< Enable use the specified filterID as FID, otherwise will use the frame VID */ 3909 uint16_t filterID; /*!< Used as a key value to do FDB table and the L2 IPV4 Multicast Filter table lookup. Valid if 3910 enUseFilterID is true */ 3911 netc_swt_mac_forward_mode_t mfo; /*!< MAC forwarding options */ 3912 netc_swt_mac_learn_mode_t mlo; /*!< MAC learning options */ 3913 uint16_t baseETEID; /*!< Base Egress Treatment Entry ID */ 3914 uint8_t etaPortBitmap; /*!< Egress Treatment Applicability Port. Valid if baseETEID is not null. */ 3915 } netc_swt_default_vlan_filter_t; 3916 3917 /*! @brief Bridge config */ 3918 typedef struct _netc_swt_bridge_config 3919 { 3920 netc_swt_default_vlan_filter_t 3921 dVFCfg; /*!< Default VLAN filter entry configuration when not found in VLAN filter lookup */ 3922 } netc_swt_bridge_config_t; 3923 3924 /*! @brief Switch PSFP configuration */ 3925 typedef struct _netc_swt_psfp_config 3926 { 3927 netc_isi_kc_rule_t kcRule[4]; /*!< Key construction rules */ 3928 } netc_swt_psfp_config_t; 3929 3930 /*! @brief Switch Qos Classification configuration (include two profiles) */ 3931 typedef struct _netc_qos_classify_config 3932 { 3933 netc_qos_classify_profile_t profiles[2]; 3934 } netc_swt_qos_classify_config_t; 3935 3936 /*! @brief Switch QoS to PCP mapping and PCP to PCP mapping configuration when egress packet modification the VLAN tag 3937 */ 3938 typedef struct _netc_swt_qos_to_vlan_config 3939 { 3940 struct fsl_netc 3941 { 3942 uint8_t qos[32]; /*!< Index is created from IPV (3 bits) + DR (2 bits) field. Value is the mapped PCP for VLAN 3943 tag. */ 3944 uint8_t pcp[8]; /*!< Index is created from outer PCP (3 bits) field. Value is the mapped PCP for VLAN tag. */ 3945 } profiles[2]; 3946 } netc_swt_qos_to_vlan_config_t; 3947 3948 /*! @brief Switch static/dynamic FDB entries in-use statistic */ 3949 typedef struct _netc_switch_inuse_fdb_statistic 3950 { 3951 uint16_t camEntries; /*!< Number of FDB entries in-use in the CAM. */ 3952 uint16_t staticEntries; /*!< Number of static FDB entries in-use (both hash-based and CAM-based entries). */ 3953 uint16_t dynamicEntries; /*!< Number of dynamic FDB entries in-use (hash-based and CAM-based entries). */ 3954 uint16_t dynamicEntriesHWM; /*!< High water mark of dynamic entries in-use in the FDB table. */ 3955 } netc_switch_inuse_fdb_statistic_t; 3956 3957 /*! @} */ // end of netc_hw_switch 3958 #if !(defined(__GNUC__) || defined(__ICCARM__)) 3959 #pragma endregion netc_hw_switch 3960 #endif 3961 3962 #if defined(__cplusplus) 3963 extern "C" { 3964 #endif 3965 3966 /******************************************************************************* 3967 * API 3968 ******************************************************************************/ 3969 3970 #if defined(__cplusplus) 3971 } 3972 #endif 3973 #endif /* FSL_NETC_H_ */ 3974