bcm_imacsec.h (21619B)
1 /* 2 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 3 * 4 * Copyright 2007-2019 Broadcom Inc. All rights reserved. 5 */ 6 7 #ifndef BCM_IMACSEC_H 8 #define BCM_IMACSEC_H 9 #include<soc/error.h> 10 #include <soc/phy/phyctrl.h> 11 #include "bcm_plp_base_t_secy_api.h" 12 #include "bcm_plp_base_t_sec_common.h" 13 14 #define IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,dev_id) { \ 15 pa = (bcm_plp_base_t_sec_access_t *)(((char *)pc->driver_data + pc->size) - sizeof(bcm_plp_base_t_sec_access_t));\ 16 if(pa == NULL){\ 17 return SOC_E_INTERNAL;\ 18 }\ 19 pa->phy_info.phy_addr= pa->macsec_dev_addr;\ 20 pa->macsec_side = dev_id;\ 21 } 22 int imacsec_plp_base_t_secy_init(int unit, soc_port_t port, 23 unsigned int macsec_side, 24 bcm_plp_base_t_sec_mutex_t *mutex, 25 bcm_plp_base_t_secy_settings_t *setting_p); 26 int imacsec_plp_base_t_secy_vport_add(int unit, soc_port_t port, unsigned int macsec_side, 27 bcm_plp_base_t_secy_vport_handle_t *vport_handle_p); 28 int imacsec_plp_base_t_secy_vport_remove(int unit, soc_port_t port, unsigned int macsec_side, 29 const bcm_plp_base_t_secy_vport_handle_t vport_handle); 30 31 int imacsec_plp_base_t_secy_uninit(int unit, soc_port_t port, unsigned int macsec_side); 32 33 int imacsec_plp_base_t_secy_sa_add(int unit, soc_port_t port, unsigned int macsec_side, 34 const bcm_plp_base_t_secy_vport_handle_t vport_handle, 35 bcm_plp_base_t_secy_sa_handle_t *sa_handle_p, 36 const bcm_plp_base_t_secy_sa_t *sa_p); 37 int imacsec_plp_base_t_secy_sa_update(int unit, soc_port_t port, unsigned int macsec_side, 38 const bcm_plp_base_t_secy_sa_handle_t sa_handle, 39 const bcm_plp_base_t_secy_sa_t *sa_p); 40 int imacsec_plp_base_t_secy_sa_read(int unit, soc_port_t port, unsigned int macsec_side, 41 const bcm_plp_base_t_secy_sa_handle_t sa_handle, 42 const unsigned int word_offset, 43 const unsigned int word_count, 44 unsigned int * transform_p); 45 46 int imacsec_plp_base_t_secy_sa_remove(int unit, soc_port_t port, unsigned int macsec_side, 47 const bcm_plp_base_t_secy_sa_handle_t sa_handle 48 ); 49 int imacsec_plp_base_t_secy_rule_add(int unit, soc_port_t port, unsigned int macsec_side, 50 const bcm_plp_base_t_secy_vport_handle_t vport_handle, 51 bcm_plp_base_t_secy_rule_handle_t *rule_handle_p, 52 const bcm_plp_base_t_secy_rule_t *rule_p); 53 54 int imacsec_plp_base_t_secy_rule_remove(int unit, soc_port_t port, unsigned int macsec_side, 55 const bcm_plp_base_t_secy_rule_handle_t rule_handle); 56 57 int imacsec_plp_base_t_secy_rule_update(int unit, soc_port_t port, unsigned int macsec_side, 58 const bcm_plp_base_t_secy_rule_handle_t rule_handle, 59 const bcm_plp_base_t_secy_rule_t *rule_p); 60 61 int imacsec_plp_base_t_secy_rule_enable(int unit, soc_port_t port, unsigned int macsec_side, 62 const bcm_plp_base_t_secy_rule_handle_t rule_handle, 63 const unsigned char fsync); 64 65 int imacsec_plp_base_t_secy_rule_disable(int unit, soc_port_t port, unsigned int macsec_side, 66 const bcm_plp_base_t_secy_rule_handle_t rule_handle, 67 const unsigned char fsync); 68 int imacsec_plp_base_t_secy_rule_enable_disable(int unit, soc_port_t port, unsigned int macsec_side, 69 const bcm_plp_base_t_secy_rule_handle_t rule_handle_disable, 70 const bcm_plp_base_t_secy_rule_handle_t rule_handle_enable, 71 const unsigned char enable_all, 72 const unsigned char disable_all, 73 const unsigned char fsync); 74 int imacsec_plp_base_t_secy_sa_chain(int unit, soc_port_t port, unsigned int macsec_side, 75 const bcm_plp_base_t_secy_sa_handle_t active_sa_handle, 76 bcm_plp_base_t_secy_sa_handle_t * const new_sa_handle_p, 77 const bcm_plp_base_t_secy_sa_t * const new_sa_p); 78 int imacsec_plp_base_t_secy_sa_switch(int unit, soc_port_t port, unsigned int macsec_side, 79 const bcm_plp_base_t_secy_sa_handle_t active_sa_handle, 80 const bcm_plp_base_t_secy_sa_handle_t new_sa_handle, 81 const bcm_plp_base_t_secy_sa_t * const new_sa_p); 82 int imacsec_plp_base_t_secy_device_limits(int unit, soc_port_t port, unsigned int macsec_side, 83 unsigned int * const max_vport_count_p, 84 unsigned int * const max_rule_count_p, 85 unsigned int * const max_sa_count_p, 86 unsigned int * const max_sc_count_p); 87 int imacsec_plp_base_t_secy_vport_handle_issame(int unit, soc_port_t port, unsigned int macsec_side, 88 const bcm_plp_base_t_secy_vport_handle_t * const handle1_p, 89 const bcm_plp_base_t_secy_vport_handle_t * const handle2_p); 90 int imacsec_plp_base_t_secy_sa_handle_issame(int unit, soc_port_t port, unsigned int macsec_side, 91 const bcm_plp_base_t_secy_sa_handle_t * const handle1_p, 92 const bcm_plp_base_t_secy_sa_handle_t * const handle2_p); 93 int imacsec_plp_base_t_secy_sa_handle_sa_index_issame(int unit, soc_port_t port, unsigned int macsec_side, 94 const bcm_plp_base_t_secy_sa_handle_t sa_handle, 95 const unsigned int sa_index); 96 unsigned char imacsec_plp_base_t_secy_rule_handle_issame(int unit, soc_port_t port, unsigned int macsec_side, 97 const bcm_plp_base_t_secy_rule_handle_t * const handle1_p, 98 const bcm_plp_base_t_secy_rule_handle_t * const handle2_p); 99 int imacsec_plp_base_t_secy_sa_index_get(int unit, soc_port_t port, unsigned int macsec_side, 100 const bcm_plp_base_t_secy_sa_handle_t sa_handle, 101 unsigned int * const sa_index_p, 102 unsigned int * const sc_index_p); 103 int imacsec_plp_base_t_secy_rule_index_get(int unit, soc_port_t port, unsigned int macsec_side, 104 const bcm_plp_base_t_secy_rule_handle_t rule_handle, 105 unsigned int * const rule_index_p); 106 int imacsec_plp_base_t_secy_vport_index_get(int unit, soc_port_t port, unsigned int macsec_side, 107 const bcm_plp_base_t_secy_vport_handle_t vport_handle, 108 unsigned int * const vport_index_p); 109 int imacsec_plp_base_t_secy_sa_handle_get(int unit, soc_port_t port, unsigned int macsec_side, 110 const unsigned int sa_index, 111 bcm_plp_base_t_secy_sa_handle_t * const sa_handle_p); 112 113 int imacsec_plp_base_t_secy_rule_handle_get(int unit, soc_port_t port, unsigned int macsec_side, 114 const unsigned int rule_index, 115 bcm_plp_base_t_secy_rule_handle_t * const rule_handle_p); 116 int imacsec_plp_base_t_secy_vport_handle_get(int unit, soc_port_t port, unsigned int macsec_side, 117 const unsigned int vport_index, 118 bcm_plp_base_t_secy_vport_handle_t * const vport_handle_p); 119 int imacsec_plp_base_t_secy_device_update(int unit, soc_port_t port, unsigned int macsec_side, 120 const bcm_plp_base_t_secy_device_params_t * const device_p ); 121 122 int imacsec_plp_base_t_secy_bypass_set(int unit, soc_port_t port, unsigned int macsec_side, 123 const unsigned char fbypass); 124 125 int imacsec_plp_base_t_secy_bypass_get(int unit, soc_port_t port, unsigned int macsec_side, 126 unsigned char *fbypass); 127 128 int imacsec_plp_base_t_secy_sa_nextpn_update(int unit, soc_port_t port, unsigned int macsec_side, 129 const bcm_plp_base_t_secy_sa_handle_t sa_handle, 130 const unsigned int next_pn_lo, 131 const unsigned int next_pn_hi, 132 unsigned char * const fnext_pn_written_p); 133 int imacsec_plp_base_t_secy_crypt_auth_bypass_len_update(int unit, soc_port_t port, unsigned int macsec_side, 134 const unsigned int bypass_length); 135 int imacsec_plp_base_t_secy_rules_mtu_check_update(int unit, soc_port_t port, unsigned int macsec_side, 136 const unsigned int sci_index, 137 const bcm_plp_base_t_secy_sc_rule_mtu_check_t * const mtucheck_rule_p); 138 139 int imacsec_plp_base_t_secy_tcam_statistics_get(int unit, soc_port_t port, unsigned int macsec_side, 140 const bcm_plp_base_t_secy_rule_handle_t rule_handle, 141 bcm_plp_base_t_secy_tcam_stat_t * const stat_p, 142 const unsigned char fsync); 143 int imacsec_plp_base_t_secy_rxcam_statistics_get(int unit, soc_port_t port, unsigned int macsec_side, 144 const unsigned int scindex, 145 bcm_plp_base_t_secy_rxcam_stat_t* const stats_p, 146 const unsigned char fsync); 147 int imacsec_plp_base_t_secy_secy_statistics_i_get(int unit, soc_port_t port, unsigned int macsec_side, 148 bcm_plp_base_t_secy_vport_handle_t vport_handle, 149 bcm_plp_base_t_secy_secy_stat_i_t * const stats_p, 150 const unsigned char fsync); 151 int imacsec_plp_base_t_secy_secy_statistics_e_get(int unit, soc_port_t port, unsigned int macsec_side, 152 bcm_plp_base_t_secy_vport_handle_t vport_handle, 153 bcm_plp_base_t_secy_secy_stat_e_t * const stats_p, 154 const unsigned char fsync); 155 int imacsec_plp_base_t_secy_sa_statistics_i_get(int unit, soc_port_t port, unsigned int macsec_side, 156 const bcm_plp_base_t_secy_sa_handle_t sa_handle, 157 bcm_plp_base_t_secy_sa_stat_i_t * const stats_p, 158 const unsigned char fsync); 159 int imacsec_plp_base_t_secy_sa_statistics_e_get(int unit, soc_port_t port, unsigned int macsec_side, 160 const bcm_plp_base_t_secy_sa_handle_t sa_handle, 161 bcm_plp_base_t_secy_sa_stat_e_t * const stats_p, 162 const unsigned char fsync); 163 int imacsec_plp_base_t_secy_global_statistics_get(int unit, soc_port_t port, unsigned int macsec_side, 164 bcm_plp_base_t_secy_global_stat_t * const stat_p, 165 const unsigned char fsync); 166 int imacsec_plp_base_t_secy_ifc_statistics_e_get(int unit, soc_port_t port, unsigned int macsec_side, 167 bcm_plp_base_t_secy_vport_handle_t vport_handle, 168 bcm_plp_base_t_secy_ifc_stat_e_t * const stats_p, 169 const unsigned char fsync); 170 int imacsec_plp_base_t_secy_ifc_statistics_i_get(int unit, soc_port_t port, unsigned int macsec_side, 171 bcm_plp_base_t_secy_vport_handle_t vport_handle, 172 bcm_plp_base_t_secy_ifc_stat_i_t * const stats_p, 173 const unsigned char fsync); 174 int imacsec_plp_base_t_secy_device_count_summary_pifc_checkandclear(int unit, soc_port_t port, unsigned int macsec_side, 175 bcm_plp_base_t_secy_vport_handle_t ** const vport_handle_pp, 176 unsigned int * const num_ifc_indexes_p); 177 int imacsec_plp_base_t_secy_device_count_summary_prxcam_checkandclear(int unit, soc_port_t port, unsigned int macsec_side, 178 unsigned int ** const rx_cam_indexes_pp, 179 unsigned int * const num_rx_cam_indexes_p); 180 181 int imacsec_plp_base_t_secy_device_count_summary_psa_checkandclear(int unit, soc_port_t port, unsigned int macsec_side, 182 bcm_plp_base_t_secy_sa_handle_t ** const sa_handle_pp, 183 unsigned int * const num_sa_indexes_p); 184 int imacsec_plp_base_t_secy_device_count_summary_psecy_checkandclear(int unit, soc_port_t port, unsigned int macsec_side, 185 bcm_plp_base_t_secy_vport_handle_t ** const vport_handle_pp, 186 unsigned int * const nm_secy_indexes_p); 187 int imacsec_plp_base_t_secy_device_count_summary_ptcam_checkandclear(int unit, soc_port_t port, unsigned int macsec_side, 188 bcm_plp_base_t_secy_rule_handle_t ** const rule_handle_pp, 189 unsigned int * const num_tcam_indexes_p); 190 int imacsec_plp_base_t_secy_device_count_summary_sa_checkandclear(int unit, soc_port_t port, unsigned int macsec_side, 191 bcm_plp_base_t_secy_sa_handle_t sa_handle, 192 unsigned int * const count_summary_sa_p); 193 int imacsec_plp_base_t_secy_device_count_summary_secy_checkandclear(int unit, soc_port_t port, unsigned int macsec_side, 194 bcm_plp_base_t_secy_vport_handle_t vport_handle, 195 unsigned int * const count_summary_secy_p); 196 int imacsec_plp_base_t_secy_device_count_summary_tcam_global_checkandclear(int unit, soc_port_t port, unsigned int macsec_side, 197 unsigned int * const count_summary_tcam_global_p); 198 int imacsec_plp_base_t_secy_device_count_summary_ifc_checkandclear(int unit, soc_port_t port, unsigned int macsec_side, 199 bcm_plp_base_t_secy_vport_handle_t vport_handle, 200 unsigned int * const count_summary_ifc_p); 201 int imacsec_plp_base_t_secy_sa_expired_summary_checkandclear(int unit, soc_port_t port, unsigned int macsec_side, 202 bcm_plp_base_t_secy_sa_handle_t ** const sa_handle_pp, 203 unsigned int * const num_sa_indexes_p); 204 int imacsec_plp_base_t_secy_sa_pnthr_summary_checkandclear(int unit, soc_port_t port, unsigned int macsec_side, 205 bcm_plp_base_t_secy_sa_handle_t ** const sa_handle_pp, 206 unsigned int * const num_sa_indexes_p); 207 int imacsec_plp_base_t_secy_intr_enable_set(int unit, soc_port_t port, unsigned int macsec_side, 208 const bcm_plp_base_t_secy_intr_t *secy_intr_p); 209 int imacsec_plp_base_t_secy_intr_enable_get(int unit, soc_port_t port, unsigned int macsec_side, 210 bcm_plp_base_t_secy_intr_t *secy_intr_p); 211 int imacsec_plp_base_t_secy_intr_status_get(int unit, soc_port_t port, unsigned int macsec_side, 212 bcm_plp_base_t_secy_intr_t *secy_intr_p); 213 int imacsec_plp_base_t_secy_intr_status_clear(int unit, soc_port_t port, unsigned int macsec_side, 214 const bcm_plp_base_t_secy_intr_t *secy_intr_p); 215 int imacsec_plp_base_t_secy_event_status_get(int unit, soc_port_t port, unsigned int macsec_side, 216 bcm_plp_base_t_secy_intr_t *secy_intr_p); 217 bcm_plp_base_t_secy_status_t imacsec_plp_base_t_secy_intr_set(int unit, soc_port_t port, unsigned int macsec_side, 218 const bcm_plp_base_t_secy_intr_t *secy_intr, const unsigned int enable); 219 220 bcm_plp_base_t_secy_status_t imacsec_plp_base_t_secy_intr_get(int unit, soc_port_t port, unsigned int macsec_side, 221 bcm_plp_base_t_secy_intr_t *secy_intr, unsigned int *enable); 222 223 int imacsec_plp_base_t_secy_build_transform_record(int unit, soc_port_t port, unsigned int macsec_side, 224 bcm_plp_base_t_sa_builder_params_t *params, 225 unsigned int *sa_buffer_p); 226 int imacsec_plp_base_t_secy_sa_active_e_get(int unit, soc_port_t port, unsigned int macsec_side, 227 const unsigned int vport, 228 bcm_plp_base_t_secy_sa_handle_t * const active_sa_handle_p); 229 230 int imacsec_plp_base_t_secy_sa_active_i_get(int unit, soc_port_t port, unsigned int macsec_side, 231 const unsigned int vport, 232 const unsigned char * const sci_p, 233 bcm_plp_base_t_secy_sa_handle_t * const active_sa_handle_p); 234 235 int imacsec_plp_base_t_secy_sa_window_size_update(int unit, soc_port_t port, unsigned int macsec_side, 236 const bcm_plp_base_t_secy_sa_handle_t sa_handle, 237 const unsigned int window_size); 238 239 240 int imacsec_plp_base_t_version_get(int unit,soc_port_t port, bcm_plp_base_t_version_t* version_info); 241 242 int imacsec_plp_addr_read(int unit, /* attached switch unit */ 243 unsigned int port, /* port number */ 244 unsigned int reg_addr, /* register address */ 245 unsigned int *value); /* read register value */ 246 247 int imacsec_plp_addr_write(int unit, /* attached switch unit */ 248 unsigned int port, /* port number */ 249 unsigned int reg_addr, /* register address */ 250 unsigned int value); /* register value to write */ 251 #endif /* BCM_IMACSEC_H */