1f752780fSAkhil Goyal /* SPDX-License-Identifier: BSD-3-Clause 2f752780fSAkhil Goyal * Copyright(C) 2023 Marvell. 3f752780fSAkhil Goyal */ 4f752780fSAkhil Goyal 5f752780fSAkhil Goyal #ifndef ROC_MCS_H 6f752780fSAkhil Goyal #define ROC_MCS_H 7f752780fSAkhil Goyal 8f752780fSAkhil Goyal #define MCS_AES_GCM_256_KEYLEN 32 9f752780fSAkhil Goyal 10e410eb58SAnkur Dwivedi #define ROC_MCS_MAX_AR_WINSZ BIT_ULL(31) 11e410eb58SAnkur Dwivedi #define ROC_MCS_MAX_MTU (BIT_ULL(16) - 1) 12e410eb58SAnkur Dwivedi 132211ef84SAkhil Goyal struct roc_mcs_alloc_rsrc_req { 142211ef84SAkhil Goyal uint8_t rsrc_type; 152211ef84SAkhil Goyal uint8_t rsrc_cnt; /* Resources count */ 162211ef84SAkhil Goyal uint8_t dir; /* Macsec ingress or egress side */ 172211ef84SAkhil Goyal uint8_t all; /* Allocate all resource type one each */ 182211ef84SAkhil Goyal }; 192211ef84SAkhil Goyal 202211ef84SAkhil Goyal struct roc_mcs_alloc_rsrc_rsp { 212211ef84SAkhil Goyal uint8_t flow_ids[128]; /* Index of reserved entries */ 222211ef84SAkhil Goyal uint8_t secy_ids[128]; 232211ef84SAkhil Goyal uint8_t sc_ids[128]; 242211ef84SAkhil Goyal uint8_t sa_ids[256]; 252211ef84SAkhil Goyal uint8_t rsrc_type; 262211ef84SAkhil Goyal uint8_t rsrc_cnt; /* No of entries reserved */ 272211ef84SAkhil Goyal uint8_t dir; 282211ef84SAkhil Goyal uint8_t all; 292211ef84SAkhil Goyal }; 302211ef84SAkhil Goyal 312211ef84SAkhil Goyal struct roc_mcs_free_rsrc_req { 322211ef84SAkhil Goyal uint8_t rsrc_id; /* Index of the entry to be freed */ 332211ef84SAkhil Goyal uint8_t rsrc_type; 342211ef84SAkhil Goyal uint8_t dir; 352211ef84SAkhil Goyal uint8_t all; /* Free all the cam resources */ 362211ef84SAkhil Goyal }; 372211ef84SAkhil Goyal 38ee71a3b2SAkhil Goyal struct roc_mcs_flowid_entry_write_req { 39ee71a3b2SAkhil Goyal uint64_t data[4]; 40ee71a3b2SAkhil Goyal uint64_t mask[4]; 41ee71a3b2SAkhil Goyal uint64_t sci; /* 105N for tx_secy_mem_map */ 42ee71a3b2SAkhil Goyal uint8_t flow_id; 43ee71a3b2SAkhil Goyal uint8_t secy_id; /* secyid for which flowid is mapped */ 44ee71a3b2SAkhil Goyal uint8_t sc_id; /* Valid if dir = MCS_TX, SC_CAM id mapped to flowid */ 45ee71a3b2SAkhil Goyal uint8_t ena; /* Enable tcam entry */ 46ee71a3b2SAkhil Goyal uint8_t ctr_pkt; 47ee71a3b2SAkhil Goyal uint8_t dir; 48ee71a3b2SAkhil Goyal }; 49ee71a3b2SAkhil Goyal 50ee71a3b2SAkhil Goyal struct roc_mcs_secy_plcy_write_req { 51ee71a3b2SAkhil Goyal uint64_t plcy; 52ee71a3b2SAkhil Goyal uint8_t secy_id; 53ee71a3b2SAkhil Goyal uint8_t dir; 54ee71a3b2SAkhil Goyal }; 55ee71a3b2SAkhil Goyal 56f4bf4780SAkhil Goyal /* RX SC_CAM mapping */ 57f4bf4780SAkhil Goyal struct roc_mcs_rx_sc_cam_write_req { 58f4bf4780SAkhil Goyal uint64_t sci; /* SCI */ 59f4bf4780SAkhil Goyal uint64_t secy_id; /* secy index mapped to SC */ 60f4bf4780SAkhil Goyal uint8_t sc_id; /* SC CAM entry index */ 61f4bf4780SAkhil Goyal }; 622211ef84SAkhil Goyal 632211ef84SAkhil Goyal struct roc_mcs_sa_plcy_write_req { 642211ef84SAkhil Goyal uint64_t plcy[2][9]; 652211ef84SAkhil Goyal uint8_t sa_index[2]; 662211ef84SAkhil Goyal uint8_t sa_cnt; 672211ef84SAkhil Goyal uint8_t dir; 682211ef84SAkhil Goyal }; 692211ef84SAkhil Goyal 70f4bf4780SAkhil Goyal struct roc_mcs_tx_sc_sa_map { 71f4bf4780SAkhil Goyal uint8_t sa_index0; 72f4bf4780SAkhil Goyal uint8_t sa_index1; 73f4bf4780SAkhil Goyal uint8_t rekey_ena; 74f4bf4780SAkhil Goyal uint8_t sa_index0_vld; 75f4bf4780SAkhil Goyal uint8_t sa_index1_vld; 76f4bf4780SAkhil Goyal uint8_t tx_sa_active; 77f4bf4780SAkhil Goyal uint64_t sectag_sci; 78f4bf4780SAkhil Goyal uint8_t sc_id; /* used as index for SA_MEM_MAP */ 79f4bf4780SAkhil Goyal }; 80f4bf4780SAkhil Goyal 81f4bf4780SAkhil Goyal struct roc_mcs_rx_sc_sa_map { 82f4bf4780SAkhil Goyal uint8_t sa_index; 83f4bf4780SAkhil Goyal uint8_t sa_in_use; 84f4bf4780SAkhil Goyal uint8_t sc_id; 85f4bf4780SAkhil Goyal uint8_t an; /* value range 0-3, sc_id + an used as index SA_MEM_MAP */ 86f4bf4780SAkhil Goyal }; 87f4bf4780SAkhil Goyal 88ee71a3b2SAkhil Goyal struct roc_mcs_flowid_ena_dis_entry { 89ee71a3b2SAkhil Goyal uint8_t flow_id; 90ee71a3b2SAkhil Goyal uint8_t ena; 91ee71a3b2SAkhil Goyal uint8_t dir; 92ee71a3b2SAkhil Goyal }; 93ee71a3b2SAkhil Goyal 94e4a6ea54SAkhil Goyal struct roc_mcs_pn_table_write_req { 95e4a6ea54SAkhil Goyal uint64_t next_pn; 96e4a6ea54SAkhil Goyal uint8_t pn_id; 97e4a6ea54SAkhil Goyal uint8_t dir; 98e4a6ea54SAkhil Goyal }; 99e4a6ea54SAkhil Goyal 100e4a6ea54SAkhil Goyal struct roc_mcs_cam_entry_read_req { 101e4a6ea54SAkhil Goyal uint8_t rsrc_type; /* TCAM/SECY/SC/SA/PN */ 102e4a6ea54SAkhil Goyal uint8_t rsrc_id; 103e4a6ea54SAkhil Goyal uint8_t dir; 104e4a6ea54SAkhil Goyal }; 105e4a6ea54SAkhil Goyal 106e4a6ea54SAkhil Goyal struct roc_mcs_cam_entry_read_rsp { 107e4a6ea54SAkhil Goyal uint64_t reg_val[10]; 108e4a6ea54SAkhil Goyal uint8_t rsrc_type; 109e4a6ea54SAkhil Goyal uint8_t rsrc_id; 110e4a6ea54SAkhil Goyal uint8_t dir; 111e4a6ea54SAkhil Goyal }; 112e4a6ea54SAkhil Goyal 113f752780fSAkhil Goyal struct roc_mcs_hw_info { 114f752780fSAkhil Goyal uint8_t num_mcs_blks; /* Number of MCS blocks */ 115f752780fSAkhil Goyal uint8_t tcam_entries; /* RX/TX Tcam entries per mcs block */ 116f752780fSAkhil Goyal uint8_t secy_entries; /* RX/TX SECY entries per mcs block */ 117f752780fSAkhil Goyal uint8_t sc_entries; /* RX/TX SC CAM entries per mcs block */ 118f752780fSAkhil Goyal uint16_t sa_entries; /* PN table entries = SA entries */ 119f752780fSAkhil Goyal uint64_t rsvd[16]; 120f752780fSAkhil Goyal }; 121f752780fSAkhil Goyal 122c26d94f2SAkhil Goyal #define ROC_MCS_CPM_RX_SECTAG_V_EQ1_INT BIT_ULL(0) 123c26d94f2SAkhil Goyal #define ROC_MCS_CPM_RX_SECTAG_E_EQ0_C_EQ1_INT BIT_ULL(1) 124c26d94f2SAkhil Goyal #define ROC_MCS_CPM_RX_SECTAG_SL_GTE48_INT BIT_ULL(2) 125c26d94f2SAkhil Goyal #define ROC_MCS_CPM_RX_SECTAG_ES_EQ1_SC_EQ1_INT BIT_ULL(3) 126c26d94f2SAkhil Goyal #define ROC_MCS_CPM_RX_SECTAG_SC_EQ1_SCB_EQ1_INT BIT_ULL(4) 127c26d94f2SAkhil Goyal #define ROC_MCS_CPM_RX_PACKET_XPN_EQ0_INT BIT_ULL(5) 128c26d94f2SAkhil Goyal #define ROC_MCS_CPM_RX_PN_THRESH_REACHED_INT BIT_ULL(6) 129c26d94f2SAkhil Goyal #define ROC_MCS_CPM_TX_PACKET_XPN_EQ0_INT BIT_ULL(7) 130c26d94f2SAkhil Goyal #define ROC_MCS_CPM_TX_PN_THRESH_REACHED_INT BIT_ULL(8) 131c26d94f2SAkhil Goyal #define ROC_MCS_CPM_TX_SA_NOT_VALID_INT BIT_ULL(9) 132c26d94f2SAkhil Goyal #define ROC_MCS_BBE_RX_DFIFO_OVERFLOW_INT BIT_ULL(10) 133c26d94f2SAkhil Goyal #define ROC_MCS_BBE_RX_PLFIFO_OVERFLOW_INT BIT_ULL(11) 134c26d94f2SAkhil Goyal #define ROC_MCS_BBE_TX_DFIFO_OVERFLOW_INT BIT_ULL(12) 135c26d94f2SAkhil Goyal #define ROC_MCS_BBE_TX_PLFIFO_OVERFLOW_INT BIT_ULL(13) 136c26d94f2SAkhil Goyal #define ROC_MCS_PAB_RX_CHAN_OVERFLOW_INT BIT_ULL(14) 137c26d94f2SAkhil Goyal #define ROC_MCS_PAB_TX_CHAN_OVERFLOW_INT BIT_ULL(15) 138c26d94f2SAkhil Goyal 139c26d94f2SAkhil Goyal struct roc_mcs_intr_cfg { 140c26d94f2SAkhil Goyal uint64_t intr_mask; /* Interrupt enable mask */ 141c26d94f2SAkhil Goyal }; 142c26d94f2SAkhil Goyal 143c26d94f2SAkhil Goyal struct roc_mcs_intr_info { 144c26d94f2SAkhil Goyal uint64_t intr_mask; 145c26d94f2SAkhil Goyal int sa_id; 146c26d94f2SAkhil Goyal uint8_t lmac_id; 147c26d94f2SAkhil Goyal uint64_t rsvd; 148c26d94f2SAkhil Goyal }; 149c26d94f2SAkhil Goyal 150e4a6ea54SAkhil Goyal struct roc_mcs_set_lmac_mode { 151e4a6ea54SAkhil Goyal uint8_t mode; /* '1' for internal bypass mode (passthrough), '0' for MCS processing */ 152e4a6ea54SAkhil Goyal uint8_t lmac_id; 153e4a6ea54SAkhil Goyal uint64_t rsvd; 154e4a6ea54SAkhil Goyal }; 155e4a6ea54SAkhil Goyal 156e4a6ea54SAkhil Goyal struct roc_mcs_set_active_lmac { 157e4a6ea54SAkhil Goyal uint32_t lmac_bmap; /* bitmap of active lmac per mcs block */ 158e4a6ea54SAkhil Goyal uint16_t channel_base; /* MCS channel base */ 159e4a6ea54SAkhil Goyal uint64_t rsvd; 160e4a6ea54SAkhil Goyal }; 161e4a6ea54SAkhil Goyal 162e4a6ea54SAkhil Goyal struct roc_mcs_set_pn_threshold { 163e4a6ea54SAkhil Goyal uint64_t threshold; 164e4a6ea54SAkhil Goyal uint8_t xpn; /* '1' for setting xpn threshold */ 165e4a6ea54SAkhil Goyal uint8_t dir; 166e4a6ea54SAkhil Goyal uint64_t rsvd; 167e4a6ea54SAkhil Goyal }; 168f752780fSAkhil Goyal 1692b1dbc07SAkhil Goyal enum roc_mcs_ctrl_pkt_rule_type { 1702b1dbc07SAkhil Goyal ROC_MCS_CTRL_PKT_RULE_TYPE_ETH, 1712b1dbc07SAkhil Goyal ROC_MCS_CTRL_PKT_RULE_TYPE_DA, 1722b1dbc07SAkhil Goyal ROC_MCS_CTRL_PKT_RULE_TYPE_RANGE, 1732b1dbc07SAkhil Goyal ROC_MCS_CTRL_PKT_RULE_TYPE_COMBO, 1742b1dbc07SAkhil Goyal ROC_MCS_CTRL_PKT_RULE_TYPE_MAC, 1752b1dbc07SAkhil Goyal }; 1762b1dbc07SAkhil Goyal 1772b1dbc07SAkhil Goyal struct roc_mcs_alloc_ctrl_pkt_rule_req { 1782b1dbc07SAkhil Goyal uint8_t rule_type; 1792b1dbc07SAkhil Goyal uint8_t dir; /* Macsec ingress or egress side */ 1802b1dbc07SAkhil Goyal uint64_t rsvd; 1812b1dbc07SAkhil Goyal }; 1822b1dbc07SAkhil Goyal 1832b1dbc07SAkhil Goyal struct roc_mcs_alloc_ctrl_pkt_rule_rsp { 1842b1dbc07SAkhil Goyal uint8_t rule_idx; 1852b1dbc07SAkhil Goyal uint8_t rule_type; 1862b1dbc07SAkhil Goyal uint8_t dir; 1872b1dbc07SAkhil Goyal uint64_t rsvd; 1882b1dbc07SAkhil Goyal }; 1892b1dbc07SAkhil Goyal 1902b1dbc07SAkhil Goyal struct roc_mcs_free_ctrl_pkt_rule_req { 1912b1dbc07SAkhil Goyal uint8_t rule_idx; 1922b1dbc07SAkhil Goyal uint8_t rule_type; 1932b1dbc07SAkhil Goyal uint8_t dir; 1942b1dbc07SAkhil Goyal uint8_t all; /* Free all the rule resources */ 1952b1dbc07SAkhil Goyal uint64_t rsvd; 1962b1dbc07SAkhil Goyal }; 1972b1dbc07SAkhil Goyal 1982b1dbc07SAkhil Goyal struct roc_mcs_ctrl_pkt_rule_write_req { 1992b1dbc07SAkhil Goyal uint64_t data0; 2002b1dbc07SAkhil Goyal uint64_t data1; 2012b1dbc07SAkhil Goyal uint64_t data2; 2022b1dbc07SAkhil Goyal uint8_t rule_idx; 2032b1dbc07SAkhil Goyal uint8_t rule_type; 2042b1dbc07SAkhil Goyal uint8_t dir; 2052b1dbc07SAkhil Goyal uint64_t rsvd; 2062b1dbc07SAkhil Goyal }; 2072b1dbc07SAkhil Goyal 208f0a0d0ceSAkhil Goyal struct roc_mcs_port_cfg_set_req { 209f0a0d0ceSAkhil Goyal /* Index of custom tag (= cstm_indx[x] in roc_mcs_custom_tag_cfg_get_rsp struct) to use 210f0a0d0ceSAkhil Goyal * when TX SECY_PLCY_MEMX[SECTAG_INSERT_MODE] = 0 (relative offset mode) 211f0a0d0ceSAkhil Goyal */ 212f0a0d0ceSAkhil Goyal uint8_t cstm_tag_rel_mode_sel; 213f0a0d0ceSAkhil Goyal /* In ingress path, custom_hdr_enb = 1 when the port is expected to receive pkts 214f0a0d0ceSAkhil Goyal * that have 8B custom header before DMAC 215f0a0d0ceSAkhil Goyal */ 216f0a0d0ceSAkhil Goyal uint8_t custom_hdr_enb; 217f0a0d0ceSAkhil Goyal /* Valid fifo skid values are 14,28,56 for 25G,50G,100G respectively 218f0a0d0ceSAkhil Goyal * FIFOs need to be configured based on the port_mode, valid only for 105N 219f0a0d0ceSAkhil Goyal */ 220f0a0d0ceSAkhil Goyal uint8_t fifo_skid; 221f0a0d0ceSAkhil Goyal uint8_t port_mode; /* 2'b00 - 25G or less, 2'b01 - 50G, 2'b10 - 100G */ 222f0a0d0ceSAkhil Goyal uint8_t port_id; 223f0a0d0ceSAkhil Goyal uint64_t rsvd; 224f0a0d0ceSAkhil Goyal }; 225f0a0d0ceSAkhil Goyal 226f0a0d0ceSAkhil Goyal struct roc_mcs_port_cfg_get_req { 227f0a0d0ceSAkhil Goyal uint8_t port_id; 228f0a0d0ceSAkhil Goyal uint64_t rsvd; 229f0a0d0ceSAkhil Goyal }; 230f0a0d0ceSAkhil Goyal 231f0a0d0ceSAkhil Goyal struct roc_mcs_port_cfg_get_rsp { 232f0a0d0ceSAkhil Goyal uint8_t cstm_tag_rel_mode_sel; 233f0a0d0ceSAkhil Goyal uint8_t custom_hdr_enb; 234f0a0d0ceSAkhil Goyal uint8_t fifo_skid; 235f0a0d0ceSAkhil Goyal uint8_t port_mode; 236f0a0d0ceSAkhil Goyal uint8_t port_id; 237f0a0d0ceSAkhil Goyal uint64_t rsvd; 238f0a0d0ceSAkhil Goyal }; 239f0a0d0ceSAkhil Goyal 2402b1dbc07SAkhil Goyal struct roc_mcs_custom_tag_cfg_get_req { 2412b1dbc07SAkhil Goyal uint8_t dir; 2422b1dbc07SAkhil Goyal uint64_t rsvd; 2432b1dbc07SAkhil Goyal }; 2442b1dbc07SAkhil Goyal 2452b1dbc07SAkhil Goyal struct roc_mcs_custom_tag_cfg_get_rsp { 2462b1dbc07SAkhil Goyal uint16_t cstm_etype[8]; /* EthType/TPID */ 2472b1dbc07SAkhil Goyal uint8_t cstm_indx[8]; /* Custom tag index used to identify the VLAN etype */ 2482b1dbc07SAkhil Goyal uint8_t cstm_etype_en; /* bitmap of enabled custom tags */ 2492b1dbc07SAkhil Goyal uint8_t dir; 2502b1dbc07SAkhil Goyal uint64_t rsvd; 2512b1dbc07SAkhil Goyal }; 2522b1dbc07SAkhil Goyal 253f0a0d0ceSAkhil Goyal struct roc_mcs_port_reset_req { 254f0a0d0ceSAkhil Goyal uint8_t port_id; 255f0a0d0ceSAkhil Goyal uint64_t rsvd; 256f0a0d0ceSAkhil Goyal }; 257f0a0d0ceSAkhil Goyal 258bd8d7755SAkhil Goyal struct roc_mcs_stats_req { 259bd8d7755SAkhil Goyal uint8_t id; 260bd8d7755SAkhil Goyal uint8_t dir; 261bd8d7755SAkhil Goyal }; 262bd8d7755SAkhil Goyal 263bd8d7755SAkhil Goyal struct roc_mcs_flowid_stats { 264bd8d7755SAkhil Goyal uint64_t tcam_hit_cnt; 265bd8d7755SAkhil Goyal }; 266bd8d7755SAkhil Goyal 267bd8d7755SAkhil Goyal struct roc_mcs_secy_stats { 268bd8d7755SAkhil Goyal uint64_t ctl_pkt_bcast_cnt; 269bd8d7755SAkhil Goyal uint64_t ctl_pkt_mcast_cnt; 270bd8d7755SAkhil Goyal uint64_t ctl_pkt_ucast_cnt; 271bd8d7755SAkhil Goyal uint64_t ctl_octet_cnt; 272bd8d7755SAkhil Goyal uint64_t unctl_pkt_bcast_cnt; 273bd8d7755SAkhil Goyal uint64_t unctl_pkt_mcast_cnt; 274bd8d7755SAkhil Goyal uint64_t unctl_pkt_ucast_cnt; 275bd8d7755SAkhil Goyal uint64_t unctl_octet_cnt; 276bd8d7755SAkhil Goyal /* Valid only for RX */ 277bd8d7755SAkhil Goyal uint64_t octet_decrypted_cnt; 278bd8d7755SAkhil Goyal uint64_t octet_validated_cnt; 279bd8d7755SAkhil Goyal uint64_t pkt_port_disabled_cnt; 280bd8d7755SAkhil Goyal uint64_t pkt_badtag_cnt; 281bd8d7755SAkhil Goyal uint64_t pkt_nosa_cnt; 282bd8d7755SAkhil Goyal uint64_t pkt_nosaerror_cnt; 283bd8d7755SAkhil Goyal uint64_t pkt_tagged_ctl_cnt; 284bd8d7755SAkhil Goyal uint64_t pkt_untaged_cnt; 285bd8d7755SAkhil Goyal uint64_t pkt_ctl_cnt; /* CN10K-B */ 286bd8d7755SAkhil Goyal uint64_t pkt_notag_cnt; /* CNF10K-B */ 287bd8d7755SAkhil Goyal /* Valid only for TX */ 288bd8d7755SAkhil Goyal uint64_t octet_encrypted_cnt; 289bd8d7755SAkhil Goyal uint64_t octet_protected_cnt; 290bd8d7755SAkhil Goyal uint64_t pkt_noactivesa_cnt; 291bd8d7755SAkhil Goyal uint64_t pkt_toolong_cnt; 292bd8d7755SAkhil Goyal uint64_t pkt_untagged_cnt; 293bd8d7755SAkhil Goyal }; 294bd8d7755SAkhil Goyal 295bd8d7755SAkhil Goyal struct roc_mcs_sc_stats { 296bd8d7755SAkhil Goyal /* RX */ 297bd8d7755SAkhil Goyal uint64_t hit_cnt; 298bd8d7755SAkhil Goyal uint64_t pkt_invalid_cnt; 299bd8d7755SAkhil Goyal uint64_t pkt_late_cnt; 300bd8d7755SAkhil Goyal uint64_t pkt_notvalid_cnt; 301bd8d7755SAkhil Goyal uint64_t pkt_unchecked_cnt; 302bd8d7755SAkhil Goyal uint64_t pkt_delay_cnt; /* CNF10K-B */ 303bd8d7755SAkhil Goyal uint64_t pkt_ok_cnt; /* CNF10K-B */ 304bd8d7755SAkhil Goyal uint64_t octet_decrypt_cnt; /* CN10K-B */ 305bd8d7755SAkhil Goyal uint64_t octet_validate_cnt; /* CN10K-B */ 306bd8d7755SAkhil Goyal /* TX */ 307bd8d7755SAkhil Goyal uint64_t pkt_encrypt_cnt; 308bd8d7755SAkhil Goyal uint64_t pkt_protected_cnt; 309bd8d7755SAkhil Goyal uint64_t octet_encrypt_cnt; /* CN10K-B */ 310bd8d7755SAkhil Goyal uint64_t octet_protected_cnt; /* CN10K-B */ 311bd8d7755SAkhil Goyal }; 312bd8d7755SAkhil Goyal 313bd8d7755SAkhil Goyal struct roc_mcs_port_stats { 314bd8d7755SAkhil Goyal uint64_t tcam_miss_cnt; 315bd8d7755SAkhil Goyal uint64_t parser_err_cnt; 316bd8d7755SAkhil Goyal uint64_t preempt_err_cnt; /* CNF10K-B */ 317bd8d7755SAkhil Goyal uint64_t sectag_insert_err_cnt; 318bd8d7755SAkhil Goyal }; 319bd8d7755SAkhil Goyal 320bd8d7755SAkhil Goyal struct roc_mcs_clear_stats { 321bd8d7755SAkhil Goyal uint8_t type; /* FLOWID, SECY, SC, SA, PORT */ 322bd8d7755SAkhil Goyal /* type = PORT, If id = FF(invalid) port no is derived from pcifunc */ 323bd8d7755SAkhil Goyal uint8_t id; 324bd8d7755SAkhil Goyal uint8_t dir; 325bd8d7755SAkhil Goyal uint8_t all; /* All resources stats mapped to PF are cleared */ 326bd8d7755SAkhil Goyal }; 327bd8d7755SAkhil Goyal 328c26d94f2SAkhil Goyal enum roc_mcs_event_subtype { 329c26d94f2SAkhil Goyal ROC_MCS_SUBEVENT_UNKNOWN, 330c26d94f2SAkhil Goyal 331c26d94f2SAkhil Goyal /* subevents of ROC_MCS_EVENT_SECTAG_VAL_ERR sectag validation events 332c26d94f2SAkhil Goyal * ROC_MCS_EVENT_RX_SECTAG_V_EQ1 333c26d94f2SAkhil Goyal * Validation check: SecTag.TCI.V = 1 334c26d94f2SAkhil Goyal * ROC_MCS_EVENT_RX_SECTAG_E_EQ0_C_EQ1 335c26d94f2SAkhil Goyal * Validation check: SecTag.TCI.E = 0 && SecTag.TCI.C = 1 336c26d94f2SAkhil Goyal * ROC_MCS_EVENT_RX_SECTAG_SL_GTE48 337c26d94f2SAkhil Goyal * Validation check: SecTag.SL >= 'd48 338c26d94f2SAkhil Goyal * ROC_MCS_EVENT_RX_SECTAG_ES_EQ1_SC_EQ1 339c26d94f2SAkhil Goyal * Validation check: SecTag.TCI.ES = 1 && SecTag.TCI.SC = 1 340c26d94f2SAkhil Goyal * ROC_MCS_EVENT_RX_SECTAG_SC_EQ1_SCB_EQ1 341c26d94f2SAkhil Goyal * Validation check: SecTag.TCI.SC = 1 && SecTag.TCI.SCB = 1 342c26d94f2SAkhil Goyal */ 343c26d94f2SAkhil Goyal ROC_MCS_EVENT_RX_SECTAG_V_EQ1, 344c26d94f2SAkhil Goyal ROC_MCS_EVENT_RX_SECTAG_E_EQ0_C_EQ1, 345c26d94f2SAkhil Goyal ROC_MCS_EVENT_RX_SECTAG_SL_GTE48, 346c26d94f2SAkhil Goyal ROC_MCS_EVENT_RX_SECTAG_ES_EQ1_SC_EQ1, 347c26d94f2SAkhil Goyal ROC_MCS_EVENT_RX_SECTAG_SC_EQ1_SCB_EQ1, 348c26d94f2SAkhil Goyal 349c26d94f2SAkhil Goyal /* subevents of ROC_MCS_EVENT_FIFO_OVERFLOW error event 350c26d94f2SAkhil Goyal * ROC_MCS_EVENT_DATA_FIFO_OVERFLOW: 351c26d94f2SAkhil Goyal * Notifies data FIFO overflow fatal error in BBE unit. 352c26d94f2SAkhil Goyal * ROC_MCS_EVENT_POLICY_FIFO_OVERFLOW 353c26d94f2SAkhil Goyal * Notifies policy FIFO overflow fatal error in BBE unit. 354c26d94f2SAkhil Goyal * ROC_MCS_EVENT_PKT_ASSM_FIFO_OVERFLOW, 355c26d94f2SAkhil Goyal * Notifies output FIFO overflow fatal error in PAB unit. 356c26d94f2SAkhil Goyal */ 357c26d94f2SAkhil Goyal ROC_MCS_EVENT_DATA_FIFO_OVERFLOW, 358c26d94f2SAkhil Goyal ROC_MCS_EVENT_POLICY_FIFO_OVERFLOW, 359c26d94f2SAkhil Goyal ROC_MCS_EVENT_PKT_ASSM_FIFO_OVERFLOW, 360c26d94f2SAkhil Goyal }; 361c26d94f2SAkhil Goyal 362c26d94f2SAkhil Goyal enum roc_mcs_event_type { 363c26d94f2SAkhil Goyal ROC_MCS_EVENT_UNKNOWN, 364c26d94f2SAkhil Goyal 365c26d94f2SAkhil Goyal /* Notifies BBE_INT_DFIFO/PLFIFO_OVERFLOW or PAB_INT_OVERFLOW 366c26d94f2SAkhil Goyal * interrupts, it's a fatal error that causes packet corruption. 367c26d94f2SAkhil Goyal */ 368c26d94f2SAkhil Goyal ROC_MCS_EVENT_FIFO_OVERFLOW, 369c26d94f2SAkhil Goyal 370c26d94f2SAkhil Goyal /* Notifies CPM_RX_SECTAG_X validation error interrupt */ 371c26d94f2SAkhil Goyal ROC_MCS_EVENT_SECTAG_VAL_ERR, 372c26d94f2SAkhil Goyal /* Notifies CPM_RX_PACKET_XPN_EQ0 (SecTag.PN == 0 in ingress) interrupt */ 373c26d94f2SAkhil Goyal ROC_MCS_EVENT_RX_SA_PN_HARD_EXP, 374c26d94f2SAkhil Goyal /* Notifies CPM_RX_PN_THRESH_REACHED interrupt */ 375c26d94f2SAkhil Goyal ROC_MCS_EVENT_RX_SA_PN_SOFT_EXP, 376c26d94f2SAkhil Goyal /* Notifies CPM_TX_PACKET_XPN_EQ0 (PN wrapped in egress) interrupt */ 377c26d94f2SAkhil Goyal ROC_MCS_EVENT_TX_SA_PN_HARD_EXP, 378c26d94f2SAkhil Goyal /* Notifies CPM_TX_PN_THRESH_REACHED interrupt */ 379c26d94f2SAkhil Goyal ROC_MCS_EVENT_TX_SA_PN_SOFT_EXP, 380c26d94f2SAkhil Goyal /* Notifies CPM_TX_SA_NOT_VALID interrupt */ 381c26d94f2SAkhil Goyal ROC_MCS_EVENT_SA_NOT_VALID, 382c26d94f2SAkhil Goyal /* Notifies recovery of software driven port reset */ 383c26d94f2SAkhil Goyal ROC_MCS_EVENT_PORT_RESET_RECOVERY, 384c26d94f2SAkhil Goyal }; 385c26d94f2SAkhil Goyal 386c26d94f2SAkhil Goyal union roc_mcs_event_data { 387c26d94f2SAkhil Goyal /* Valid for below events 388c26d94f2SAkhil Goyal * - ROC_MCS_EVENT_RX_SA_PN_SOFT_EXP 389c26d94f2SAkhil Goyal * - ROC_MCS_EVENT_TX_SA_PN_SOFT_EXP 390c26d94f2SAkhil Goyal */ 391c26d94f2SAkhil Goyal struct { 392c26d94f2SAkhil Goyal uint8_t secy_idx; 393c26d94f2SAkhil Goyal uint8_t sc_idx; 394c26d94f2SAkhil Goyal uint8_t sa_idx; 395c26d94f2SAkhil Goyal }; 396c26d94f2SAkhil Goyal /* Valid for below event 397c26d94f2SAkhil Goyal * - ROC_MCS_EVENT_FIFO_OVERFLOW 398c26d94f2SAkhil Goyal * 399c26d94f2SAkhil Goyal * Upon fatal error notification on a MCS port, ROC driver resets below attributes of active 400c26d94f2SAkhil Goyal * flow entities(sc & sa) and than resets the port. 401c26d94f2SAkhil Goyal * - Reset NEXT_PN of active SAs to 1. 402c26d94f2SAkhil Goyal * - Reset TX active SA for each SC, TX_SA_ACTIVE = 0, SA_INDEX0_VLD = 1. 403c26d94f2SAkhil Goyal * - Clear SA_IN_USE for active ANs in RX_SA_MAP_MEM. 404c26d94f2SAkhil Goyal * - Clear all stats mapping to this port. 405c26d94f2SAkhil Goyal * - Reactivate SA_IN_USE for active ANs in RX_SA_MAP_MEM. 406c26d94f2SAkhil Goyal * 407c26d94f2SAkhil Goyal * ROC driver notifies the following flow entity(sc & sa) details in application callback, 408c26d94f2SAkhil Goyal * application is expected to exchange the Tx/Rx NEXT_PN, TX_SA_ACTIVE, active RX SC AN 409c26d94f2SAkhil Goyal * details with peer device so that peer device can resets it's MACsec flow states and than 410c26d94f2SAkhil Goyal * resume packet transfers. 411c26d94f2SAkhil Goyal */ 412c26d94f2SAkhil Goyal struct { 413c26d94f2SAkhil Goyal uint16_t *tx_sa_array; /* Tx SAs whose PN memories were reset (NEXT_PN=1) */ 414c26d94f2SAkhil Goyal uint16_t *rx_sa_array; /* Rx SAs whose PN memories were reset (NEXT_PN=1) */ 415c26d94f2SAkhil Goyal uint16_t *tx_sc_array; /* Tx SCs whose active SAs were reset (TX_SA_ACTIVE=0) */ 416c26d94f2SAkhil Goyal uint16_t *rx_sc_array; /* Rx SCs whose state was reset */ 417c26d94f2SAkhil Goyal uint8_t *sc_an_array; /* AN of Rx SCs(in rx_sc_array) which were reactivated */ 418c26d94f2SAkhil Goyal uint8_t num_tx_sa; /* num entries in tx_sa_array */ 419c26d94f2SAkhil Goyal uint8_t num_rx_sa; /* num entries in rx_sa_array */ 420c26d94f2SAkhil Goyal uint8_t num_tx_sc; /* num entries in tx_sc_array */ 421c26d94f2SAkhil Goyal uint8_t num_rx_sc; /* num entries in rx_sc_array */ 422c26d94f2SAkhil Goyal uint8_t lmac_id; /* lmac_id/port which was recovered from fatal error */ 423c26d94f2SAkhil Goyal }; 424c26d94f2SAkhil Goyal }; 425c26d94f2SAkhil Goyal 426c26d94f2SAkhil Goyal struct roc_mcs_event_desc { 427c26d94f2SAkhil Goyal enum roc_mcs_event_type type; 428c26d94f2SAkhil Goyal enum roc_mcs_event_subtype subtype; 429c26d94f2SAkhil Goyal union roc_mcs_event_data metadata; 430c26d94f2SAkhil Goyal }; 431c26d94f2SAkhil Goyal 432df5ba910SAkhil Goyal struct roc_mcs_fips_req { 433df5ba910SAkhil Goyal uint8_t dir; 434df5ba910SAkhil Goyal }; 435df5ba910SAkhil Goyal 436df5ba910SAkhil Goyal struct roc_mcs_fips_mode { 437df5ba910SAkhil Goyal uint64_t mode; 438df5ba910SAkhil Goyal uint8_t dir; 439df5ba910SAkhil Goyal }; 440df5ba910SAkhil Goyal 441df5ba910SAkhil Goyal struct roc_mcs_fips_ctl { 442df5ba910SAkhil Goyal uint64_t ctl; 443df5ba910SAkhil Goyal uint8_t dir; 444df5ba910SAkhil Goyal }; 445df5ba910SAkhil Goyal 446df5ba910SAkhil Goyal struct roc_mcs_fips_iv { 447df5ba910SAkhil Goyal uint32_t iv_bits95_64; 448df5ba910SAkhil Goyal uint64_t iv_bits63_0; 449df5ba910SAkhil Goyal uint8_t dir; 450df5ba910SAkhil Goyal }; 451df5ba910SAkhil Goyal 452df5ba910SAkhil Goyal struct roc_mcs_fips_ctr { 453df5ba910SAkhil Goyal uint32_t fips_ctr; 454df5ba910SAkhil Goyal uint8_t dir; 455df5ba910SAkhil Goyal }; 456df5ba910SAkhil Goyal 457df5ba910SAkhil Goyal struct roc_mcs_fips_key { 458df5ba910SAkhil Goyal uint64_t sak_bits255_192; 459df5ba910SAkhil Goyal uint64_t sak_bits191_128; 460df5ba910SAkhil Goyal uint64_t sak_bits127_64; 461df5ba910SAkhil Goyal uint64_t sak_bits63_0; 462df5ba910SAkhil Goyal uint64_t hashkey_bits127_64; 463df5ba910SAkhil Goyal uint64_t hashkey_bits63_0; 464df5ba910SAkhil Goyal uint8_t sak_len; 465df5ba910SAkhil Goyal uint8_t dir; 466df5ba910SAkhil Goyal }; 467df5ba910SAkhil Goyal 468df5ba910SAkhil Goyal struct roc_mcs_fips_block { 469df5ba910SAkhil Goyal uint64_t blk_bits127_64; 470df5ba910SAkhil Goyal uint64_t blk_bits63_0; 471df5ba910SAkhil Goyal uint8_t dir; 472df5ba910SAkhil Goyal }; 473df5ba910SAkhil Goyal 474df5ba910SAkhil Goyal struct roc_mcs_fips_result_rsp { 475df5ba910SAkhil Goyal uint64_t blk_bits127_64; 476df5ba910SAkhil Goyal uint64_t blk_bits63_0; 477df5ba910SAkhil Goyal uint64_t icv_bits127_64; 478df5ba910SAkhil Goyal uint64_t icv_bits63_0; 479df5ba910SAkhil Goyal uint8_t result_pass; 480df5ba910SAkhil Goyal }; 481df5ba910SAkhil Goyal 482c26d94f2SAkhil Goyal /** User application callback to be registered for any notifications from driver. */ 483*010db30fSAnkur Dwivedi typedef int (*roc_mcs_dev_cb_fn)(void *userdata, struct roc_mcs_event_desc *desc, void *cb_arg, 484*010db30fSAnkur Dwivedi uint8_t port_id); 485c26d94f2SAkhil Goyal 486f752780fSAkhil Goyal struct roc_mcs { 487f752780fSAkhil Goyal TAILQ_ENTRY(roc_mcs) next; 488f752780fSAkhil Goyal struct plt_pci_device *pci_dev; 489f752780fSAkhil Goyal struct mbox *mbox; 490f752780fSAkhil Goyal uint8_t idx; 491f752780fSAkhil Goyal uint8_t refcount; 492*010db30fSAnkur Dwivedi bool intr_cfg_once; 493*010db30fSAnkur Dwivedi uint8_t *sa_port_map; 494f752780fSAkhil Goyal 495f752780fSAkhil Goyal #define ROC_MCS_MEM_SZ (1 * 1024) 496f752780fSAkhil Goyal uint8_t reserved[ROC_MCS_MEM_SZ] __plt_cache_aligned; 497f752780fSAkhil Goyal } __plt_cache_aligned; 498f752780fSAkhil Goyal 499f752780fSAkhil Goyal TAILQ_HEAD(roc_mcs_head, roc_mcs); 500f752780fSAkhil Goyal 501f752780fSAkhil Goyal /* Initialization */ 502f752780fSAkhil Goyal __roc_api struct roc_mcs *roc_mcs_dev_init(uint8_t mcs_idx); 503f752780fSAkhil Goyal __roc_api void roc_mcs_dev_fini(struct roc_mcs *mcs); 504f752780fSAkhil Goyal /* Get roc mcs dev structure */ 505f752780fSAkhil Goyal __roc_api struct roc_mcs *roc_mcs_dev_get(uint8_t mcs_idx); 506f752780fSAkhil Goyal /* HW info get */ 507f752780fSAkhil Goyal __roc_api int roc_mcs_hw_info_get(struct roc_mcs_hw_info *hw_info); 508e4a6ea54SAkhil Goyal /* Active lmac bmap set */ 509e4a6ea54SAkhil Goyal __roc_api int roc_mcs_active_lmac_set(struct roc_mcs *mcs, struct roc_mcs_set_active_lmac *lmac); 510e4a6ea54SAkhil Goyal /* Port bypass mode set */ 511e4a6ea54SAkhil Goyal __roc_api int roc_mcs_lmac_mode_set(struct roc_mcs *mcs, struct roc_mcs_set_lmac_mode *port); 512e4a6ea54SAkhil Goyal /* (X)PN threshold set */ 513e4a6ea54SAkhil Goyal __roc_api int roc_mcs_pn_threshold_set(struct roc_mcs *mcs, struct roc_mcs_set_pn_threshold *pn); 514f0a0d0ceSAkhil Goyal /* Reset port */ 515f0a0d0ceSAkhil Goyal __roc_api int roc_mcs_port_reset(struct roc_mcs *mcs, struct roc_mcs_port_reset_req *port); 516f0a0d0ceSAkhil Goyal /* Get port config */ 517f0a0d0ceSAkhil Goyal __roc_api int roc_mcs_port_cfg_set(struct roc_mcs *mcs, struct roc_mcs_port_cfg_set_req *req); 518f0a0d0ceSAkhil Goyal /* Set port config */ 519f0a0d0ceSAkhil Goyal __roc_api int roc_mcs_port_cfg_get(struct roc_mcs *mcs, struct roc_mcs_port_cfg_get_req *req, 520f0a0d0ceSAkhil Goyal struct roc_mcs_port_cfg_get_rsp *rsp); 5212b1dbc07SAkhil Goyal /* Get custom tag config */ 5222b1dbc07SAkhil Goyal __roc_api int roc_mcs_custom_tag_cfg_get(struct roc_mcs *mcs, 5232b1dbc07SAkhil Goyal struct roc_mcs_custom_tag_cfg_get_req *req, 5242b1dbc07SAkhil Goyal struct roc_mcs_custom_tag_cfg_get_rsp *rsp); 525f752780fSAkhil Goyal 5262211ef84SAkhil Goyal /* Resource allocation and free */ 5272211ef84SAkhil Goyal __roc_api int roc_mcs_rsrc_alloc(struct roc_mcs *mcs, struct roc_mcs_alloc_rsrc_req *req, 5282211ef84SAkhil Goyal struct roc_mcs_alloc_rsrc_rsp *rsp); 5292211ef84SAkhil Goyal __roc_api int roc_mcs_rsrc_free(struct roc_mcs *mcs, struct roc_mcs_free_rsrc_req *req); 5302211ef84SAkhil Goyal /* SA policy read and write */ 5312211ef84SAkhil Goyal __roc_api int roc_mcs_sa_policy_write(struct roc_mcs *mcs, 5322211ef84SAkhil Goyal struct roc_mcs_sa_plcy_write_req *sa_plcy); 5332211ef84SAkhil Goyal __roc_api int roc_mcs_sa_policy_read(struct roc_mcs *mcs, 5342211ef84SAkhil Goyal struct roc_mcs_sa_plcy_write_req *sa_plcy); 5352211ef84SAkhil Goyal 536e4a6ea54SAkhil Goyal /* PN Table read and write */ 537e4a6ea54SAkhil Goyal __roc_api int roc_mcs_pn_table_write(struct roc_mcs *mcs, 538e4a6ea54SAkhil Goyal struct roc_mcs_pn_table_write_req *pn_table); 539e4a6ea54SAkhil Goyal __roc_api int roc_mcs_pn_table_read(struct roc_mcs *mcs, 540e4a6ea54SAkhil Goyal struct roc_mcs_pn_table_write_req *pn_table); 541e4a6ea54SAkhil Goyal 542f4bf4780SAkhil Goyal /* RX SC read, write and enable */ 543f4bf4780SAkhil Goyal __roc_api int roc_mcs_rx_sc_cam_write(struct roc_mcs *mcs, 544f4bf4780SAkhil Goyal struct roc_mcs_rx_sc_cam_write_req *rx_sc_cam); 545f4bf4780SAkhil Goyal __roc_api int roc_mcs_rx_sc_cam_read(struct roc_mcs *mcs, 546f4bf4780SAkhil Goyal struct roc_mcs_rx_sc_cam_write_req *rx_sc_cam); 547f4bf4780SAkhil Goyal __roc_api int roc_mcs_rx_sc_cam_enable(struct roc_mcs *mcs, 548f4bf4780SAkhil Goyal struct roc_mcs_rx_sc_cam_write_req *rx_sc_cam); 549ee71a3b2SAkhil Goyal /* SECY policy read and write */ 550ee71a3b2SAkhil Goyal __roc_api int roc_mcs_secy_policy_write(struct roc_mcs *mcs, 551ee71a3b2SAkhil Goyal struct roc_mcs_secy_plcy_write_req *secy_plcy); 552ee71a3b2SAkhil Goyal __roc_api int roc_mcs_secy_policy_read(struct roc_mcs *mcs, 553ee71a3b2SAkhil Goyal struct roc_mcs_rx_sc_cam_write_req *rx_sc_cam); 554f4bf4780SAkhil Goyal /* RX SC-SA MAP read and write */ 555f4bf4780SAkhil Goyal __roc_api int roc_mcs_rx_sc_sa_map_write(struct roc_mcs *mcs, 556f4bf4780SAkhil Goyal struct roc_mcs_rx_sc_sa_map *rx_sc_sa_map); 557f4bf4780SAkhil Goyal __roc_api int roc_mcs_rx_sc_sa_map_read(struct roc_mcs *mcs, 558f4bf4780SAkhil Goyal struct roc_mcs_rx_sc_sa_map *rx_sc_sa_map); 559f4bf4780SAkhil Goyal /* TX SC-SA MAP read and write */ 560f4bf4780SAkhil Goyal __roc_api int roc_mcs_tx_sc_sa_map_write(struct roc_mcs *mcs, 561f4bf4780SAkhil Goyal struct roc_mcs_tx_sc_sa_map *tx_sc_sa_map); 562f4bf4780SAkhil Goyal __roc_api int roc_mcs_tx_sc_sa_map_read(struct roc_mcs *mcs, 563f4bf4780SAkhil Goyal struct roc_mcs_tx_sc_sa_map *tx_sc_sa_map); 564*010db30fSAnkur Dwivedi /* SA to Port map update */ 565*010db30fSAnkur Dwivedi __roc_api void roc_mcs_sa_port_map_update(struct roc_mcs *mcs, int sa_id, uint8_t port_id); 566f4bf4780SAkhil Goyal 567ee71a3b2SAkhil Goyal /* Flow entry read, write and enable */ 568ee71a3b2SAkhil Goyal __roc_api int roc_mcs_flowid_entry_write(struct roc_mcs *mcs, 569ee71a3b2SAkhil Goyal struct roc_mcs_flowid_entry_write_req *flowid_req); 570ee71a3b2SAkhil Goyal __roc_api int roc_mcs_flowid_entry_read(struct roc_mcs *mcs, 571ee71a3b2SAkhil Goyal struct roc_mcs_flowid_entry_write_req *flowid_rsp); 572ee71a3b2SAkhil Goyal __roc_api int roc_mcs_flowid_entry_enable(struct roc_mcs *mcs, 573ee71a3b2SAkhil Goyal struct roc_mcs_flowid_ena_dis_entry *entry); 574ee71a3b2SAkhil Goyal 5752b1dbc07SAkhil Goyal /* Control packet rule alloc, free and write */ 5762b1dbc07SAkhil Goyal __roc_api int roc_mcs_ctrl_pkt_rule_alloc(struct roc_mcs *mcs, 5772b1dbc07SAkhil Goyal struct roc_mcs_alloc_ctrl_pkt_rule_req *req, 5782b1dbc07SAkhil Goyal struct roc_mcs_alloc_ctrl_pkt_rule_rsp *rsp); 5792b1dbc07SAkhil Goyal __roc_api int roc_mcs_ctrl_pkt_rule_free(struct roc_mcs *mcs, 5802b1dbc07SAkhil Goyal struct roc_mcs_free_ctrl_pkt_rule_req *req); 5812b1dbc07SAkhil Goyal __roc_api int roc_mcs_ctrl_pkt_rule_write(struct roc_mcs *mcs, 5822b1dbc07SAkhil Goyal struct roc_mcs_ctrl_pkt_rule_write_req *req); 5832b1dbc07SAkhil Goyal 584bd8d7755SAkhil Goyal /* Flow id stats get */ 585bd8d7755SAkhil Goyal __roc_api int roc_mcs_flowid_stats_get(struct roc_mcs *mcs, struct roc_mcs_stats_req *mcs_req, 586bd8d7755SAkhil Goyal struct roc_mcs_flowid_stats *stats); 587bd8d7755SAkhil Goyal /* Secy stats get */ 588bd8d7755SAkhil Goyal __roc_api int roc_mcs_secy_stats_get(struct roc_mcs *mcs, struct roc_mcs_stats_req *mcs_req, 589bd8d7755SAkhil Goyal struct roc_mcs_secy_stats *stats); 590bd8d7755SAkhil Goyal /* SC stats get */ 591bd8d7755SAkhil Goyal __roc_api int roc_mcs_sc_stats_get(struct roc_mcs *mcs, struct roc_mcs_stats_req *mcs_req, 592bd8d7755SAkhil Goyal struct roc_mcs_sc_stats *stats); 593bd8d7755SAkhil Goyal /* Port stats get */ 594bd8d7755SAkhil Goyal __roc_api int roc_mcs_port_stats_get(struct roc_mcs *mcs, struct roc_mcs_stats_req *mcs_req, 595bd8d7755SAkhil Goyal struct roc_mcs_port_stats *stats); 596bd8d7755SAkhil Goyal /* Clear stats */ 597bd8d7755SAkhil Goyal __roc_api int roc_mcs_stats_clear(struct roc_mcs *mcs, struct roc_mcs_clear_stats *mcs_req); 598bd8d7755SAkhil Goyal 599c26d94f2SAkhil Goyal /* Register user callback routines */ 600c26d94f2SAkhil Goyal __roc_api int roc_mcs_event_cb_register(struct roc_mcs *mcs, enum roc_mcs_event_type event, 601c26d94f2SAkhil Goyal roc_mcs_dev_cb_fn cb_fn, void *cb_arg, void *userdata); 602c26d94f2SAkhil Goyal /* Unregister user callback routines */ 603c26d94f2SAkhil Goyal __roc_api int roc_mcs_event_cb_unregister(struct roc_mcs *mcs, enum roc_mcs_event_type event); 604c26d94f2SAkhil Goyal 605c26d94f2SAkhil Goyal /* Configure interrupts */ 606c26d94f2SAkhil Goyal __roc_api int roc_mcs_intr_configure(struct roc_mcs *mcs, struct roc_mcs_intr_cfg *config); 607c26d94f2SAkhil Goyal 608f0a0d0ceSAkhil Goyal /* Port recovery from fatal errors */ 609f0a0d0ceSAkhil Goyal __roc_api int roc_mcs_port_recovery(struct roc_mcs *mcs, union roc_mcs_event_data *mdata, 610f0a0d0ceSAkhil Goyal uint8_t port_id); 611f0a0d0ceSAkhil Goyal 612df5ba910SAkhil Goyal /* FIPS reset */ 613df5ba910SAkhil Goyal __roc_api int roc_mcs_fips_reset(struct roc_mcs *mcs, struct roc_mcs_fips_req *req); 614df5ba910SAkhil Goyal /* FIPS mode set */ 615df5ba910SAkhil Goyal __roc_api int roc_mcs_fips_mode_set(struct roc_mcs *mcs, struct roc_mcs_fips_mode *req); 616df5ba910SAkhil Goyal /* FIPS ctl set */ 617df5ba910SAkhil Goyal __roc_api int roc_mcs_fips_ctl_set(struct roc_mcs *mcs, struct roc_mcs_fips_ctl *req); 618df5ba910SAkhil Goyal /* FIPS iv set */ 619df5ba910SAkhil Goyal __roc_api int roc_mcs_fips_iv_set(struct roc_mcs *mcs, struct roc_mcs_fips_iv *req); 620df5ba910SAkhil Goyal /* FIPS ctr set */ 621df5ba910SAkhil Goyal __roc_api int roc_mcs_fips_ctr_set(struct roc_mcs *mcs, struct roc_mcs_fips_ctr *req); 622df5ba910SAkhil Goyal /* FIPS key set */ 623df5ba910SAkhil Goyal __roc_api int roc_mcs_fips_key_set(struct roc_mcs *mcs, struct roc_mcs_fips_key *req); 624df5ba910SAkhil Goyal /* FIPS block set */ 625df5ba910SAkhil Goyal __roc_api int roc_mcs_fips_block_set(struct roc_mcs *mcs, struct roc_mcs_fips_block *req); 626df5ba910SAkhil Goyal /* FIPS start */ 627df5ba910SAkhil Goyal __roc_api int roc_mcs_fips_start(struct roc_mcs *mcs, struct roc_mcs_fips_req *req); 628df5ba910SAkhil Goyal /* FIPS result */ 629df5ba910SAkhil Goyal __roc_api int roc_mcs_fips_result_get(struct roc_mcs *mcs, struct roc_mcs_fips_req *req, 630df5ba910SAkhil Goyal struct roc_mcs_fips_result_rsp *rsp); 631f752780fSAkhil Goyal #endif /* ROC_MCS_H */ 632