bcm_imacsec.c (139593B)
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 #ifdef INCLUDE_PLP_IMACSEC 7 8 #include <soc/phy/phyctrl.h> 9 #include <shared/bsl.h> 10 #include "bcm_imacsec.h" 11 12 /*! \brief imacsec_plp_base_t_secy_init 13 * 14 * Initializes a SecY device instance identified by macsec_side parameter. 15 * 16 * API use order: 17 * This function must be executed before any other imacsec_plp_base_t_secy_*() 18 * or imacsec_plp_base_t_secy_*() functions. 19 * 20 * @param unit (input) BCM unit number 21 * @param port (input) - port number 22 * @param macsec_side (input) - selects egress or ingress path 23 * 0 - egress path 24 * 1 - ingress path 25 * @param mutex (input) - User defined mutex function registration. 26 * User, optionally, can pass user data as part of this parameter 27 * that in turn gets passed into the mutex function. 28 * @param settings_p (input) 29 * Pointer to the memory location where the device settings are stored. 30 * 31 * This function is NOT re-entrant for the same macsec_side. 32 * This function is re-entrant for different macsec_side's. 33 * 34 * @return 35 * BCM_PLP_BASE_T_SECY_STATUS_OK 0 : success 36 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 37 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 38 */ 39 int imacsec_plp_base_t_secy_init(int unit, soc_port_t port, 40 unsigned int macsec_side, 41 bcm_plp_base_t_sec_mutex_t *mutex, 42 bcm_plp_base_t_secy_settings_t *setting_p) 43 { 44 phy_ctrl_t *pc; 45 int rv=0; 46 bcm_plp_base_t_sec_access_t *pa; 47 EXT_PHY_INIT_CHECK(unit,port); 48 pc = EXT_PHY_SW_STATE(unit, port); 49 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 50 pa->mutex.user_data=mutex->user_data; 51 pa->mutex.SecY0_mutex_take=mutex->SecY0_mutex_take; 52 pa->mutex.SecY1_mutex_take=mutex->SecY1_mutex_take; 53 pa->mutex.SecY0_mutex_give=mutex->SecY0_mutex_give; 54 pa->mutex.SecY1_mutex_give=mutex->SecY1_mutex_give; 55 rv = bcm_base_t_secy_device_init(pa,setting_p); 56 if(rv !=0){ 57 LOG_CLI((BSL_META_U(unit,"bcm_base_t_secy_device_init failed:%d\n "), rv)); 58 } 59 return rv; 60 } 61 /*! \brief imacsec_plp_base_t_secy_port_add 62 * 63 * Adds a new vPort (vPort policy) for one classification device instance 64 * identified by macsec_side parameter. 65 * 66 * Note: If a vPort is added for an SA then it must be added to the same SecY 67 * device (macsec_side) where the SA was added via the imacsec_plp_base_t_secy_sa_add() function. 68 * 69 * API use order: 70 * A vPort can be added to a classification device instance only after this 71 * device has been initialized via the imacsec_plp_base_t_secy_init() function. 72 * 73 * @param unit (input) BCM unit number 74 * @param port (input) - port number 75 * @param macsec_side (input) - selects egress or ingress path 76 * 0 - egress path 77 * 1 - ingress path 78 * @param vport_handle_p (output) 79 * Pointer to the memory location where the vPort handle will be stored. 80 * 81 * This function is NOT re-entrant for the same vPort of the same macsec_side. 82 * This function is re-entrant for different macsec_side's or different vPorts 83 * of the same macsec_side. 84 * 85 * This function can be called concurrently with any other secy API 86 * function for the same or different macsec_side provided that the API use order 87 * is followed. 88 * 89 * @return 90 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 91 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 92 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 93 */ 94 int imacsec_plp_base_t_secy_vport_add(int unit, soc_port_t port, unsigned int macsec_side, 95 bcm_plp_base_t_secy_vport_handle_t *vport_handle_p) 96 { 97 phy_ctrl_t *pc; 98 int rv=0; 99 bcm_plp_base_t_sec_access_t *pa; 100 EXT_PHY_INIT_CHECK(unit,port); 101 pc = EXT_PHY_SW_STATE(unit, port); 102 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 103 rv = bcm_base_t_secy_vport_add(pa,vport_handle_p); 104 if(rv !=0){ 105 LOG_CLI((BSL_META_U(unit,"bcm_base_t_secy_vport_add failed:%d\n "), rv)); 106 } 107 return rv; 108 } 109 110 /*! \brief imacsec_plp_base_t_secy_vport_remove 111 * 112 * Removes an already added vPort (vPort policy) from one classification device 113 * instance identified by macsec_side parameter. 114 * 115 * API use order: 116 * A vPort can be removed from a classification device instance only after 117 * this vPort has been added to the device via the imacsec_plp_base_t_secy_vport_add() 118 * function. 119 * 120 * Before this function is called all the rules associated with 121 * this vPort must be removed. 122 * 123 * @param unit (input) BCM unit number 124 * @param port (input) - port number 125 * @param macsec_side (input) - selects egress or ingress path 126 * 0 - egress path 127 * 1 - ingress path 128 * @param vport_handle (input) 129 * vPort handle for vPort to be removed. 130 * 131 * This function is NOT re-entrant for the same vPort of the same macsec_side. 132 * This function is re-entrant for different macsec_side's or different vPorts 133 * of the same macsec_side. 134 * 135 * This function cannot be called concurrently with imacsec_plp_base_t_secy_rule_add() and 136 * imacsec_plp_base_t_secy_rule_remove() functions for the same macsec_side. 137 * This function can be called concurrently with any other secy API 138 * function for the same or different macsec_side provided that the API use order 139 * is followed. 140 * 141 * @return 142 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 143 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 144 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 145 */ 146 147 int imacsec_plp_base_t_secy_vport_remove(int unit, soc_port_t port, unsigned int macsec_side, 148 const bcm_plp_base_t_secy_vport_handle_t vport_handle) 149 { 150 phy_ctrl_t *pc; 151 int rv=0; 152 bcm_plp_base_t_sec_access_t *pa; 153 EXT_PHY_INIT_CHECK(unit,port); 154 pc = EXT_PHY_SW_STATE(unit, port); 155 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 156 rv = bcm_base_t_secy_vport_remove(pa,vport_handle); 157 if(rv !=0){ 158 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_vport_remove failed:%d\n "), rv)); 159 } 160 return rv; 161 } 162 163 /*! \brief imacsec_plp_base_t_secy_uninit 164 * 165 * Uninitializes a SecY device instance identified by macsec_side parameter. 166 * 167 * API use order: 168 * This function must be called when the SecY device for this macsec_side 169 * is no longer needed. After this function is called no other imacsec_plp_base_t_secy_*() 170 * or imacsec_plp_base_t_secy_*() functions may be called for this macsec_side except the 171 * imacsec_plp_base_t_secy_init() function. 172 * 173 * @param unit (input) BCM unit number 174 * @param port (input) - port number 175 * @param macsec_side (input) - selects egress or ingress path 176 * 0 - egress path 177 * 1 - ingress path 178 * This function is NOT re-entrant for the same macsec_side. 179 * This function is re-entrant for different macsec_side's. 180 * 181 * This function cannot be called concurrently with any other SecY 182 * API function for the same macsec_side. 183 * This function can be called concurrently with any other SecY API 184 * function for the different macsec_side. 185 * 186 * @return 187 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 188 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 189 */ 190 191 int imacsec_plp_base_t_secy_uninit(int unit, soc_port_t port, unsigned int macsec_side) 192 { 193 phy_ctrl_t *pc; 194 int rv=0; 195 bcm_plp_base_t_sec_access_t *pa; 196 EXT_PHY_INIT_CHECK(unit,port); 197 pc = EXT_PHY_SW_STATE(unit, port); 198 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 199 rv = bcm_base_t_secy_device_uninit(pa); 200 if(rv !=0){ 201 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_uninit failed:%d\n "), rv)); 202 } 203 return rv; 204 } 205 /*! \brief imacsec_plp_base_t_secy_sa_add 206 * 207 * Adds a new SA for a SecY device instance identified by macsec_side parameter. 208 * 209 * @param unit (input) BCM unit number 210 * @param port (input) - port number 211 * @param macsec_side (input) - selects egress or ingress path 212 * 0 - egress path 213 * 1 - ingress path 214 * @param vport_handle (input) 215 * vPort handle for the vPort where the new SA must be added. 216 * 217 * @param sa_handle_p (output) 218 * Placeholder where the SA handle will be stored. It is used 219 * in the bcm_base_t_secy_sa*() function calls for this macsec_side. 220 * 221 * @param sa_p (input) 222 * Pointer to the memory location where the data for the new SA is stored. 223 * 224 * This function is NOT re-entrant for the same macsec_side. 225 * This function is re-entrant for different macsec_side's. 226 * 227 * This function cannot be called concurrently with the imacsec_plp_base_t_secy_sa_remove() 228 * function for the same macsec_side. 229 * This function can be called concurrently with any other SecY API 230 * function for the same or different macsec_side. 231 * 232 * @return 233 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 234 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 235 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 236 */ 237 238 int imacsec_plp_base_t_secy_sa_add(int unit, soc_port_t port, unsigned int macsec_side, 239 const bcm_plp_base_t_secy_vport_handle_t vport_handle, 240 bcm_plp_base_t_secy_sa_handle_t *sa_handle_p, 241 const bcm_plp_base_t_secy_sa_t *sa_p) 242 { 243 phy_ctrl_t *pc; 244 int rv=0; 245 bcm_plp_base_t_sec_access_t *pa; 246 EXT_PHY_INIT_CHECK(unit,port); 247 pc = EXT_PHY_SW_STATE(unit, port); 248 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 249 rv = bcm_base_t_secy_sa_add(pa,vport_handle,sa_handle_p,sa_p); 250 if(rv !=0){ 251 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_sa_add failed:%d\n "), rv)); 252 } 253 return rv; 254 } 255 /*! \brief imacsec_plp_base_t_secy_sa_update 256 * 257 * Updates SA flow parameters for an already added SA for a SecY device 258 * instance identified by macsec_side parameter. 259 * 260 * Note: This function does not update the SA transform record data and it 261 * cannot be used to update the key in the transform record. 262 * 263 * API use order: 264 * This function may be called for the sa_handle obtained via 265 * the imacsec_plp_base_t_secy_sa_add() function for the same macsec_side. 266 * 267 * @param unit (input) BCM unit number 268 * @param port (input) - port number 269 * @param macsec_side (input) - selects egress or ingress path 270 * 0 - egress path 271 * 1 - ingress path 272 * @param sa_handle (input) 273 * SA handle of the SA to be updated. 274 * 275 * @param sa_p (input) 276 * Pointer to the memory location where the new parameters for the SA are 277 * stored. 278 * 279 * This function is re-entrant for the same of different macsec_side's. 280 * 281 * This function cannot be called concurrently with the imacsec_plp_base_t_secy_sa_remove() 282 * function for the same macsec_side. 283 * This function can be called concurrently with any other SecY API 284 * function for the same or different macsec_side. 285 * 286 * @return 287 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 288 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 289 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 290 */ 291 292 int imacsec_plp_base_t_secy_sa_update(int unit, soc_port_t port, unsigned int macsec_side, 293 const bcm_plp_base_t_secy_sa_handle_t sa_handle, 294 const bcm_plp_base_t_secy_sa_t *sa_p) 295 { 296 phy_ctrl_t *pc; 297 int rv=0; 298 bcm_plp_base_t_sec_access_t *pa; 299 EXT_PHY_INIT_CHECK(unit,port); 300 pc = EXT_PHY_SW_STATE(unit, port); 301 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 302 rv=bcm_base_t_secy_sa_update(pa,sa_handle,sa_p); 303 if(rv !=0){ 304 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_sa_update failed:%d\n "), rv)); 305 } 306 return rv; 307 } 308 /*! \brief imacsec_plp_base_t_secy_sa_read 309 * 310 * Reads (part of) a transform record of an already added SA from a SecY 311 * device instance identified by macsec_side parameter. 312 * 313 * API use order: 314 * This function may be called for the sa_handle obtained via the 315 * imacsec_plp_base_t_secy_sa_add() function for the same macsec_side. 316 * 317 * @param unit (input) BCM unit number 318 * @param port (input) - port number 319 * @param macsec_side (input) - selects egress or ingress path 320 * 0 - egress path 321 * 1 - ingress path 322 * @param sa_handle (input) 323 * SA handle of the SA to be read. 324 * 325 * @param word_offset (input) 326 * Word offset in transform record where the data should be read from. 327 * 328 * @param word_count (input) 329 * Number of words which must be read from the SA transform record. 330 * 331 * @param transform_p (output) 332 * Pointer to the memory location where the word_count 32-bit words 333 * of the SA transform record will be stored. 334 * 335 * This function is re-entrant. 336 * 337 * This function can be called concurrently with any other SecY API 338 * function for the same or different sa_handle of the same or different 339 * macsec_side provided that the user order of the API is followed. 340 * 341 * @return 342 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 343 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 344 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 345 */ 346 347 int imacsec_plp_base_t_secy_sa_read(int unit, soc_port_t port, unsigned int macsec_side, 348 const bcm_plp_base_t_secy_sa_handle_t sa_handle, 349 const unsigned int word_offset, 350 const unsigned int word_count, 351 unsigned int * transform_p) 352 353 { 354 phy_ctrl_t *pc; 355 int rv=0; 356 bcm_plp_base_t_sec_access_t *pa; 357 EXT_PHY_INIT_CHECK(unit,port); 358 pc = EXT_PHY_SW_STATE(unit, port); 359 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 360 rv=bcm_base_t_secy_sa_read(pa,sa_handle,word_offset,word_count,transform_p); 361 if(rv !=0){ 362 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_sa_read failed:%d\n "), rv)); 363 } 364 return rv; 365 } 366 /*! \brief imacsec_plp_base_t_secy_sa_remove 367 * 368 * Removes a previously added SA from a SecY device instance identified by 369 * macsec_side parameter. 370 * 371 * @param unit (input) BCM unit number 372 * @param port (input) - port number 373 * @param macsec_side (input) - selects egress or ingress path 374 * 0 - egress path 375 * 1 - ingress path 376 * @param sa_handle (input) 377 * SA handle of the SA to be removed. After this function returns this 378 * handle should not be used anymore with the imacsec_plp_base_t_secy_sa*() functions. 379 * 380 * This function is NOT re-entrant for the same macsec_side. 381 * This function is re-entrant for different macsec_side's. 382 * 383 * This function cannot be called concurrently with the imacsec_plp_base_t_secy_sa_add() 384 * function for the same macsec_side. 385 * This function cannot be called concurrently with the imacsec_plp_base_t_secy_sa_read() 386 * function for the same sa_handle. 387 * This function can be called concurrently with any other SecY API 388 * function for the same or different macsec_side. 389 * 390 * @return 391 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 392 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 393 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 394 */ 395 396 int imacsec_plp_base_t_secy_sa_remove(int unit, soc_port_t port, unsigned int macsec_side, 397 const bcm_plp_base_t_secy_sa_handle_t sa_handle 398 ) 399 { 400 phy_ctrl_t *pc; 401 int rv=0; 402 bcm_plp_base_t_sec_access_t *pa; 403 EXT_PHY_INIT_CHECK(unit,port); 404 pc = EXT_PHY_SW_STATE(unit, port); 405 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 406 rv = bcm_base_t_secy_sa_remove(pa, sa_handle); 407 if(rv !=0){ 408 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_sa_remove failed:%d\n "), rv)); 409 } 410 return rv; 411 } 412 413 /*! \brief imacsec_plp_base_t_secy_rule_add 414 * 415 * Adds a new rule for matching a packet to a vPort identified by vport_handle 416 * for one classification device instance identified by macsec_side parameter. 417 * 418 * Note: If a rule is added for a vPort then it must be added to the same 419 * device (macsec_side) where the vPort was added via the imacsec_plp_base_t_secy_vport_add() 420 * function. 421 * 422 * API use order: 423 * A rule can be added to a classification device instance only after 424 * the vPort identified by vport_handle has been added to this device 425 * via the imacsec_plp_base_t_secy_vport_add() function. 426 * 427 * 428 * @param unit (input) BCM unit number 429 * @param port (input) - port number 430 * @param macsec_side (input) - selects egress or ingress path 431 * 0 - egress path 432 * 1 - ingress path 433 * 434 * 435 * @param vport_handle (input) 436 * vPort handle for the vPort where the packet matching rule must be added. 437 * 438 * @param rule_handle_p (output) 439 * Pointer to the memory location where where the rule handle will be stored. 440 * 441 * @param rule_p (input) 442 * Pointer to the memory location where the data for the rule is stored. 443 * 444 * This function is NOT re-entrant for the same rule of the same macsec_side. 445 * This function is re-entrant for different macsec_side's or different rules 446 * of the same macsec_side. 447 * 448 * This function cannot be called concurrently with imacsec_plp_base_t_secy_vport_remove() and 449 * imacsec_plp_base_t_secy_rule_remove() functions for the same macsec_side. 450 * This function can be called concurrently with any other secy API 451 * function for the same or different macsec_side provided that the API use order 452 * is followed. 453 * 454 * @return 455 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 456 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 457 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 458 */ 459 460 int imacsec_plp_base_t_secy_rule_add(int unit, soc_port_t port, unsigned int macsec_side, 461 const bcm_plp_base_t_secy_vport_handle_t vport_handle, 462 bcm_plp_base_t_secy_rule_handle_t *rule_handle_p, 463 const bcm_plp_base_t_secy_rule_t *rule_p) 464 { 465 phy_ctrl_t *pc; 466 int rv=0; 467 bcm_plp_base_t_sec_access_t *pa; 468 EXT_PHY_INIT_CHECK(unit,port); 469 pc = EXT_PHY_SW_STATE(unit, port); 470 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 471 rv=bcm_base_t_secy_rule_add(pa,vport_handle,rule_handle_p,rule_p); 472 if(rv !=0){ 473 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_rule_add failed:%d\n "), rv)); 474 } 475 return rv; 476 } 477 /*! \brief imacsec_plp_base_t_secy_rule_remove 478 * 479 * Removes an already added rule from one classification device 480 * instance identified by macsec_side parameter. 481 * 482 * API use order: 483 * A rule can be removed from a classification device instance only after 484 * this rule has been added to the device via the imacsec_plp_base_t_secy_rule_add() 485 * function. 486 * 487 * @param unit (input) BCM unit number 488 * @param port (input) - port number 489 * @param macsec_side (input) - selects egress or ingress path 490 * 0 - egress path 491 * 1 - ingress path 492 * 493 * 494 * @param rule_handle (input) 495 * Rule handle for the rule to be removed. 496 * 497 * This function is NOT re-entrant for the same rule of the same macsec_side. 498 * This function is re-entrant for different macsec_side's or different rules 499 * of the same macsec_side. 500 * 501 * This function cannot be called concurrently with imacsec_plp_base_t_secy_vport_remove() and 502 * imacsec_plp_base_t_secy_rule_add() functions for the same macsec_side. 503 * This function can be called concurrently with any other secy API 504 * function for the same or different macsec_side provided that the API use order 505 * is followed. 506 * 507 * @return 508 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 509 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 510 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 511 */ 512 513 int imacsec_plp_base_t_secy_rule_remove(int unit, soc_port_t port, unsigned int macsec_side, 514 const bcm_plp_base_t_secy_rule_handle_t rule_handle) 515 { 516 phy_ctrl_t *pc; 517 int rv=0; 518 bcm_plp_base_t_sec_access_t *pa; 519 EXT_PHY_INIT_CHECK(unit,port); 520 pc = EXT_PHY_SW_STATE(unit, port); 521 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 522 rv = bcm_base_t_secy_rule_remove(pa,rule_handle); 523 if(rv !=0){ 524 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_rule_remove failed:%d\n "), rv)); 525 } 526 return rv; 527 } 528 /*! \brief imacsec_plp_base_t_secy_rule_update 529 * 530 * Updates a packet matching rule for one classification device instance 531 * identified by macsec_side parameter. 532 * 533 * Note: A rule must be updated to the same device (macsec_side) where 534 * the corresponding vPort was added via the imacsec_plp_base_t_secy_vport_add() function. 535 * 536 * API use order: 537 * A rule can be updated for a classification device instance only after 538 * the corresponding vPort has been added to this device 539 * via the imacsec_plp_base_t_secy_vport_add() function. 540 * 541 * @param unit (input) BCM unit number 542 * @param port (input) - port number 543 * @param macsec_side (input) - selects egress or ingress path 544 * 0 - egress path 545 * 1 - ingress path 546 * 547 * @param rule_handle (input) 548 * Rule handle for rule to be enabled. 549 * 550 * @param rule_p (input) 551 * Pointer to the memory location where the data for the rule is stored. 552 * 553 * This function is NOT re-entrant for the same rule of the same macsec_side. 554 * This function is re-entrant for different macsec_side's or different rules 555 * of the same macsec_side. 556 * 557 * This function can be called concurrently with any other secy API 558 * function for the same or different macsec_side provided that the API use order 559 * is followed. 560 * 561 * @return 562 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 563 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 564 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 565 */ 566 567 int imacsec_plp_base_t_secy_rule_update(int unit, soc_port_t port, unsigned int macsec_side, 568 const bcm_plp_base_t_secy_rule_handle_t rule_handle, 569 const bcm_plp_base_t_secy_rule_t *rule_p) 570 { 571 phy_ctrl_t *pc; 572 int rv=0; 573 bcm_plp_base_t_sec_access_t *pa; 574 EXT_PHY_INIT_CHECK(unit,port); 575 pc = EXT_PHY_SW_STATE(unit, port); 576 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 577 rv = bcm_base_t_secy_rule_update(pa,rule_handle,rule_p); 578 if(rv !=0){ 579 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_rule_update failed:%d\n "), rv)); 580 } 581 return rv; 582 } 583 584 /*! \brief imacsec_plp_base_t_secy_rule_enable 585 * 586 * Enables an already added rule for one classification device instance 587 * identified by macsec_side parameter. 588 * 589 * API use order: 590 * A rule can be enabled after it has been added 591 * via the secy API imacsec_plp_base_t_secy_rule_add() function or updated via 592 * the imacsec_plp_base_t_secy_rule_updated() function for the same macsec_side. 593 * 594 * @param unit (input) BCM unit number 595 * @param port (input) - port number 596 * @param macsec_side (input) - selects egress or ingress path 597 * 0 - egress path 598 * 1 - ingress path 599 * 600 * @param rule_handle (input) 601 * Rule handle for rule to be enabled. 602 * 603 * @param fsync (input) 604 * If true then this function will ensure that all the packets 605 * available in the device at the time of the function call are processed 606 * before the rule is enabled. 607 * 608 * This function is NOT re-entrant for the same Device when fsync is true. 609 * This function is re-entrant for the same Device when fsync is false. 610 * This function is re-entrant for different Devices. 611 * 612 * This function can be called concurrently with any other secy API function 613 * for the same or different rule_handle of the same Device or 614 * different Devices provided that the API use order is followed. 615 * 616 * If fsync is set to true then this function cannot be called concurrently 617 * with any other function of the secy API which also takes fsync parameter set 618 * to true for the same Device. 619 * 620 * @return 621 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 622 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 623 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 624 */ 625 626 int imacsec_plp_base_t_secy_rule_enable(int unit, soc_port_t port, unsigned int macsec_side, 627 const bcm_plp_base_t_secy_rule_handle_t rule_handle, 628 const unsigned char fsync) 629 { 630 phy_ctrl_t *pc; 631 int rv=0; 632 bcm_plp_base_t_sec_access_t *pa; 633 EXT_PHY_INIT_CHECK(unit,port); 634 pc = EXT_PHY_SW_STATE(unit, port); 635 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 636 rv = bcm_base_t_secy_rule_enable(pa,rule_handle,fsync); 637 if(rv !=0){ 638 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_rule_enable failed:%d\n "), rv)); 639 } 640 return rv; 641 } 642 /*! \brief imacsec_plp_base_t_secy_rule_disable 643 * 644 * Disables an already added rule for one classification device instance 645 * identified by macsec_side parameter. 646 * 647 * API use order: 648 * A rule can be enabled after it has been added 649 * via the secy API imacsec_plp_base_t_secy_rule_add() function or updated via 650 * the imacsec_plp_base_t_secy_rule_update() function for the same macsec_side. 651 * 652 * @param unit (input) BCM unit number 653 * @param port (input) - port number 654 * @param macsec_side (input) - selects egress or ingress path 655 * 0 - egress path 656 * 1 - ingress path 657 * 658 * @param rule_handle (input) 659 * Rule handle for rule to be enabled. 660 * 661 * @param fsync (input) 662 * If true then this function will ensure that all the packets 663 * available in the device at the time of the function call are processed 664 * before the rule is disabled. 665 * 666 * This function is NOT re-entrant for the same Device when fsync is true. 667 * This function is re-entrant for the same Device when fsync is false. 668 * This function is re-entrant for different Devices. 669 * 670 * This function can be called concurrently with any other secy API function 671 * for the same or different rule_handle of the same Device or 672 * different Devices provided that the API use order is followed. 673 * 674 * If fsync is set to true then this function cannot be called concurrently 675 * with any other function of the secy API which also takes fsync parameter set 676 * to true for the same Device. 677 * 678 * @return 679 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 680 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 681 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 682 */ 683 684 int imacsec_plp_base_t_secy_rule_disable(int unit, soc_port_t port, unsigned int macsec_side, 685 const bcm_plp_base_t_secy_rule_handle_t rule_handle, 686 const unsigned char fsync) 687 { 688 phy_ctrl_t *pc; 689 int rv=0; 690 bcm_plp_base_t_sec_access_t *pa; 691 EXT_PHY_INIT_CHECK(unit,port); 692 pc = EXT_PHY_SW_STATE(unit, port); 693 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 694 rv = bcm_base_t_secy_rule_disable(pa,rule_handle,fsync); 695 if(rv !=0){ 696 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_rule_disable failed:%d\n "), rv)); 697 } 698 return rv; 699 } 700 /*! \brief imacsec_plp_base_t_secy_rule_enable_disable 701 * 702 * Enables and/or disables an already added rule from one Classification device 703 * instance identified by macsec_side parameter. Can also enable or disable all 704 * rules for this device instance at once. 705 * 706 * API use order: 707 * An rule can be enabled or disabled after its transform record is 708 * installed via the SecY API imacsec_plp_base_t_secy_sa_add() function and the rule is 709 * added via the imacsec_plp_base_t_secy_rule_add() function for the same macsec_side. 710 * 711 * @param unit (input) BCM unit number 712 * @param port (input) - port number 713 * @param macsec_side (input) - selects egress or ingress path 714 * 0 - egress path 715 * 1 - ingress path 716 * 717 * @param rule_handle_enable (input) 718 * Rule handle for rule to be enabled. Will be ignored if equal to 719 * bcm_plp_base_t_secy_rule_handle_NULL. 720 * 721 * @param rule_handle_disable (input) 722 * Rule handle for rule to be disabled. Will be ignored if equal to 723 * bcm_plp_base_t_secy_rule_handle_NULL. 724 * 725 * @param enable_all (input) 726 * When set to true all rules will be enabled. Takes precedence over the 727 * other parameters. 728 * 729 * @param disable_all (input) 730 * When set to true all rules will be disabled. Takes precedence over the 731 * other parameters, except enable_all. 732 * 733 * @param fsync (input) 734 * If true then this function will ensure that all the packets 735 * available in the device at the time of the function call are processed 736 * before the rule is enabled or disabled or both. 737 * 738 * This function is NOT re-entrant for the same Device when fsync is true. 739 * This function is re-entrant for the same Device when fsync is false. 740 * This function is re-entrant for different Devices. 741 * 742 * This function can be called concurrently with any other secy API function 743 * for the same or different rule_handles of the same Device or 744 * different Devices provided that the API use order is followed. 745 * 746 * If fsync is set to true then this function cannot be called concurrently 747 * with any other function of the secy API which also takes fsync parameter set 748 * to true for the same Device. 749 * 750 * @return 751 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 752 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 753 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 754 */ 755 int imacsec_plp_base_t_secy_rule_enable_disable(int unit, soc_port_t port, unsigned int macsec_side, 756 const bcm_plp_base_t_secy_rule_handle_t rule_handle_disable, 757 const bcm_plp_base_t_secy_rule_handle_t rule_handle_enable, 758 const unsigned char enable_all, 759 const unsigned char disable_all, 760 const unsigned char fsync) 761 { 762 phy_ctrl_t *pc; 763 int rv=0; 764 bcm_plp_base_t_sec_access_t *pa; 765 EXT_PHY_INIT_CHECK(unit,port); 766 pc = EXT_PHY_SW_STATE(unit, port); 767 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 768 rv = bcm_base_t_secy_rule_enable_disable(pa,rule_handle_disable,rule_handle_enable,enable_all,disable_all,fsync); 769 if(rv !=0){ 770 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_rule_enable_disable failed:%d\n "), rv)); 771 } 772 return rv; 773 } 774 775 /*! \brief imacsec_plp_base_t_secy_sa_chain 776 * 777 * Adds a new SA transform record and chain it to the current active SA. 778 * 779 * @param unit (input) BCM unit number 780 * @param port (input) - port number 781 * @param macsec_side (input) - selects egress or ingress path 782 * 0 - egress path 783 * 1 - ingress path 784 * 785 * @param active_sa_handle (input) 786 * SA handle of the current active SA. 787 * 788 * @param new_sa_handle_p (output) 789 * Place holder where the SA handle will be stored that can be used 790 * in the imacsec_plp_base_t_secy_sa*() function calls for this macsec_side. 791 * 792 * @param new_sa_p (input) 793 * Pointer to a memory location where the data for the new SA is stored. 794 * 795 * This function is NOT re-entrant for the same macsec_side. 796 * This function is re-entrant for different macsec_side's. 797 * 798 * This function cannot be called concurrently with the imacsec_plp_base_t_secy_sa_add() and 799 * imacsec_plp_base_t_secy_sa_remove() function for the same macsec_side. 800 * This function can be called concurrently with any other SecY API 801 * function for the same or different macsec_side. 802 * 803 * @return 804 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 805 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 806 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 807 */ 808 809 int imacsec_plp_base_t_secy_sa_chain(int unit, soc_port_t port, unsigned int macsec_side, 810 const bcm_plp_base_t_secy_sa_handle_t active_sa_handle, 811 bcm_plp_base_t_secy_sa_handle_t * const new_sa_handle_p, 812 const bcm_plp_base_t_secy_sa_t * const new_sa_p) 813 { 814 phy_ctrl_t *pc; 815 int rv=0; 816 bcm_plp_base_t_sec_access_t *pa; 817 EXT_PHY_INIT_CHECK(unit,port); 818 pc = EXT_PHY_SW_STATE(unit, port); 819 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 820 rv = bcm_base_t_secy_sa_chain(pa, active_sa_handle, new_sa_handle_p, new_sa_p); 821 if(rv !=0){ 822 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_sa_chain failed:%d\n "), rv)); 823 } 824 return rv; 825 } 826 827 /*! \brief imacsec_plp_base_t_secy_sa_switch 828 * 829 * Manually switch to the new SA from the current active SA. 830 * 831 * @param unit (input) BCM unit number 832 * @param port (input) - port number 833 * @param macsec_side (input) - selects egress or ingress path 834 * 0 - egress path 835 * 1 - ingress path 836 * 837 * @param active_sa_handle (input) 838 * SA handle of the current active SA. 839 * 840 * @param new_sa_handle (input) 841 * SA handle of the SA to be switched to. 842 * 843 * @param new_sa_p (input) 844 * Pointer to a memory location where the data for the new SA is stored. 845 * 846 * This function is NOT re-entrant for the same macsec_side. 847 * This function is re-entrant for different macsec_side's. 848 * 849 * This function cannot be called concurrently with the imacsec_plp_base_t_secy_sa_remove() 850 * function for the same macsec_side. 851 * This function can be called concurrently with any other SecY API 852 * function for the same or different macsec_side. 853 * 854 * @return 855 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 856 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 857 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 858 */ 859 860 int imacsec_plp_base_t_secy_sa_switch(int unit, soc_port_t port, unsigned int macsec_side, 861 const bcm_plp_base_t_secy_sa_handle_t active_sa_handle, 862 const bcm_plp_base_t_secy_sa_handle_t new_sa_handle, 863 const bcm_plp_base_t_secy_sa_t * const new_sa_p) 864 { 865 phy_ctrl_t *pc; 866 int rv=0; 867 bcm_plp_base_t_sec_access_t *pa; 868 EXT_PHY_INIT_CHECK(unit,port); 869 pc = EXT_PHY_SW_STATE(unit, port); 870 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 871 rv = bcm_base_t_secy_sa_switch(pa, active_sa_handle, new_sa_handle, new_sa_p); 872 if(rv !=0){ 873 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_sa_switch failed:%d\n "), rv)); 874 } 875 return rv; 876 } 877 /**---------------------------------------------------------------------------- 878 * imacsec_plp_base_t_secy_device_limits 879 * 880 * Returns the maximum number of rules, vPorts, Security Associations (SAs) 881 * and/or Secure Channels (SCs) of the XtSecY device instance identified by 882 * DeviceId parameter. 883 * 884 * API use order: 885 * This function can be called after the function imacsec_plp_base_t_secy_init(pa) 886 * and before the function imacsec_plp_base_t_secy_uninit(pa) is called. 887 * 888 * @param unit (input) BCM unit number 889 * @param port (input) - port number 890 * @param macsec_side (input) - selects egress or ingress path 891 * 0 - egress path 892 * 1 - ingress path 893 * 894 * @param [out] max_vport_count_p 895 * Pointer to a memory location where the maximum number of vPorts must 896 * be stored. Skipped if the pointer is NULL. 897 * 898 * @param [out] max_rule_count_p 899 * Pointer to a memory location where the maximum number of TCAM rules 900 * must be stored. Skipped if the pointer is NULL. 901 * 902 * @param [out] max_sa_count_p 903 * Pointer to a memory location where the maximum number of SAs must be 904 * stored. Skipped if the pointer is NULL. 905 * 906 * @param [out] max_sc_count_p 907 * Pointer to a memory location where the maximum number of SCs must be 908 * stored. Skipped if the pointer is NULL. 909 * 910 * This function is re-entrant and called always as long as the API use order 911 * is respected. 912 * 913 * @return BCM_PLP_BASE_T_SECY_STATUS_OK : success\n 914 * @return BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter\n 915 * @return BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 916 */ 917 918 int imacsec_plp_base_t_secy_device_limits(int unit, soc_port_t port, unsigned int macsec_side, 919 unsigned int * const max_vport_count_p, 920 unsigned int * const max_rule_count_p, 921 unsigned int * const max_sa_count_p, 922 unsigned int * const max_sc_count_p) 923 { 924 phy_ctrl_t *pc; 925 int rv=0; 926 bcm_plp_base_t_sec_access_t *pa; 927 EXT_PHY_INIT_CHECK(unit,port); 928 pc = EXT_PHY_SW_STATE(unit, port); 929 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 930 rv = bcm_base_t_secy_device_limits(pa, max_vport_count_p, max_rule_count_p, max_sa_count_p,max_sc_count_p); 931 if(rv !=0){ 932 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_device_limits failed:%d\n "), rv)); 933 } 934 return rv; 935 } 936 937 /*! \brief imacsec_plp_base_t_secy_vport_handle_issame 938 * 939 * Check whether provided Handle1 is equal to provided Handle2. 940 * 941 * @param unit (input) BCM unit number 942 * @param port (input) - port number 943 * @param macsec_side (input) - selects egress or ingress path 944 * 0 - egress path 945 * 1 - ingress path 946 * 947 * @param handle1_p 948 * First handle 949 * 950 * @param handle2_p 951 * Second handle 952 * 953 * This function is re-entrant for the same or different macsec_side's. 954 * 955 * This function can be called concurrently with 956 * any other SecY API function for the same or different macsec_side. 957 * 958 * @return 959 * true: provided handles are equal\n 960 * false: provided handles are not equal 961 */ 962 963 int imacsec_plp_base_t_secy_vport_handle_issame(int unit, soc_port_t port, unsigned int macsec_side, 964 const bcm_plp_base_t_secy_vport_handle_t * const handle1_p, 965 const bcm_plp_base_t_secy_vport_handle_t * const handle2_p) 966 { 967 phy_ctrl_t *pc; 968 int rv=0; 969 bcm_plp_base_t_sec_access_t *pa; 970 EXT_PHY_INIT_CHECK(unit,port); 971 pc = EXT_PHY_SW_STATE(unit, port); 972 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 973 rv = bcm_base_t_secy_vport_handle_issame(pa, handle1_p, handle2_p); 974 if(rv ==0 || rv ==1){ 975 return rv; 976 }else{ 977 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_vport_handle_issame failed:%d\n "), rv)); 978 } 979 return rv; 980 } 981 982 /*! \brief imacsec_plp_base_t_secy_sa_handle_issame 983 * 984 * Check whether the provided Handle1 is equal to provided Handle2. 985 * 986 * @param unit (input) BCM unit number 987 * @param port (input) - port number 988 * @param macsec_side (input) - selects egress or ingress path 989 * 0 - egress path 990 * 1 - ingress path 991 * 992 * @param handle1_p 993 * First handle 994 * 995 * @param handle2_p 996 * Second handle 997 * 998 * This function is re-entrant for the same or different macsec_side's. 999 * 1000 * This function can be called concurrently with any other SecY API 1001 * function for the same or different macsec_side. 1002 * 1003 * @return 1004 * true: provided handles are equal\n 1005 * false: provided handles are not equal 1006 */ 1007 1008 int imacsec_plp_base_t_secy_sa_handle_issame(int unit, soc_port_t port, unsigned int macsec_side, 1009 const bcm_plp_base_t_secy_sa_handle_t * const handle1_p, 1010 const bcm_plp_base_t_secy_sa_handle_t * const handle2_p) 1011 { 1012 phy_ctrl_t *pc; 1013 int rv=0; 1014 bcm_plp_base_t_sec_access_t *pa; 1015 EXT_PHY_INIT_CHECK(unit,port); 1016 pc = EXT_PHY_SW_STATE(unit, port); 1017 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 1018 rv = bcm_base_t_secy_sa_handle_issame(pa, handle1_p, handle2_p); 1019 if(rv ==0 || rv ==1){ 1020 return rv; 1021 }else{ 1022 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_sa_handle_issame failed:%d\n "), rv)); 1023 } 1024 return rv; 1025 } 1026 1027 /*! \brief imacsec_plp_base_t_secy_sa_handle_sa_index_issame 1028 * 1029 * Check whether the provided Handle points to the same SA as the provided 1030 * SA index. 1031 * 1032 * @param unit (input) BCM unit number 1033 * @param port (input) - port number 1034 * @param macsec_side (input) - selects egress or ingress path 1035 * 0 - egress path 1036 * 1 - ingress path 1037 * 1038 * @param sa_handle 1039 * SA handle 1040 * 1041 * @param sa_index 1042 * SA index 1043 * 1044 * This function is re-entrant for the same or different macsec_side's. 1045 * 1046 * This function can be called concurrently with any other SecY API 1047 * function for the same or different macsec_side. 1048 * 1049 * @return 1050 * true: provided sa index are equal \n 1051 * false: provided sa index are not equal 1052 */ 1053 1054 int imacsec_plp_base_t_secy_sa_handle_sa_index_issame(int unit, soc_port_t port, unsigned int macsec_side, 1055 const bcm_plp_base_t_secy_sa_handle_t sa_handle, 1056 const unsigned int sa_index) 1057 { 1058 phy_ctrl_t *pc; 1059 int rv=0; 1060 bcm_plp_base_t_sec_access_t *pa; 1061 EXT_PHY_INIT_CHECK(unit,port); 1062 pc = EXT_PHY_SW_STATE(unit, port); 1063 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 1064 rv = bcm_base_t_secy_sa_handle_sa_index_issame(pa, sa_handle, sa_index); 1065 if(rv ==0 || rv ==1){ 1066 return rv; 1067 }else{ 1068 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_sa_handle_sa_index_issame failed:%d\n "), rv)); 1069 } 1070 return rv; 1071 } 1072 /*! \brief imacsec_plp_base_t_secy_sa_nextpn_update 1073 * 1074 * Updates the NextPN field for an inbound SA. 1075 * 1076 * API use order: 1077 * This function may be called for the sa_handle obtained via the 1078 * imacsec_plp_base_t_secy_sa_add() function for the same macsec_side. 1079 * 1080 * @param unit (input) BCM unit number 1081 * @param port (input) - port number 1082 * @param macsec_side (input) - selects egress or ingress path 1083 * 0 - egress path 1084 * 1 - ingress path 1085 * 1086 * @param sa_handle (input) 1087 * SA handle of the SA to be updated. 1088 * 1089 * @param next_pn_lo (input) 1090 * Least significant 32 bits of new NextPN. For 32-bit sequence numbers 1091 * this is the entire sequence number. 1092 * 1093 * @param next_pn_hi (input) 1094 * Most significant 32 bits of new NextPN. Only applicable for 64-bit 1095 * sequence numbers, will be ignored for 32-bit sequence numbers. 1096 * 1097 * @param fnext_pn_written_p (output) 1098 * flag to indicate that NextPN is actually written. Output not provided 1099 * if pointer is NULL. 1100 * 1101 * This function is NOT re-entrant for the same macsec_side. 1102 * This function is re-entrant for different macsec_side's. 1103 * 1104 * This function cannot be called concurrently with the imacsec_plp_base_t_secy_sa_remove() 1105 * function for the same macsec_side. 1106 * This function can be called concurrently with any other SecY API 1107 * function for the same or different macsec_side. 1108 * 1109 * @return 1110 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 1111 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 1112 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 1113 */ 1114 1115 int imacsec_plp_base_t_secy_sa_nextpn_update(int unit, soc_port_t port, unsigned int macsec_side, 1116 const bcm_plp_base_t_secy_sa_handle_t sa_handle, 1117 const unsigned int next_pn_lo, 1118 const unsigned int next_pn_hi, 1119 unsigned char * const fnext_pn_written_p) 1120 { 1121 phy_ctrl_t *pc; 1122 int rv=0; 1123 bcm_plp_base_t_sec_access_t *pa; 1124 EXT_PHY_INIT_CHECK(unit,port); 1125 pc = EXT_PHY_SW_STATE(unit, port); 1126 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 1127 rv = bcm_base_t_secy_sa_nextpn_update(pa, sa_handle, next_pn_lo,next_pn_hi,fnext_pn_written_p); 1128 if(rv !=0){ 1129 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_sa_nextpn_update failed:%d\n "), rv)); 1130 } 1131 return rv; 1132 1133 } 1134 1135 /*! imacsec_plp_base_t_secy_device_update 1136 * 1137 * 1138 * This function updates the SecY device control settings. 1139 * 1140 * The BCM_PLP_BASE_T_SECY_EVENT_STAT_GLOBAL_THR and BCM_PLP_BASE_T_SECY_EVENT_STAT_TC_THR events can 1141 * be configured via the bcm_plp_base_t_secy_device_params_t:Control_p data structure by 1142 * specifying the packet counter threshold to be reached in order for both 1143 * events to be generated by the Classification Engine. 1144 * 1145 * 1146 * @param unit (input) BCM unit number 1147 * @param port (input) - port number 1148 * @param macsec_side (input) - selects egress or ingress path 1149 * 0 - egress path 1150 * 1 - ingress path 1151 * 1152 * @param [in] device_p 1153 * Pointer to the memory location where the control parameters 1154 * are stored, see bcm_plp_base_t_secy_device_params_t. 1155 * Note: Application has to pass NULL for pointer elements inside bcm_plp_base_t_secy_device_params_t for which 1156 * update is not required. 1157 * @return 1158 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 1159 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 1160 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 1161 */ 1162 1163 int imacsec_plp_base_t_secy_device_update(int unit, soc_port_t port, unsigned int macsec_side, 1164 const bcm_plp_base_t_secy_device_params_t * const device_p ) 1165 { 1166 phy_ctrl_t *pc; 1167 int rv=0; 1168 bcm_plp_base_t_sec_access_t *pa; 1169 EXT_PHY_INIT_CHECK(unit,port); 1170 pc = EXT_PHY_SW_STATE(unit, port); 1171 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 1172 rv = bcm_base_t_secy_device_update(pa, device_p); 1173 if(rv !=0){ 1174 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_device_update failed:%d\n "), rv)); 1175 } 1176 return rv; 1177 1178 } 1179 1180 /*! imacsec_plp_base_t_secy_bypass_set 1181 * 1182 * Configure the port in low-latency bypass mode/normal mode. 1183 * 1184 * API use order: 1185 * This function can be called for a SecY device only, after the 1186 * device has been initialized via the bcm_base_t_secy_device_init() function. 1187 * 1188 * @param unit (input) BCM unit number 1189 * @param port (input) - port number 1190 * @param macsec_side (input) - selects egress or ingress path 1191 * 0 - egress path 1192 * 1 - ingress path 1193 * 1194 * @param [in] fbypass 1195 * true if port is set to low-latency bypass 1196 * false if port is set to normal mode 1197 * 1198 * @return 1199 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 1200 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 1201 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 1202 */ 1203 1204 int imacsec_plp_base_t_secy_bypass_set(int unit, soc_port_t port, unsigned int macsec_side, 1205 const unsigned char fbypass) 1206 { 1207 phy_ctrl_t *pc; 1208 int rv=0; 1209 bcm_plp_base_t_sec_access_t *pa; 1210 EXT_PHY_INIT_CHECK(unit,port); 1211 pc = EXT_PHY_SW_STATE(unit, port); 1212 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 1213 rv = bcm_base_t_secy_bypass_set(pa, fbypass); 1214 if(rv !=0){ 1215 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_bypass_set failed:%d\n "), rv)); 1216 } 1217 return rv; 1218 } 1219 1220 /*! imacsec_plp_base_t_secy_bypass_get 1221 * 1222 * Get the status of low-latency bypass mode 1223 * 1224 * API use order: 1225 * This function can be called for a SecY device only, after the 1226 * device has been initialized via the bcm_base_t_secy_device_init() function. 1227 * 1228 * @param unit (input) BCM unit number 1229 * @param port (input) - port number 1230 * @param macsec_side (input) - selects egress or ingress path 1231 * 0 - egress path 1232 * 1 - ingress path 1233 * 1234 * @param [out] fbypass 1235 * true if port is in low-latency bypass mode 1236 * false if port is in for normal operation 1237 * 1238 * @return 1239 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 1240 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 1241 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 1242 */ 1243 1244 int imacsec_plp_base_t_secy_bypass_get(int unit, soc_port_t port, unsigned int macsec_side, 1245 unsigned char *fbypass) 1246 { 1247 phy_ctrl_t *pc; 1248 int rv=0; 1249 bcm_plp_base_t_sec_access_t *pa; 1250 EXT_PHY_INIT_CHECK(unit,port); 1251 pc = EXT_PHY_SW_STATE(unit, port); 1252 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 1253 rv = bcm_base_t_secy_bypass_get(pa, fbypass); 1254 if(rv !=0){ 1255 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_bypass_get failed:%d\n "), rv)); 1256 } 1257 return rv; 1258 1259 } 1260 1261 /**---------------------------------------------------------------------------- 1262 * imacsec_plp_base_t_secy_crypt_auth_bypass_len_update 1263 * 1264 * Updates the length of the bypass data during crypt-authenticate operation 1265 * for a SecY device identified by macsec_side. The bypass data should contain 1266 * MAC header to be able to classify the packet into the corresponding 1267 * crypto-authenticate flow control register and additionally it might include 1268 * the IV used in the transformation. 1269 * 1270 * @param unit (input) BCM unit number 1271 * @param port (input) - port number 1272 * @param macsec_side (input) - selects egress or ingress path 1273 * 0 - egress path 1274 * 1 - ingress path 1275 * 1276 * @param [in] bypass_length 1277 * The length in bytes of the bypass data. 1278 * 1279 * This function is re-entrant for the same or different macsec_side's. 1280 * 1281 * This function can be called concurrently with any other function for the 1282 * same or different macsec_side's. 1283 * 1284 * @return 1285 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 1286 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 1287 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 1288 */ 1289 1290 int imacsec_plp_base_t_secy_crypt_auth_bypass_len_update(int unit, soc_port_t port, unsigned int macsec_side, 1291 const unsigned int bypass_length) 1292 { 1293 phy_ctrl_t *pc; 1294 int rv=0; 1295 bcm_plp_base_t_sec_access_t *pa; 1296 EXT_PHY_INIT_CHECK(unit,port); 1297 pc = EXT_PHY_SW_STATE(unit, port); 1298 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 1299 rv = bcm_base_t_secy_crypt_auth_bypass_len_update(pa, bypass_length); 1300 if(rv !=0){ 1301 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_crypt_auth_bypass_len_update failed:%d\n "), rv)); 1302 } 1303 return rv; 1304 1305 } 1306 1307 /**---------------------------------------------------------------------------- 1308 * imacsec_plp_base_t_secy_rules_mtu_check_update 1309 * 1310 * Updates rule for outbound MTU checks. 1311 * 1312 * API use order: 1313 * Rules can be updated for a SecY device instance only after 1314 * this device has been initialized via the imacsec_plp_base_t_secy_init(pa) 1315 * function. 1316 * 1317 * @param unit (input) BCM unit number 1318 * @param port (input) - port number 1319 * @param macsec_side (input) - selects egress or ingress path 1320 * 0 - egress path 1321 * 1 - ingress path 1322 * 1323 * @param [in] sci_index 1324 * Secure Channel index for which the MTU check rule must be updated. 1325 * 1326 * @param [in] mtucheck_rule_p 1327 * Pointer to a memory location where the MTU compare rule 1328 * for this Secure Channel is stored. 1329 * 1330 * This function is re-entrant for the same or different Devices. 1331 * 1332 * This function can be called concurrently with any other SecY API 1333 * function for the same or different macsec_side provided the API use order 1334 * is followed. 1335 * 1336 * @return 1337 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 1338 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 1339 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 1340 1341 */ 1342 1343 int imacsec_plp_base_t_secy_rules_mtu_check_update(int unit, soc_port_t port, unsigned int macsec_side, 1344 const unsigned int sci_index, 1345 const bcm_plp_base_t_secy_sc_rule_mtu_check_t * const mtucheck_rule_p) 1346 { 1347 phy_ctrl_t *pc; 1348 int rv=0; 1349 bcm_plp_base_t_sec_access_t *pa; 1350 EXT_PHY_INIT_CHECK(unit,port); 1351 pc = EXT_PHY_SW_STATE(unit, port); 1352 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 1353 rv = bcm_base_t_secy_rules_mtu_check_update(pa, sci_index, mtucheck_rule_p ); 1354 if(rv !=0){ 1355 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_rules_mtu_check_update failed:%d\n "), rv)); 1356 } 1357 return rv; 1358 1359 } 1360 1361 /*! \brief imacsec_plp_base_t_secy_rule_handle_issame 1362 * 1363 * Check whether provided Handle1 is equal to provided Handle2. 1364 * 1365 * @param unit (input) BCM unit number 1366 * @param port (input) - port number 1367 * @param macsec_side (input) - selects egress or ingress path 1368 * 0 - egress path 1369 * 1 - ingress path 1370 * 1371 * @param handle1_p 1372 * First handle 1373 * 1374 * @param handle2_p 1375 * Second handle 1376 * 1377 * This function is re-entrant for the same or different macsec_side's. 1378 * 1379 * This function can be called concurrently with any other secy API function 1380 * for the same or different macsec_side. 1381 * 1382 * @return 1383 * true: provided handles are equal\n 1384 * false: provided handles are not equal 1385 */ 1386 1387 unsigned char imacsec_plp_base_t_secy_rule_handle_issame(int unit, soc_port_t port, unsigned int macsec_side, 1388 const bcm_plp_base_t_secy_rule_handle_t * const handle1_p, 1389 const bcm_plp_base_t_secy_rule_handle_t * const handle2_p) 1390 { 1391 phy_ctrl_t *pc; 1392 int rv=0; 1393 bcm_plp_base_t_sec_access_t *pa; 1394 EXT_PHY_INIT_CHECK(unit,port); 1395 pc = EXT_PHY_SW_STATE(unit, port); 1396 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 1397 rv = bcm_base_t_secy_rule_handle_issame(pa, handle1_p, handle2_p ); 1398 if(rv ==0 || rv ==1){ 1399 return rv; 1400 }else{ 1401 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_rule_handle_issame failed:%d\n "), rv)); 1402 } 1403 return rv; 1404 1405 } 1406 /*! \brief imacsec_plp_base_t_secy_sa_index_get 1407 * 1408 * Get the SA index from an SA, using the SA handle. 1409 * 1410 * @param unit (input) BCM unit number 1411 * @param port (input) - port number 1412 * @param macsec_side (input) - selects egress or ingress path 1413 * 0 - egress path 1414 * 1 - ingress path 1415 * 1416 * @pre API use order:\n 1417 * This function may be called for the SA Handle obtained via 1418 * the secy_sa_add() function for the same macsec_side. 1419 * 1420 * @param [in] sa_handle 1421 * SA handle of the SA to get the index from. 1422 * 1423 * @param [out] sa_index_p 1424 * Pointer to a memory location where the SA index will be stored. 1425 * 1426 * @param [out] sc_index_p 1427 * Pointer to a memory location where the SC index will be stored. 1428 * 1429 * This function is re-entrant for the same or different Devices. 1430 * 1431 * This function can be called concurrently with any other SecY API 1432 * function for the same or different macsec_side provided the API use order 1433 * is followed. 1434 * 1435 * @return 1436 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 1437 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 1438 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 1439 */ 1440 1441 int imacsec_plp_base_t_secy_sa_index_get(int unit, soc_port_t port, unsigned int macsec_side, 1442 const bcm_plp_base_t_secy_sa_handle_t sa_handle, 1443 unsigned int * const sa_index_p, 1444 unsigned int * const sc_index_p) 1445 { 1446 phy_ctrl_t *pc; 1447 int rv=0; 1448 bcm_plp_base_t_sec_access_t *pa; 1449 EXT_PHY_INIT_CHECK(unit,port); 1450 pc = EXT_PHY_SW_STATE(unit, port); 1451 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 1452 rv = bcm_base_t_secy_sa_index_get(pa, sa_handle, sa_index_p, sc_index_p); 1453 if(rv !=0){ 1454 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_sa_index_get failed:%d\n "), rv)); 1455 } 1456 return rv; 1457 1458 } 1459 /*! \brief imacsec_plp_base_t_secy_rule_index_get 1460 * 1461 * Gets the Rule index from a Rule, using the Rule handle. 1462 * 1463 * API use order: 1464 * This function may be called for the RuleHandle obtained via 1465 * the imacsec_plp_base_t_secy_rule_add() function for the same macsec_side. 1466 * 1467 * @param unit (input) BCM unit number 1468 * @param port (input) - port number 1469 * @param macsec_side (input) - selects egress or ingress path 1470 * 0 - egress path 1471 * 1 - ingress path 1472 * 1473 * @param [in] rule_handle 1474 * Rule handle of the Rule to get the index from. 1475 * 1476 * @param [out] rule_index_p 1477 * Pointer to a memory location where the Rule index will be stored. 1478 * 1479 * This function is re-entrant for the same or different Devices. 1480 * 1481 * This function can be called concurrently with any other secy API 1482 * function for the same or different macsec_side provided the API use order 1483 * is followed. 1484 * 1485 * @return 1486 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 1487 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 1488 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 1489 */ 1490 1491 int imacsec_plp_base_t_secy_rule_index_get(int unit, soc_port_t port, unsigned int macsec_side, 1492 const bcm_plp_base_t_secy_rule_handle_t rule_handle, 1493 unsigned int * const rule_index_p) 1494 { 1495 phy_ctrl_t *pc; 1496 int rv=0; 1497 bcm_plp_base_t_sec_access_t *pa; 1498 EXT_PHY_INIT_CHECK(unit,port); 1499 pc = EXT_PHY_SW_STATE(unit, port); 1500 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 1501 rv = bcm_base_t_secy_rule_index_get(pa, rule_handle, rule_index_p); 1502 if(rv !=0){ 1503 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_rule_index_get failed:%d\n "), rv)); 1504 } 1505 return rv; 1506 1507 } 1508 /*! \brief imacsec_plp_base_t_secy_vport_index_get 1509 * 1510 * Gets the vPort index from an vPort, using the vPort handle. 1511 * 1512 * @pre API use order: 1513 * This function may be called for the vPortHandle obtained via 1514 * the imacsec_plp_base_t_secy_vport_add() function for the same DeviceId. 1515 * 1516 * @param unit (input) BCM unit number 1517 * @param port (input) - port number 1518 * @param macsec_side (input) - selects egress or ingress path 1519 * 0 - egress path 1520 * 1 - ingress path 1521 * 1522 * @param [in] vport_handle 1523 * vPort handle of the vPort to get the index from. 1524 * 1525 * @param [out] vport_index_p 1526 * Pointer to a memory location where the vPort index will be stored. 1527 * 1528 * This function is re-entrant for the same or different Devices. 1529 * 1530 * This function can be called concurrently with any other secy API 1531 * function for the same or different macsec_side provided the API use order 1532 * is followed. 1533 * 1534 * @return 1535 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 1536 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 1537 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 1538 */ 1539 1540 int imacsec_plp_base_t_secy_vport_index_get(int unit, soc_port_t port, unsigned int macsec_side, 1541 const bcm_plp_base_t_secy_vport_handle_t vport_handle, 1542 unsigned int * const vport_index_p) 1543 { 1544 phy_ctrl_t *pc; 1545 int rv=0; 1546 bcm_plp_base_t_sec_access_t *pa; 1547 EXT_PHY_INIT_CHECK(unit,port); 1548 pc = EXT_PHY_SW_STATE(unit, port); 1549 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 1550 rv = bcm_base_t_secy_vport_index_get(pa, vport_handle, vport_index_p); 1551 if(rv !=0){ 1552 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_vport_index_get failed:%d\n "), rv)); 1553 } 1554 return rv; 1555 1556 } 1557 /*! \brief imacsec_plp_base_t_secy_sa_handle_get 1558 * 1559 * Get the SA handle from an SA, using the SA index. 1560 * 1561 * @pre API use order:\n 1562 * This function can be called after the function imacsec_plp_base_t_secy_init() 1563 * and secy_sa_add is called. 1564 * @param unit (input) BCM unit number 1565 * @param port (input) - port number 1566 * @param macsec_side (input) - selects egress or ingress path 1567 * 0 - egress path 1568 * 1 - ingress path 1569 * 1570 * @param [in] sa_index 1571 * Secure Association index for which the SA handle must be returned. 1572 * 1573 * @param [out] sa_handle_p 1574 * Pointer to a memory location where the SA handle will be stored. 1575 * 1576 * This function is re-entrant for the same or different Devices. 1577 * 1578 * This function can be called concurrently with any other SecY API 1579 * function for the same or different macsec_side provided the API use order 1580 * is followed. 1581 * 1582 * @return 1583 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 1584 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 1585 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 1586 1587 */ 1588 1589 int imacsec_plp_base_t_secy_sa_handle_get(int unit, soc_port_t port, unsigned int macsec_side, 1590 const unsigned int sa_index, 1591 bcm_plp_base_t_secy_sa_handle_t * const sa_handle_p) 1592 { 1593 phy_ctrl_t *pc; 1594 int rv=0; 1595 bcm_plp_base_t_sec_access_t *pa; 1596 EXT_PHY_INIT_CHECK(unit,port); 1597 pc = EXT_PHY_SW_STATE(unit, port); 1598 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 1599 rv = bcm_base_t_secy_sa_handle_get(pa, sa_index, sa_handle_p); 1600 if(rv !=0){ 1601 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_sa_handle_get failed:%d\n "), rv)); 1602 } 1603 return rv; 1604 1605 } 1606 /*! \brief imacsec_plp_base_t_secy_rule_handle_get 1607 * 1608 * Gets the Rule handle from a Rule, using the Rule index 1609 * 1610 * @pre API use order: 1611 * This function can be called after the function imacsec_plp_base_t_secy_init() 1612 * and before the function imacsec_plp_base_t_secy_unint() is called. 1613 * 1614 * @param unit (input) BCM unit number 1615 * @param port (input) - port number 1616 * @param macsec_side (input) - selects egress or ingress path 1617 * 0 - egress path 1618 * 1 - ingress path 1619 * 1620 * @param [in] rule_index 1621 * Rule index for which the Rule handle must be returned. 1622 * 1623 * @param [out] rule_handle_p 1624 * Pointer to a memory location where the Rule handle will be stored. 1625 * 1626 * This function is re-entrant for the same or different Devices. 1627 * 1628 * This function can be called concurrently with any other secy API 1629 * function for the same or different macsec_side provided the API use order 1630 * is followed. 1631 * 1632 * @return 1633 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 1634 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 1635 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 1636 1637 */ 1638 1639 int imacsec_plp_base_t_secy_rule_handle_get(int unit, soc_port_t port, unsigned int macsec_side, 1640 const unsigned int rule_index, 1641 bcm_plp_base_t_secy_rule_handle_t * const rule_handle_p) 1642 { 1643 phy_ctrl_t *pc; 1644 int rv=0; 1645 bcm_plp_base_t_sec_access_t *pa; 1646 EXT_PHY_INIT_CHECK(unit,port); 1647 pc = EXT_PHY_SW_STATE(unit, port); 1648 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 1649 rv = bcm_base_t_secy_rule_handle_get(pa, rule_index, rule_handle_p); 1650 if(rv !=0){ 1651 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_rule_handle_get failed:%d\n "), rv)); 1652 } 1653 return rv; 1654 1655 } 1656 /*! \brief imacsec_plp_base_t_secy_vport_handle_get 1657 * 1658 * Gets the vPort handle from an vPort, using the vPort index. 1659 * 1660 * @pre API use order: 1661 * This function can be called after the function imacsec_plp_base_t_secy_init() 1662 * and before the function imacsec_plp_base_t_secy_unint() is called. 1663 * 1664 * @param unit (input) BCM unit number 1665 * @param port (input) - port number 1666 * @param macsec_side (input) - selects egress or ingress path 1667 * 0 - egress path 1668 * 1 - ingress path 1669 * 1670 * @param [in] vport_index 1671 * vPort index for which the vPort handle must be returned. 1672 * 1673 * @param [out] vport_handle_p 1674 * Pointer to a memory location where the vPort handle will be stored. 1675 * 1676 * This function is re-entrant for the same or different Devices. 1677 * 1678 * This function can be called concurrently with any other secy API 1679 * function for the same or different macsec_side provided the API use order 1680 * is followed. 1681 * 1682 * @return 1683 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 1684 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 1685 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 1686 1687 */ 1688 1689 int imacsec_plp_base_t_secy_vport_handle_get(int unit, soc_port_t port, unsigned int macsec_side, 1690 const unsigned int vport_index, 1691 bcm_plp_base_t_secy_vport_handle_t * const vport_handle_p) 1692 { 1693 phy_ctrl_t *pc; 1694 int rv=0; 1695 bcm_plp_base_t_sec_access_t *pa; 1696 EXT_PHY_INIT_CHECK(unit,port); 1697 pc = EXT_PHY_SW_STATE(unit, port); 1698 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 1699 rv = bcm_base_t_secy_vport_handle_get(pa, vport_index, vport_handle_p); 1700 if(rv !=0){ 1701 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_vport_handle_get failed:%d\n "), rv)); 1702 } 1703 return rv; 1704 1705 } 1706 1707 /**---------------------------------------------------------------------------- 1708 * imacsec_plp_base_t_secy_tcam_statistics_get 1709 * 1710 * This function reads the TCAM device statistics. 1711 * 1712 * @param unit (input) BCM unit number 1713 * @param port (input) - port number 1714 * @param macsec_side (input) - selects egress or ingress path 1715 * 0 - egress path 1716 * 1 - ingress path 1717 * @param [in] rule_handle 1718 * The Rule handle to read the statistics for. 1719 * 1720 * @param [out] stat_p 1721 * Pointer to the memory location where the device statistics 1722 * counter identified by RuleIndex will be stored. 1723 * 1724 * @param [in] fsync 1725 * If true then this function will ensure that all the packets 1726 * available in the device at the time of the function call are processed 1727 * before the statistics is read. 1728 * 1729 * This function is NOT re-entrant for the same Device when fsync is true. 1730 * This function is re-entrant for the same Device when fsync is false. 1731 * This function is re-entrant for different Devices. 1732 * 1733 * If fsync is set to true then this function cannot be called concurrently 1734 * with any other function of the SecY API which also takes fsync parameter 1735 * set to true for the same macsec_side. 1736 * 1737 * @return 1738 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 1739 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 1740 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 1741 */ 1742 int imacsec_plp_base_t_secy_tcam_statistics_get(int unit, soc_port_t port, unsigned int macsec_side, 1743 const bcm_plp_base_t_secy_rule_handle_t rule_handle, 1744 bcm_plp_base_t_secy_tcam_stat_t * const stat_p, 1745 const unsigned char fsync) 1746 { 1747 phy_ctrl_t *pc; 1748 int rv=0; 1749 bcm_plp_base_t_sec_access_t *pa; 1750 EXT_PHY_INIT_CHECK(unit,port); 1751 pc = EXT_PHY_SW_STATE(unit, port); 1752 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 1753 rv = bcm_base_t_secy_tcam_statistics_get(pa, rule_handle, stat_p, fsync); 1754 if(rv !=0){ 1755 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_tcam_statistics_get failed:%d\n "), rv)); 1756 } 1757 return rv; 1758 } 1759 1760 /**---------------------------------------------------------------------------- 1761 * imacsec_plp_base_t_secy_rxcam_statistics_get 1762 * 1763 * Reads RxCAM statistics (ingress only) from a SecY device instance 1764 * identified by macsec_side parameter. 1765 * 1766 * @note This function can be called for the device that has been initialized 1767 * for the ingress or combined egress/ingress role. 1768 * 1769 * @param unit (input) BCM unit number 1770 * @param port (input) - port number 1771 * @param macsec_side (input) - selects egress or ingress path 1772 * 0 - egress path 1773 * 1 - ingress path 1774 * 1775 * @param [in] scindex 1776 * Index of the Secure Channel for which the RxCAM statistics must be 1777 * read. 1778 * 1779 * @param [out] stats_p 1780 * Pointer to a memory location where the ingress RxCAM statistics 1781 * will be stored. 1782 * 1783 * @param [in] fsync 1784 * If true then this function will ensure that all the packets 1785 * available in the device at the time of the function call are processed 1786 * before the statistics is read. 1787 * 1788 * This function is NOT re-entrant for the same scindex no matter what fsync 1789 * value is.\n 1790 * This function is NOT re-entrant for the same Device when fsync is true.\n 1791 * This function is re-entrant for the same Device when fSync is false.\n 1792 * This function is re-entrant for different Devices.\n 1793 * 1794 * If fsync is set to true then this function cannot be called concurrently 1795 * with any other function of the SecY API which also takes fsync parameter 1796 * set to true for the same Device. 1797 * 1798 * @return 1799 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 1800 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 1801 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 1802 */ 1803 int imacsec_plp_base_t_secy_rxcam_statistics_get(int unit, soc_port_t port, unsigned int macsec_side, 1804 const unsigned int scindex, 1805 bcm_plp_base_t_secy_rxcam_stat_t* const stats_p, 1806 const unsigned char fsync) 1807 { 1808 phy_ctrl_t *pc; 1809 int rv=0; 1810 bcm_plp_base_t_sec_access_t *pa; 1811 EXT_PHY_INIT_CHECK(unit,port); 1812 pc = EXT_PHY_SW_STATE(unit, port); 1813 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 1814 rv = bcm_base_t_secy_rxcam_statistics_get(pa, scindex, stats_p, fsync); 1815 if(rv !=0){ 1816 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_rxcam_statistics_get failed:%d\n "), rv)); 1817 } 1818 return rv; 1819 1820 } 1821 /**---------------------------------------------------------------------------- 1822 * imacsec_plp_base_t_secy_secy_statistics_i_get 1823 * 1824 * Reads ingress SecY statistics from a SecY device instance identified by 1825 * macsec_side parameter. 1826 * 1827 * @note This function can be called for the device that has been initialized 1828 * for the ingress or combined egress/ingress role. 1829 * 1830 * API use order: 1831 * This function may be called for the SAHandle obtained via 1832 * the imacsec_plp_base_t_secy_sa_add(pa) function for the same macsec_side. 1833 * 1834 * 1835 * @param unit (input) BCM unit number 1836 * @param port (input) - port number 1837 * @param macsec_side (input) - selects egress or ingress path 1838 * 0 - egress path 1839 * 1 - ingress path 1840 * 1841 * @param [in] vport_handle 1842 * vPort handle for which the SecY statistics must be read. 1843 * 1844 * @param [out] stats_p 1845 * Pointer to a memory location where the ingress SecY statistics 1846 * will be stored. 1847 * 1848 * @param [in] fsync 1849 * If true then this function will ensure that all the packets 1850 * available in the device at the time of the function call are processed 1851 * before the statistics is read. 1852 * 1853 * This function is NOT re-entrant for the same vPort no matter what fsync 1854 * value is.\n 1855 * This function is NOT re-entrant for the same Device when fsync is true.\n 1856 * This function is re-entrant for the same Device when fsync is false.\n 1857 * This function is re-entrant for different Devices.\n 1858 * 1859 * If fsync is set to true then this function cannot be called concurrently 1860 * with any other function of the SecY API which also takes fsync parameter 1861 * set to true for the same Device. 1862 * 1863 * @return 1864 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 1865 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 1866 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 1867 */ 1868 1869 int imacsec_plp_base_t_secy_secy_statistics_i_get(int unit, soc_port_t port, unsigned int macsec_side, 1870 bcm_plp_base_t_secy_vport_handle_t vport_handle, 1871 bcm_plp_base_t_secy_secy_stat_i_t * const stats_p, 1872 const unsigned char fsync) 1873 1874 { 1875 phy_ctrl_t *pc; 1876 int rv=0; 1877 bcm_plp_base_t_sec_access_t *pa; 1878 EXT_PHY_INIT_CHECK(unit,port); 1879 pc = EXT_PHY_SW_STATE(unit, port); 1880 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 1881 rv = bcm_base_t_secy_secy_statistics_i_get(pa, vport_handle, stats_p,fsync); 1882 if(rv !=0){ 1883 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_secy_statistics_i_get failed:%d\n "), rv)); 1884 } 1885 return rv; 1886 } 1887 1888 /**---------------------------------------------------------------------------- 1889 * imacsec_plp_base_t_secy_secy_statistics_e_get 1890 * 1891 * Reads egress SecY statistics from a SecY device instance identified by 1892 * macsec_side parameter. 1893 * 1894 * @note This function can be called for the device that has been initialized 1895 * for the egress or combined egress/ingress role. 1896 * 1897 * API use order: 1898 * This function may be called for the SAHandle obtained via 1899 * the bcm_base_t_secy_sa_add(pa) function for the same macsec_side. 1900 * 1901 * @param unit (input) BCM unit number 1902 * @param port (input) - port number 1903 * @param macsec_side (input) - selects egress or ingress path 1904 * 0 - egress path 1905 * 1 - ingress path 1906 * 1907 * @param [in] vport_handle 1908 * vPort handle for which the SecY statistics must be read. 1909 * 1910 * @param [out] stats_p 1911 * Pointer to a memory location where the egress SecY statistics 1912 * will be stored. 1913 * 1914 * @param [in] fsync 1915 * If true then this function will ensure that all the packets 1916 * available in the device at the time of the function call are processed 1917 * before the statistics is read. 1918 * 1919 * This function is NOT re-entrant for the same vPort no matter what fsync 1920 * value is.\n 1921 * This function is NOT re-entrant for the same Device when fsync is true.\n 1922 * This function is re-entrant for the same Device when fSync is false.\n 1923 * This function is re-entrant for different Devices.\n 1924 * 1925 * If fSync is set to true then this function cannot be called concurrently 1926 * with any other function of the SecY API which also takes fSync parameter 1927 * set to true for the same Device. 1928 * 1929 * @return 1930 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 1931 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 1932 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 1933 */ 1934 1935 int imacsec_plp_base_t_secy_secy_statistics_e_get(int unit, soc_port_t port, unsigned int macsec_side, 1936 bcm_plp_base_t_secy_vport_handle_t vport_handle, 1937 bcm_plp_base_t_secy_secy_stat_e_t * const stats_p, 1938 const unsigned char fsync) 1939 { 1940 phy_ctrl_t *pc; 1941 int rv=0; 1942 bcm_plp_base_t_sec_access_t *pa; 1943 EXT_PHY_INIT_CHECK(unit,port); 1944 pc = EXT_PHY_SW_STATE(unit, port); 1945 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 1946 rv = bcm_base_t_secy_secy_statistics_e_get(pa, vport_handle, stats_p,fsync); 1947 if(rv !=0){ 1948 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_secy_statistics_e_get failed:%d\n "), rv)); 1949 } 1950 return rv; 1951 } 1952 1953 /**---------------------------------------------------------------------------- 1954 * imacsec_plp_base_t_secy_sa_statistics_i_get 1955 * 1956 * Reads ingress SA statistics from a SecY device instance identified by 1957 * macsec_side parameter. 1958 * 1959 * @note This function can be called for the device that has been initialized 1960 * for the ingress or combined egress/ingress role. 1961 * 1962 * API use order: 1963 * This function may be called for the SAHandle obtained via 1964 * the imacsec_plp_base_t_secy_sa_add(pa) function for the same macsec_side. 1965 * 1966 * @param unit (input) BCM unit number 1967 * @param port (input) - port number 1968 * @param macsec_side (input) - selects egress or ingress path 1969 * 0 - egress path 1970 * 1 - ingress path 1971 * 1972 * 1973 * @param [in] sa_handle 1974 * SA handle of the SA for which the statistics must be read. 1975 * 1976 * @param [out] stats_p 1977 * Pointer to a memory location where the ingress SA statistics 1978 * will be stored. 1979 * 1980 * @param [in] fsync 1981 * If true then this function will ensure that all the packets 1982 * available in the device at the time of the function call are processed 1983 * before the statistics is read. 1984 * 1985 * This function is NOT re-entrant for the same SAHandle no matter what fSync 1986 * value is.\n 1987 * This function is NOT re-entrant for the same Device when fsync is true.\n 1988 * This function is re-entrant for the same Device when fsync is false.\n 1989 * This function is re-entrant for different Devices.\n 1990 * 1991 * If fSync is set to true then this function cannot be called concurrently 1992 * with any other function of the SecY API which also takes fSync parameter 1993 * set to true for the same macsec_side. 1994 * 1995 * @return 1996 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 1997 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 1998 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 1999 */ 2000 2001 int imacsec_plp_base_t_secy_sa_statistics_i_get(int unit, soc_port_t port, unsigned int macsec_side, 2002 const bcm_plp_base_t_secy_sa_handle_t sa_handle, 2003 bcm_plp_base_t_secy_sa_stat_i_t * const stats_p, 2004 const unsigned char fsync) 2005 { 2006 phy_ctrl_t *pc; 2007 int rv=0; 2008 bcm_plp_base_t_sec_access_t *pa; 2009 EXT_PHY_INIT_CHECK(unit,port); 2010 pc = EXT_PHY_SW_STATE(unit, port); 2011 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 2012 rv = bcm_base_t_secy_sa_statistics_i_get(pa, sa_handle, stats_p,fsync); 2013 if(rv !=0){ 2014 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_sa_statistics_i_get failed:%d\n "), rv)); 2015 } 2016 return rv; 2017 2018 } 2019 /**---------------------------------------------------------------------------- 2020 * imacsec_plp_base_t_secy_sa_statistics_e_get 2021 * 2022 * Reads egress SA statistics from a SecY device instance identified by 2023 * macsec_side parameter. 2024 * 2025 * @note This function can be called for the device that has been initialized 2026 * for the egress or combined egress/ingress role. 2027 * 2028 * API use order: 2029 * This function may be called for the SAHandle obtained via 2030 * imacsec_plp_base_t_secy_sa_add(pa) function for the same macsec_side. 2031 * 2032 * @param unit (input) BCM unit number 2033 * @param port (input) - port number 2034 * @param macsec_side (input) - selects egress or ingress path 2035 * 0 - egress path 2036 * 1 - ingress path 2037 * 2038 * 2039 * @param [in] sa_handle 2040 * SA handle of the SA for which the statistics must be read. 2041 * 2042 * @param [out] stats_p 2043 * Pointer to a memory location where the egress SA statistics 2044 * will be stored. 2045 * 2046 * @param [in] fsync 2047 * If true then this function will ensure that all the packets 2048 * available in the device at the time of the function call are processed 2049 * before the statistics is read. 2050 * 2051 * This function is NOT re-entrant for the same SAHandle no matter what fsync 2052 * value is.\n 2053 * This function is NOT re-entrant for the same Device when fsync is true.\n 2054 * This function is re-entrant for the same Device when fsync is false.\n 2055 * This function is re-entrant for different Devices.\n 2056 * 2057 * If fsync is set to true then this function cannot be called concurrently 2058 * with any other function of the SecY API which also takes fsync parameter 2059 * set to true for the same macsec_side. 2060 * 2061 * @return 2062 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 2063 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 2064 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 2065 */ 2066 2067 2068 int imacsec_plp_base_t_secy_sa_statistics_e_get(int unit, soc_port_t port, unsigned int macsec_side, 2069 const bcm_plp_base_t_secy_sa_handle_t sa_handle, 2070 bcm_plp_base_t_secy_sa_stat_e_t * const stats_p, 2071 const unsigned char fsync) 2072 { 2073 phy_ctrl_t *pc; 2074 int rv=0; 2075 bcm_plp_base_t_sec_access_t *pa; 2076 EXT_PHY_INIT_CHECK(unit,port); 2077 pc = EXT_PHY_SW_STATE(unit, port); 2078 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 2079 rv = bcm_base_t_secy_sa_statistics_e_get(pa, sa_handle, stats_p,fsync); 2080 if(rv !=0){ 2081 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_sa_statistics_e_get failed:%d\n "), rv)); 2082 } 2083 return rv; 2084 2085 } 2086 /**---------------------------------------------------------------------------- 2087 * imacsec_plp_base_t_secy_global_statistics_get 2088 * 2089 * This function reads the Global device statistics. 2090 * 2091 * @param unit (input) BCM unit number 2092 * @param port (input) - port number 2093 * @param macsec_side (input) - selects egress or ingress path 2094 * 0 - egress path 2095 * 1 - ingress path 2096 * 2097 * @param [out] stat_p 2098 * Pointer to the memory location where the device statistics 2099 * counter be stored. 2100 * 2101 * @param [in] fsync 2102 * If true then this function will ensure that all the packets 2103 * available in the device at the time of the function call are processed 2104 * before the statistics is read. 2105 * 2106 * This function is NOT re-entrant for the same Device when fsync is true. 2107 * This function is re-entrant for the same Device when fsync is false. 2108 * This function is re-entrant for different Devices. 2109 * 2110 * If fSync is set to true then this function cannot be called concurrently 2111 * with any other function of the SecY API which also takes fsync parameter 2112 * set to true for the same macsec_side. 2113 * 2114 * @return 2115 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 2116 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 2117 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 2118 */ 2119 2120 int imacsec_plp_base_t_secy_global_statistics_get(int unit, soc_port_t port, unsigned int macsec_side, 2121 bcm_plp_base_t_secy_global_stat_t * const stat_p, 2122 const unsigned char fsync) 2123 { 2124 phy_ctrl_t *pc; 2125 int rv=0; 2126 bcm_plp_base_t_sec_access_t *pa; 2127 EXT_PHY_INIT_CHECK(unit,port); 2128 pc = EXT_PHY_SW_STATE(unit, port); 2129 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 2130 rv = bcm_base_t_secy_global_statistics_get(pa, stat_p,fsync); 2131 if(rv !=0){ 2132 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_global_statistics_get failed:%d\n "), rv)); 2133 } 2134 return rv; 2135 2136 } 2137 /**---------------------------------------------------------------------------- 2138 * imacsec_plp_base_t_secy_ifc_statistics_e_get 2139 * 2140 * Reads egress interface statistics from a SecY device instance identified 2141 * by macsec_side parameter. 2142 * 2143 * @note This function can be called for the device that has been initialized 2144 * for the egress or combined egress/ingress role. 2145 * 2146 * @param unit (input) BCM unit number 2147 * @param port (input) - port number 2148 * @param macsec_side (input) - selects egress or ingress path 2149 * 0 - egress path 2150 * 1 - ingress path 2151 * 2152 * 2153 * @param [in] vport_handle 2154 * vPort handle for which the interface statistics must be read. 2155 * 2156 * @param [out] stats_p 2157 * Pointer to a memory location where the egress interface statistics 2158 * will be stored. 2159 * 2160 * @param [in] fsync 2161 * If true then this function will ensure that all the packets 2162 * available in the device at the time of the function call are processed 2163 * before the statistics is read. 2164 * 2165 * This function is NOT re-entrant for the same vPort no matter what fSync 2166 * value is.\n 2167 * This function is NOT re-entrant for the same Device when fSync is true.\n 2168 * This function is re-entrant for the same Device when fSync is false.\n 2169 * This function is re-entrant for different Devices.\n 2170 * 2171 * If fSync is set to true then this function cannot be called concurrently 2172 * with any other function of the SecY API which also takes fSync parameter 2173 * set to true for the same Device. 2174 * 2175 * @return 2176 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 2177 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 2178 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 2179 */ 2180 int imacsec_plp_base_t_secy_ifc_statistics_e_get(int unit, soc_port_t port, unsigned int macsec_side, 2181 bcm_plp_base_t_secy_vport_handle_t vport_handle, 2182 bcm_plp_base_t_secy_ifc_stat_e_t * const stats_p, 2183 const unsigned char fsync) 2184 { 2185 phy_ctrl_t *pc; 2186 int rv=0; 2187 bcm_plp_base_t_sec_access_t *pa; 2188 EXT_PHY_INIT_CHECK(unit,port); 2189 pc = EXT_PHY_SW_STATE(unit, port); 2190 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 2191 rv = bcm_base_t_secy_ifc_statistics_e_get(pa, vport_handle,stats_p,fsync); 2192 if(rv !=0){ 2193 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_ifc_statistics_e_get failed:%d\n "), rv)); 2194 } 2195 return rv; 2196 2197 } 2198 2199 /**---------------------------------------------------------------------------- 2200 * imacsec_plp_base_t_secy_ifc_statistics_i_get 2201 * 2202 * Reads ingress interface statistics from a SecY device instance identified 2203 * by macsec_side parameter. 2204 * 2205 * @note This function can be called for the device that has been initialized 2206 * for the ingress or combined egress/ingress role. 2207 * 2208 * @param unit (input) BCM unit number 2209 * @param port (input) - port number 2210 * @param macsec_side (input) - selects egress or ingress path 2211 * 0 - egress path 2212 * 1 - ingress path 2213 * 2214 * @param [in] vport_handle 2215 * vPort handle for which the interface statistics must be read. 2216 * 2217 * @param [out] stats_p 2218 * Pointer to a memory location where the ingress interface statistics 2219 * will be stored. 2220 * 2221 * @param [in] fsync 2222 * If true then this function will ensure that all the packets 2223 * available in the device at the time of the function call are processed 2224 * before the statistics is read. 2225 * 2226 * This function is NOT re-entrant for the same vPort no matter what fsync 2227 * value is.\n 2228 * This function is NOT re-entrant for the same Device when fSync is true.\n 2229 * This function is re-entrant for the same Device when fSync is false.\n 2230 * This function is re-entrant for different Devices.\n 2231 * 2232 * If fSync is set to true then this function cannot be called concurrently 2233 * with any other function of the XtSecY API which also takes fSync parameter 2234 * set to true for the same Device. 2235 * 2236 * @return 2237 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 2238 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 2239 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 2240 */ 2241 2242 int imacsec_plp_base_t_secy_ifc_statistics_i_get(int unit, soc_port_t port, unsigned int macsec_side, 2243 bcm_plp_base_t_secy_vport_handle_t vport_handle, 2244 bcm_plp_base_t_secy_ifc_stat_i_t * const stats_p, 2245 const unsigned char fsync) 2246 { 2247 phy_ctrl_t *pc; 2248 int rv=0; 2249 bcm_plp_base_t_sec_access_t *pa; 2250 EXT_PHY_INIT_CHECK(unit,port); 2251 pc = EXT_PHY_SW_STATE(unit, port); 2252 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 2253 rv = bcm_base_t_secy_ifc_statistics_i_get(pa, vport_handle,stats_p,fsync); 2254 if(rv !=0){ 2255 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_ifc_statistics_i_get failed:%d\n "), rv)); 2256 } 2257 return rv; 2258 } 2259 2260 /**---------------------------------------------------------------------------- 2261 * imacsec_plp_base_t_secy_device_count_summary_pifc_checkandclear 2262 * 2263 * Reads the values for Per-IFC count summary registers and clears the bits 2264 * that are set by hardware. Each bit represents an IFC (interface) that has 2265 * a statistics counter that crossed the threshold. 2266 * 2267 * @param unit (input) BCM unit number 2268 * @param port (input) - port number 2269 * @param macsec_side (input) - selects egress or ingress path 2270 * 0 - egress path 2271 * 1 - ingress path 2272 * 2273 * 2274 * @param [out] vport_handle_pp 2275 * Pointer to a memory location where a set of vPort handles, that have 2276 * their IFC statistics crossed the threshold, will be stored. 2277 * 2278 * @param [out] num_ifc_indexes_p 2279 * Pointer to a memory location where to save number of IFC indexes 2280 * whose statistics counters crossed the threshold. 2281 * 2282 * This function is NOT re-entrant for the same Device. 2283 * This function is re-entrant for different Devices. 2284 * 2285 * @return 2286 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 2287 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 2288 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 2289 */ 2290 int imacsec_plp_base_t_secy_device_count_summary_pifc_checkandclear(int unit, soc_port_t port, unsigned int macsec_side, 2291 bcm_plp_base_t_secy_vport_handle_t ** const vport_handle_pp, 2292 unsigned int * const num_ifc_indexes_p) 2293 { 2294 phy_ctrl_t *pc; 2295 int rv=0; 2296 bcm_plp_base_t_sec_access_t *pa; 2297 EXT_PHY_INIT_CHECK(unit,port); 2298 pc = EXT_PHY_SW_STATE(unit, port); 2299 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 2300 rv = bcm_base_t_secy_device_count_summary_pifc_checkandclear(pa, vport_handle_pp,num_ifc_indexes_p); 2301 if(rv !=0){ 2302 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_device_count_summary_pifc_checkandclear failed:%d\n "), rv)); 2303 } 2304 return rv; 2305 2306 } 2307 2308 /**---------------------------------------------------------------------------- 2309 * imacsec_plp_base_t_secy_device_count_summary_prxcam_checkandclear 2310 * 2311 * Reads the values for Per-RxCAM count summary registers and clears the bits 2312 * that are set by hardware. Each bit represents an RxCAM hit counter that has 2313 * crossed the threshold. 2314 * 2315 * @param unit (input) BCM unit number 2316 * @param port (input) - port number 2317 * @param macsec_side (input) - selects egress or ingress path 2318 * 0 - egress path 2319 * 1 - ingress path 2320 * 2321 * @param [out] rx_cam_indexes_pp 2322 * Pointer to a memory location where a set of RxCAM hit counter indexes 2323 * that have their statistics crossed the threshold will be stored. 2324 * 2325 * @param [out] num_rx_cam_indexes_p 2326 * Pointer to a memory location where to save number of RxCAM hit counter 2327 * indexes whose statistics counters crossed the threshold. 2328 * 2329 * This function is NOT re-entrant for the same Device. 2330 * This function is re-entrant for different Devices. 2331 * 2332 * @return 2333 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 2334 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 2335 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 2336 */ 2337 int imacsec_plp_base_t_secy_device_count_summary_prxcam_checkandclear(int unit, soc_port_t port, unsigned int macsec_side, 2338 unsigned int ** const rx_cam_indexes_pp, 2339 unsigned int * const num_rx_cam_indexes_p) 2340 { 2341 phy_ctrl_t *pc; 2342 int rv=0; 2343 bcm_plp_base_t_sec_access_t *pa; 2344 EXT_PHY_INIT_CHECK(unit,port); 2345 pc = EXT_PHY_SW_STATE(unit, port); 2346 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 2347 rv = bcm_base_t_secy_device_count_summary_prxcam_checkandclear(pa, rx_cam_indexes_pp, num_rx_cam_indexes_p); 2348 if(rv !=0){ 2349 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_device_count_summary_prxcam_checkandclear failed:%d\n "), rv)); 2350 } 2351 return rv; 2352 } 2353 /**---------------------------------------------------------------------------- 2354 * imacsec_plp_base_t_secy_device_count_summary_psa_checkandclear 2355 * 2356 * Reads the values for Per-SA expired summary registers and clears the bits 2357 * that are set by hardware. Each bit represents a SA that has a statistics 2358 * counter that crossed the threshold. 2359 * 2360 * @param unit (input) BCM unit number 2361 * @param port (input) - port number 2362 * @param macsec_side (input) - selects egress or ingress path 2363 * 0 - egress path 2364 * 1 - ingress path 2365 * 2366 * 2367 * @param [out] sa_handle_pp 2368 * Pointer to a memory location where a set of SA handles, that have 2369 * their SA statistics crossed the threshold, will be stored. 2370 * 2371 * @param [out] num_sa_indexes_p 2372 * Pointer to a memory location where to save number of SA indexes whose 2373 * statistics counters crossed the threshold. 2374 * 2375 * This function is NOT re-entrant for the same Device. 2376 * This function is re-entrant for different Devices. 2377 * 2378 * This function cannot be called concurrently with bcm_base_t_secy_sa_remove 2379 * for the same macsec_side. 2380 * 2381 * @return 2382 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 2383 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 2384 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 2385 */ 2386 2387 int imacsec_plp_base_t_secy_device_count_summary_psa_checkandclear(int unit, soc_port_t port, unsigned int macsec_side, 2388 bcm_plp_base_t_secy_sa_handle_t ** const sa_handle_pp, 2389 unsigned int * const num_sa_indexes_p) 2390 { 2391 phy_ctrl_t *pc; 2392 int rv=0; 2393 bcm_plp_base_t_sec_access_t *pa; 2394 EXT_PHY_INIT_CHECK(unit,port); 2395 pc = EXT_PHY_SW_STATE(unit, port); 2396 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 2397 rv = bcm_base_t_secy_device_count_summary_psa_checkandclear(pa, sa_handle_pp, num_sa_indexes_p); 2398 if(rv !=0){ 2399 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_device_count_summary_psa_checkandclear failed:%d\n "), rv)); 2400 } 2401 return rv; 2402 2403 } 2404 /**---------------------------------------------------------------------------- 2405 * imacsec_plp_base_t_secy_device_count_summary_psecy_checkandclear 2406 * 2407 * Reads the values for the Per-SecY count summary registers and clears the 2408 * bits that are set by hardware. Each bit represents a SecY that has a 2409 * statistics counter that crossed the threshold. 2410 * 2411 * @param unit (input) BCM unit number 2412 * @param port (input) - port number 2413 * @param macsec_side (input) - selects egress or ingress path 2414 * 0 - egress path 2415 * 1 - ingress path 2416 * 2417 * @param [out] vport_handle_pp 2418 * Pointer to a memory location where a set of vPort Handles, that have 2419 * their SecY statistics crossed the threshold, will be stored. 2420 * 2421 * @param [out] nm_secy_indexes_p 2422 * Pointer to a memory location where to save number of SecY indexes 2423 * whose statistics counters crossed the threshold. 2424 * 2425 * This function is NOT re-entrant for the same Device. 2426 * This function is re-entrant for different Devices. 2427 * 2428 * @return 2429 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 2430 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 2431 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 2432 */ 2433 2434 int imacsec_plp_base_t_secy_device_count_summary_psecy_checkandclear(int unit, soc_port_t port, unsigned int macsec_side, 2435 bcm_plp_base_t_secy_vport_handle_t ** const vport_handle_pp, 2436 unsigned int * const nm_secy_indexes_p) 2437 { 2438 phy_ctrl_t *pc; 2439 int rv=0; 2440 bcm_plp_base_t_sec_access_t *pa; 2441 EXT_PHY_INIT_CHECK(unit,port); 2442 pc = EXT_PHY_SW_STATE(unit, port); 2443 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 2444 rv = bcm_base_t_secy_device_count_summary_psecy_checkandclear(pa, vport_handle_pp, nm_secy_indexes_p); 2445 if(rv !=0){ 2446 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_device_count_summary_psecy_checkandclear failed:%d\n "), rv)); 2447 } 2448 return rv; 2449 } 2450 /**---------------------------------------------------------------------------- 2451 * imacsec_plp_base_t_secy_device_count_summary_ptcam_checkandclear 2452 * 2453 * Reads the values for Per-TCAM count summary registers and clear the bits 2454 * that are set by hardware. Each bit represents an TCAM that has 2455 * a statistics counter that crossed the threshold. 2456 * 2457 * @param unit (input) BCM unit number 2458 * @param port (input) - port number 2459 * @param macsec_side (input) - selects egress or ingress path 2460 * 0 - egress path 2461 * 1 - ingress path 2462 * 2463 * @param [out] rule_handle_pp 2464 * Pointer to a memory location where a set of Rule handles, that have 2465 * their TCAM statistics crossed the threshold, will be stored. 2466 * 2467 * @param [out] num_tcam_indexes_p 2468 * Pointer to a memory location where to save number of TCAM indexes 2469 * whose statistics counters crossed the threshold. 2470 * 2471 * This function is NOT re-entrant for the same Device. 2472 * This function is re-entrant for different Devices. 2473 * 2474 * @return 2475 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 2476 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 2477 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 2478 */ 2479 2480 int imacsec_plp_base_t_secy_device_count_summary_ptcam_checkandclear(int unit, soc_port_t port, unsigned int macsec_side, 2481 bcm_plp_base_t_secy_rule_handle_t ** const rule_handle_pp, 2482 unsigned int * const num_tcam_indexes_p) 2483 { 2484 phy_ctrl_t *pc; 2485 int rv=0; 2486 bcm_plp_base_t_sec_access_t *pa; 2487 EXT_PHY_INIT_CHECK(unit,port); 2488 pc = EXT_PHY_SW_STATE(unit, port); 2489 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 2490 rv = bcm_base_t_secy_device_count_summary_ptcam_checkandclear(pa, rule_handle_pp, num_tcam_indexes_p); 2491 if(rv !=0){ 2492 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_device_count_summary_ptcam_checkandclear failed:%d\n "), rv)); 2493 } 2494 return rv; 2495 } 2496 /**---------------------------------------------------------------------------- 2497 * imacsec_plp_base_t_secy_device_count_summary_sa_checkandclear 2498 * 2499 * Reads the value of a SA statistics summary register and clears the bits that 2500 * are set by hardware. Each bit represents a SA statistics counter. If the 2501 * bit is set, it indicates that the corresponding counter has crossed the set 2502 * threshold. 2503 * 2504 * @param unit (input) BCM unit number 2505 * @param port (input) - port number 2506 * @param macsec_side (input) - selects egress or ingress path 2507 * 0 - egress path 2508 * 1 - ingress path 2509 * 2510 * 2511 * @param [in] sa_handle 2512 * SA handle for the SA to be checked. 2513 * 2514 * @param [out] count_summary_sa_p 2515 * Pointer to a memory location where saves a set of bits, each of them 2516 * represents one SA statistics counters. 2517 * 2518 * This function is NOT re-entrant for the same Device. 2519 * This function is re-entrant for different Devices. 2520 * 2521 * This function cannot be called concurrently with imacsec_plp_base_t_secy_sa_remove 2522 * for the same macsec_side. 2523 * 2524 * @return 2525 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 2526 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 2527 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 2528 */ 2529 2530 int imacsec_plp_base_t_secy_device_count_summary_sa_checkandclear(int unit, soc_port_t port, unsigned int macsec_side, 2531 bcm_plp_base_t_secy_sa_handle_t sa_handle, 2532 unsigned int * const count_summary_sa_p) 2533 { 2534 phy_ctrl_t *pc; 2535 int rv=0; 2536 bcm_plp_base_t_sec_access_t *pa; 2537 EXT_PHY_INIT_CHECK(unit,port); 2538 pc = EXT_PHY_SW_STATE(unit, port); 2539 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 2540 rv = bcm_base_t_secy_device_count_summary_sa_checkandclear(pa, sa_handle, count_summary_sa_p); 2541 if(rv !=0){ 2542 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_device_count_summary_sa_checkandclear failed:%d\n "), rv)); 2543 } 2544 return rv; 2545 } 2546 /**---------------------------------------------------------------------------- 2547 * imacsec_plp_base_t_secy_device_count_summary_secy_checkandclear 2548 * 2549 * Reads the value of a SecY counter summary register and clears the bits that 2550 * are set by hardware. Each bit represents a SecY statistics counter. If the 2551 * bit is set, it indicates that the corresponding counter has crossed the set 2552 * threshold. 2553 * 2554 * @param unit (input) BCM unit number 2555 * @param port (input) - port number 2556 * @param macsec_side (input) - selects egress or ingress path 2557 * 0 - egress path 2558 * 1 - ingress path 2559 * 2560 * 2561 * @param [in] vport_handle 2562 * vPort handle of the SecY to be checked. 2563 * 2564 * @param [out] count_summary_secy_p 2565 * Pointer to a memory location in which a set of bits is returned, 2566 * each bit represents a SecY statistics counter. 2567 * 2568 * This function is NOT re-entrant for the same Device. 2569 * This function is re-entrant for different Devices. 2570 * 2571 * @return 2572 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 2573 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 2574 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 2575 */ 2576 int imacsec_plp_base_t_secy_device_count_summary_secy_checkandclear(int unit, soc_port_t port, unsigned int macsec_side, 2577 bcm_plp_base_t_secy_vport_handle_t vport_handle, 2578 unsigned int * const count_summary_secy_p) 2579 { 2580 phy_ctrl_t *pc; 2581 int rv=0; 2582 bcm_plp_base_t_sec_access_t *pa; 2583 EXT_PHY_INIT_CHECK(unit,port); 2584 pc = EXT_PHY_SW_STATE(unit, port); 2585 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 2586 rv = bcm_base_t_secy_device_count_summary_secy_checkandclear(pa, vport_handle, count_summary_secy_p); 2587 if(rv !=0){ 2588 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_device_count_summary_secy_checkandclear failed:%d\n "), rv)); 2589 } 2590 return rv; 2591 } 2592 /**---------------------------------------------------------------------------- 2593 * imacsec_plp_base_t_secy_device_count_summary_tcam_global_checkandclear 2594 * 2595 * Reads the value of the TCAM global counter summary register and clears the 2596 * bits that are set by hardware. Each bit represents an TCAM statistics 2597 * counter. If the bit is set, it indicates that the corresponding counter has 2598 * crossed the set threshold. 2599 * 2600 * @param unit (input) BCM unit number 2601 * @param port (input) - port number 2602 * @param macsec_side (input) - selects egress or ingress path 2603 * 0 - egress path 2604 * 1 - ingress path 2605 * 2606 * @param [out] count_summary_tcam_global_p 2607 * Pointer to a memory location in which a set of bits is returned, 2608 * each bit represents one IFC statistics counter. 2609 * 2610 * This function is NOT re-entrant for the same Device. 2611 * This function is re-entrant for different Devices. 2612 * 2613 * @return 2614 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 2615 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 2616 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 2617 */ 2618 int imacsec_plp_base_t_secy_device_count_summary_tcam_global_checkandclear(int unit, soc_port_t port, unsigned int macsec_side, 2619 unsigned int * const count_summary_tcam_global_p) 2620 { 2621 phy_ctrl_t *pc; 2622 int rv=0; 2623 bcm_plp_base_t_sec_access_t *pa; 2624 EXT_PHY_INIT_CHECK(unit,port); 2625 pc = EXT_PHY_SW_STATE(unit, port); 2626 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 2627 rv = bcm_base_t_secy_device_count_summary_tcam_global_checkandclear(pa, count_summary_tcam_global_p); 2628 if(rv !=0){ 2629 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_device_count_summary_tcam_global_checkandclear failed:%d\n "), rv)); 2630 } 2631 return rv; 2632 } 2633 /**---------------------------------------------------------------------------- 2634 * imacsec_plp_base_t_secy_device_count_summary_ifc_checkandclear 2635 * 2636 * Reads the value of a IFC counter summary register and clears the bits that 2637 * are set by hardware. Each bit represents an IFC statistics counter. If the 2638 * bit is set, it indicates that the corresponding counter has crossed the set 2639 * threshold. 2640 * 2641 * @param unit (input) BCM unit number 2642 * @param port (input) - port number 2643 * @param macsec_side (input) - selects egress or ingress path 2644 * 0 - egress path 2645 * 1 - ingress path 2646 * 2647 * 2648 * @param [in] vport_handle 2649 * vPort handle of the IFC to be checked. 2650 * 2651 * @param [out] count_summary_ifc_p 2652 * Pointer to a memory location in which a set of bits is returned, 2653 * each bit represents one IFC statistics counter. 2654 * 2655 * This function is NOT re-entrant for the same Device. 2656 * This function is re-entrant for different Devices. 2657 * 2658 * @return 2659 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 2660 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 2661 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 2662 2663 */ 2664 int imacsec_plp_base_t_secy_device_count_summary_ifc_checkandclear(int unit, soc_port_t port, unsigned int macsec_side, 2665 bcm_plp_base_t_secy_vport_handle_t vport_handle, 2666 unsigned int * const count_summary_ifc_p) 2667 { 2668 phy_ctrl_t *pc; 2669 int rv=0; 2670 bcm_plp_base_t_sec_access_t *pa; 2671 EXT_PHY_INIT_CHECK(unit,port); 2672 pc = EXT_PHY_SW_STATE(unit, port); 2673 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 2674 rv = bcm_base_t_secy_device_count_summary_ifc_checkandclear(pa, vport_handle, count_summary_ifc_p); 2675 if(rv !=0){ 2676 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_device_count_summary_ifc_checkandclear failed:%d\n "), rv)); 2677 } 2678 return rv; 2679 } 2680 /**---------------------------------------------------------------------------- 2681 * imacsec_plp_base_t_secy_sa_expired_summary_checkandclear 2682 * 2683 * Reads the values for SA expired summary registers and clears the bits that 2684 * are set by hardware. Each bit tells if one SA expired. 2685 * 2686 * @param unit (input) BCM unit number 2687 * @param port (input) - port number 2688 * @param macsec_side (input) - selects egress or ingress path 2689 * 0 - egress path 2690 * 1 - ingress path 2691 * 2692 * 2693 * @param [out] sa_handle_pp 2694 * Pointer to a memory location where the set of SA handles is stored, 2695 * whose SA have processed more than the threshold. 2696 * 2697 * @param [out] num_sa_indexes_p 2698 * Pointer to a memory location where to save number of SA indexes whose 2699 * statistics counters crossed the threshold. 2700 * 2701 * @return 2702 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 2703 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 2704 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 2705 */ 2706 int imacsec_plp_base_t_secy_sa_expired_summary_checkandclear(int unit, soc_port_t port, unsigned int macsec_side, 2707 bcm_plp_base_t_secy_sa_handle_t ** const sa_handle_pp, 2708 unsigned int * const num_sa_indexes_p) 2709 { 2710 phy_ctrl_t *pc; 2711 int rv=0; 2712 bcm_plp_base_t_sec_access_t *pa; 2713 EXT_PHY_INIT_CHECK(unit,port); 2714 pc = EXT_PHY_SW_STATE(unit, port); 2715 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 2716 rv = bcm_base_t_secy_sa_expired_summary_checkandclear(pa, sa_handle_pp, num_sa_indexes_p); 2717 if(rv !=0){ 2718 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_sa_expired_summary_checkandclear failed:%d\n "), rv)); 2719 } 2720 return rv; 2721 } 2722 /**---------------------------------------------------------------------------- 2723 * imacsec_plp_base_t_secy_sa_pnthr_summary_checkandclear 2724 * 2725 * Reads the values for SA packet number threshold summary registers and clears 2726 * the bits that are set by hardware. Each bit tells if one SA processed more 2727 * packets than the threshold set. 2728 * 2729 * @param pa 2730 * bcm_plp_base_t_sec phy access 2731 * 2732 * 2733 * @param [out] sa_handle_pp 2734 * Pointer to a memory location where the set of SA handles is stored, 2735 * whose SA have processed more than the threshold. 2736 * 2737 * @param [out] num_sa_indexes_p 2738 * Pointer to a memory location where to save number of SA indexes whose 2739 * statistics counters crossed the threshold. 2740 * 2741 * @return 2742 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 2743 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 2744 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 2745 */ 2746 int imacsec_plp_base_t_secy_sa_pnthr_summary_checkandclear(int unit, soc_port_t port, unsigned int macsec_side, 2747 bcm_plp_base_t_secy_sa_handle_t ** const sa_handle_pp, 2748 unsigned int * const num_sa_indexes_p) 2749 { 2750 phy_ctrl_t *pc; 2751 int rv=0; 2752 bcm_plp_base_t_sec_access_t *pa; 2753 EXT_PHY_INIT_CHECK(unit,port); 2754 pc = EXT_PHY_SW_STATE(unit, port); 2755 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 2756 rv = bcm_base_t_secy_sa_pnthr_summary_checkandclear(pa, sa_handle_pp, num_sa_indexes_p); 2757 if(rv !=0){ 2758 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_sa_pnthr_summary_checkandclear failed:%d\n "), rv)); 2759 } 2760 return rv; 2761 } 2762 2763 /*! \brief imacsec_plp_base_t_secy_intr_enable_set 2764 * 2765 * This API is used to enable SecY interrupts for specified events resulting in interrupts 2766 * 2767 * @param unit (input) BCM unit number 2768 * @param port (input) - port number 2769 * @param macsec_side (input) - selects egress or ingress path 2770 * 0 - egress path 2771 * 1 - ingress path 2772 * 2773 * @param[in] secy_intr_p 2774 * pointer to secy interrupt structure to send interrupt event list\n 2775 * 2776 * --------------------------------------------------------------\n 2777 * SECY Global AIC interrupt resources \n 2778 * --------------------------------------------------------------\n 2779 * Interrupt name event_mask bit number \n 2780 * ------------------------------------------------------------\n 2781 * BCM_PLP_BASE_T_SECY_EVENT_DROP_CLASS 0\n 2782 * BCM_PLP_BASE_T_SECY_EVENT_DROP_PP 1\n 2783 * BCM_PLP_BASE_T_SECY_EVENT_DROP_MTU 2\n 2784 * BCM_PLP_BASE_T_SECY_EVENT_CTRL_PKT 3\n 2785 * BCM_PLP_BASE_T_SECY_EVENT_DATA_PKT 4\n 2786 * BCM_PLP_BASE_T_SECY_EVENT_ENG_IRQ 5\n 2787 * BCM_PLP_BASE_T_SECY_EVENT_TCAM_MISS 6\n 2788 * BCM_PLP_BASE_T_SECY_EVENT_TCAM_MULT_HIT 7\n 2789 * BCM_PLP_BASE_T_SECY_EVENT_STAT_SA_THR 8\n 2790 * BCM_PLP_BASE_T_SECY_EVENT_STAT_SECY_THR 9\n 2791 * BCM_PLP_BASE_T_SECY_EVENT_STAT_IFC_THR 10\n 2792 * BCM_PLP_BASE_T_SECY_EVENT_STAT_GLOBAL_THR 11\n 2793 * BCM_PLP_BASE_T_SECY_EVENT_STAT_TC_THR 12\n 2794 * BCM_PLP_BASE_T_SECY_EVENT_STAT_RC_THR 13\n 2795 * BCM_PLP_BASE_T_SECY_EVENT_SC_MISS 14\n 2796 * BCM_PLP_BASE_T_SECY_EVENT_SC_MULT_HIT 15\n 2797 * BCM_PLP_BASE_T_SECY_EVENT_SA_PN_THR 16\n 2798 * BCM_PLP_BASE_T_SECY_EVENT_SA_EXPIRED 17\n 2799 * 2800 * This function is re-entrant for the same or different macsec_side's. 2801 * 2802 * This function can be called concurrently with any other SecY API function 2803 * for the same or different macsec_side. 2804 * 2805 * @return 2806 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 2807 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 2808 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 2809 */ 2810 2811 int imacsec_plp_base_t_secy_intr_enable_set(int unit, soc_port_t port, unsigned int macsec_side, 2812 const bcm_plp_base_t_secy_intr_t *secy_intr_p) 2813 { 2814 phy_ctrl_t *pc; 2815 int rv=0; 2816 bcm_plp_base_t_sec_access_t *pa; 2817 EXT_PHY_INIT_CHECK(unit,port); 2818 pc = EXT_PHY_SW_STATE(unit, port); 2819 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 2820 rv = bcm_base_t_secy_intr_enable_set(pa, secy_intr_p); 2821 if(rv !=0){ 2822 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_intr_enable_set failed:%d\n "), rv)); 2823 } 2824 return rv; 2825 } 2826 /*! \brief imacsec_plp_base_t_secy_intr_enable_get 2827 * 2828 * This API is used to get enabled SecY interrupts events resulting in interrupts 2829 * 2830 * @param unit (input) BCM unit number 2831 * @param port (input) - port number 2832 * @param macsec_side (input) - selects egress or ingress path 2833 * 0 - egress path 2834 * 1 - ingress path 2835 * 2836 * 2837 * @param[out] secy_intr_p 2838 * pointer to secy interrupt structure to get enabled interrupt event list\n 2839 * 2840 * --------------------------------------------------------------\n 2841 * SECY Global AIC interrupt resources \n 2842 * --------------------------------------------------------------\n 2843 * Interrupt name event_mask bit number \n 2844 * ------------------------------------------------------------\n 2845 * BCM_PLP_BASE_T_SECY_EVENT_DROP_CLASS 0\n 2846 * BCM_PLP_BASE_T_SECY_EVENT_DROP_PP 1\n 2847 * BCM_PLP_BASE_T_SECY_EVENT_DROP_MTU 2\n 2848 * BCM_PLP_BASE_T_SECY_EVENT_CTRL_PKT 3\n 2849 * BCM_PLP_BASE_T_SECY_EVENT_DATA_PKT 4\n 2850 * BCM_PLP_BASE_T_SECY_EVENT_ENG_IRQ 5\n 2851 * BCM_PLP_BASE_T_SECY_EVENT_TCAM_MISS 6\n 2852 * BCM_PLP_BASE_T_SECY_EVENT_TCAM_MULT_HIT 7\n 2853 * BCM_PLP_BASE_T_SECY_EVENT_STAT_SA_THR 8\n 2854 * BCM_PLP_BASE_T_SECY_EVENT_STAT_SECY_THR 9\n 2855 * BCM_PLP_BASE_T_SECY_EVENT_STAT_IFC_THR 10\n 2856 * BCM_PLP_BASE_T_SECY_EVENT_STAT_GLOBAL_THR 11\n 2857 * BCM_PLP_BASE_T_SECY_EVENT_STAT_TC_THR 12\n 2858 * BCM_PLP_BASE_T_SECY_EVENT_STAT_RC_THR 13\n 2859 * BCM_PLP_BASE_T_SECY_EVENT_SC_MISS 14\n 2860 * BCM_PLP_BASE_T_SECY_EVENT_SC_MULT_HIT 15\n 2861 * BCM_PLP_BASE_T_SECY_EVENT_SA_PN_THR 16\n 2862 * BCM_PLP_BASE_T_SECY_EVENT_SA_EXPIRED 17\n 2863 * 2864 * This function is re-entrant for the same or different macsec_side's. 2865 * 2866 * This function can be called concurrently with any other SecY API function 2867 * for the same or different macsec_side. 2868 * 2869 * @return 2870 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 2871 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 2872 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 2873 */ 2874 2875 int imacsec_plp_base_t_secy_intr_enable_get(int unit, soc_port_t port, unsigned int macsec_side, 2876 bcm_plp_base_t_secy_intr_t *secy_intr_p) 2877 { 2878 phy_ctrl_t *pc; 2879 int rv=0; 2880 bcm_plp_base_t_sec_access_t *pa; 2881 EXT_PHY_INIT_CHECK(unit,port); 2882 pc = EXT_PHY_SW_STATE(unit, port); 2883 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 2884 rv = bcm_base_t_secy_intr_enable_get(pa, secy_intr_p); 2885 if(rv !=0){ 2886 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_intr_enable_get failed:%d\n "), rv)); 2887 } 2888 return rv; 2889 } 2890 /*! \brief imacsec_plp_base_t_secy_intr_status_get 2891 * 2892 * This API is used to get the status of enabled SecY interrupts 2893 * 2894 * @param unit (input) BCM unit number 2895 * @param port (input) - port number 2896 * @param macsec_side (input) - selects egress or ingress path 2897 * 0 - egress path 2898 * 1 - ingress path 2899 * 2900 * @param[out] secy_intr_p 2901 * pointer to secy interrupt structure to get interrupt event list\n 2902 * 2903 * --------------------------------------------------------------\n 2904 * SECY Global AIC interrupt resources \n 2905 * --------------------------------------------------------------\n 2906 * Interrupt name event_mask bit number \n 2907 * ------------------------------------------------------------\n 2908 * BCM_PLP_BASE_T_SECY_EVENT_DROP_CLASS 0\n 2909 * BCM_PLP_BASE_T_SECY_EVENT_DROP_PP 1\n 2910 * BCM_PLP_BASE_T_SECY_EVENT_DROP_MTU 2\n 2911 * BCM_PLP_BASE_T_SECY_EVENT_CTRL_PKT 3\n 2912 * BCM_PLP_BASE_T_SECY_EVENT_DATA_PKT 4\n 2913 * BCM_PLP_BASE_T_SECY_EVENT_ENG_IRQ 5\n 2914 * BCM_PLP_BASE_T_SECY_EVENT_TCAM_MISS 6\n 2915 * BCM_PLP_BASE_T_SECY_EVENT_TCAM_MULT_HIT 7\n 2916 * BCM_PLP_BASE_T_SECY_EVENT_STAT_SA_THR 8\n 2917 * BCM_PLP_BASE_T_SECY_EVENT_STAT_SECY_THR 9\n 2918 * BCM_PLP_BASE_T_SECY_EVENT_STAT_IFC_THR 10\n 2919 * BCM_PLP_BASE_T_SECY_EVENT_STAT_GLOBAL_THR 11\n 2920 * BCM_PLP_BASE_T_SECY_EVENT_STAT_TC_THR 12\n 2921 * BCM_PLP_BASE_T_SECY_EVENT_STAT_RC_THR 13\n 2922 * BCM_PLP_BASE_T_SECY_EVENT_SC_MISS 14\n 2923 * BCM_PLP_BASE_T_SECY_EVENT_SC_MULT_HIT 15\n 2924 * BCM_PLP_BASE_T_SECY_EVENT_SA_PN_THR 16\n 2925 * BCM_PLP_BASE_T_SECY_EVENT_SA_EXPIRED 17\n 2926 * 2927 * This function is re-entrant for the same or different macsec_side's. 2928 * 2929 * This function can be called concurrently with any other SecY API function 2930 * for the same or different macsec_side. 2931 * 2932 * @return 2933 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 2934 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 2935 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 2936 */ 2937 int imacsec_plp_base_t_secy_intr_status_get(int unit, soc_port_t port, unsigned int macsec_side, 2938 bcm_plp_base_t_secy_intr_t *secy_intr_p) 2939 { 2940 phy_ctrl_t *pc; 2941 int rv=0; 2942 bcm_plp_base_t_sec_access_t *pa; 2943 EXT_PHY_INIT_CHECK(unit,port); 2944 pc = EXT_PHY_SW_STATE(unit, port); 2945 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 2946 rv = bcm_base_t_secy_intr_status_get(pa, secy_intr_p); 2947 if(rv !=0){ 2948 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_intr_status_get failed:%d\n "), rv)); 2949 } 2950 return rv; 2951 } 2952 /*! \brief imacsec_plp_base_t_secy_intr_status_clear 2953 * 2954 * This API clears enabled interrupts status of SecY interrupts for specified interrupt 2955 * 2956 * @param unit (input) BCM unit number 2957 * @param port (input) - port number 2958 * @param macsec_side (input) - selects egress or ingress path 2959 * 0 - egress path 2960 * 1 - ingress path 2961 * 2962 * @param[in] secy_intr_p 2963 * pointer to secy interrupt structure to send interrupt event_mask list to clear intr status\n 2964 * 2965 * --------------------------------------------------------------\n 2966 * SECY Global AIC interrupt resources \n 2967 * --------------------------------------------------------------\n 2968 * Interrupt name event_mask bit number \n 2969 * ------------------------------------------------------------\n 2970 * BCM_PLP_BASE_T_SECY_EVENT_DROP_CLASS 0\n 2971 * BCM_PLP_BASE_T_SECY_EVENT_DROP_PP 1\n 2972 * BCM_PLP_BASE_T_SECY_EVENT_DROP_MTU 2\n 2973 * BCM_PLP_BASE_T_SECY_EVENT_CTRL_PKT 3\n 2974 * BCM_PLP_BASE_T_SECY_EVENT_DATA_PKT 4\n 2975 * BCM_PLP_BASE_T_SECY_EVENT_ENG_IRQ 5\n 2976 * BCM_PLP_BASE_T_SECY_EVENT_TCAM_MISS 6\n 2977 * BCM_PLP_BASE_T_SECY_EVENT_TCAM_MULT_HIT 7\n 2978 * BCM_PLP_BASE_T_SECY_EVENT_STAT_SA_THR 8\n 2979 * BCM_PLP_BASE_T_SECY_EVENT_STAT_SECY_THR 9\n 2980 * BCM_PLP_BASE_T_SECY_EVENT_STAT_IFC_THR 10\n 2981 * BCM_PLP_BASE_T_SECY_EVENT_STAT_GLOBAL_THR 11\n 2982 * BCM_PLP_BASE_T_SECY_EVENT_STAT_TC_THR 12\n 2983 * BCM_PLP_BASE_T_SECY_EVENT_STAT_RC_THR 13\n 2984 * BCM_PLP_BASE_T_SECY_EVENT_SC_MISS 14\n 2985 * BCM_PLP_BASE_T_SECY_EVENT_SC_MULT_HIT 15\n 2986 * BCM_PLP_BASE_T_SECY_EVENT_SA_PN_THR 16\n 2987 * BCM_PLP_BASE_T_SECY_EVENT_SA_EXPIRED 17\n 2988 * 2989 * This function is re-entrant for the same or different macsec_side's. 2990 * 2991 * This function can be called concurrently with any other SecY API function 2992 * for the same or different macsec_side. 2993 * 2994 * @return 2995 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 2996 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 2997 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 2998 */ 2999 3000 int imacsec_plp_base_t_secy_intr_status_clear(int unit, soc_port_t port, unsigned int macsec_side, 3001 const bcm_plp_base_t_secy_intr_t *secy_intr_p) 3002 { 3003 phy_ctrl_t *pc; 3004 int rv=0; 3005 bcm_plp_base_t_sec_access_t *pa; 3006 EXT_PHY_INIT_CHECK(unit,port); 3007 pc = EXT_PHY_SW_STATE(unit, port); 3008 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 3009 rv = bcm_base_t_secy_intr_status_clear(pa, secy_intr_p); 3010 if(rv !=0){ 3011 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_intr_status_clear failed:%d\n "), rv)); 3012 } 3013 return rv; 3014 } 3015 /*! \brief imacsec_plp_base_t_secy_event_status_get 3016 * 3017 * This API is used to get raw status of all events 3018 * 3019 * @param unit (input) BCM unit number 3020 * @param port (input) - port number 3021 * @param macsec_side (input) - selects egress or ingress path 3022 * 0 - egress path 3023 * 1 - ingress path 3024 * 3025 * @param[out] secy_intr_p 3026 * pointer to secy interrupt structure to get event list\n 3027 * 3028 * --------------------------------------------------------------\n 3029 * SECY Global AIC interrupt resources \n 3030 * --------------------------------------------------------------\n 3031 * Interrupt name event_mask bit number \n 3032 * ------------------------------------------------------------\n 3033 * BCM_PLP_BASE_T_SECY_EVENT_DROP_CLASS 0\n 3034 * BCM_PLP_BASE_T_SECY_EVENT_DROP_PP 1\n 3035 * BCM_PLP_BASE_T_SECY_EVENT_DROP_MTU 2\n 3036 * BCM_PLP_BASE_T_SECY_EVENT_CTRL_PKT 3\n 3037 * BCM_PLP_BASE_T_SECY_EVENT_DATA_PKT 4\n 3038 * BCM_PLP_BASE_T_SECY_EVENT_ENG_IRQ 5\n 3039 * BCM_PLP_BASE_T_SECY_EVENT_TCAM_MISS 6\n 3040 * BCM_PLP_BASE_T_SECY_EVENT_TCAM_MULT_HIT 7\n 3041 * BCM_PLP_BASE_T_SECY_EVENT_STAT_SA_THR 8\n 3042 * BCM_PLP_BASE_T_SECY_EVENT_STAT_SECY_THR 9\n 3043 * BCM_PLP_BASE_T_SECY_EVENT_STAT_IFC_THR 10\n 3044 * BCM_PLP_BASE_T_SECY_EVENT_STAT_GLOBAL_THR 11\n 3045 * BCM_PLP_BASE_T_SECY_EVENT_STAT_TC_THR 12\n 3046 * BCM_PLP_BASE_T_SECY_EVENT_STAT_RC_THR 13\n 3047 * BCM_PLP_BASE_T_SECY_EVENT_SC_MISS 14\n 3048 * BCM_PLP_BASE_T_SECY_EVENT_SC_MULT_HIT 15\n 3049 * BCM_PLP_BASE_T_SECY_EVENT_SA_PN_THR 16\n 3050 * BCM_PLP_BASE_T_SECY_EVENT_SA_EXPIRED 17\n 3051 * 3052 * This function is re-entrant for the same or different macsec_side's. 3053 * 3054 * This function can be called concurrently with any other SecY API function 3055 * for the same or different macsec_side. 3056 * 3057 * @return 3058 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 3059 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 3060 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 3061 */ 3062 int imacsec_plp_base_t_secy_event_status_get(int unit, soc_port_t port, unsigned int macsec_side, 3063 bcm_plp_base_t_secy_intr_t *secy_intr_p) 3064 { 3065 phy_ctrl_t *pc; 3066 int rv=0; 3067 bcm_plp_base_t_sec_access_t *pa; 3068 EXT_PHY_INIT_CHECK(unit,port); 3069 pc = EXT_PHY_SW_STATE(unit, port); 3070 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 3071 rv = bcm_base_t_secy_event_status_get(pa, secy_intr_p); 3072 if(rv !=0){ 3073 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_event_status_get failed:%d\n "), rv)); 3074 } 3075 return rv; 3076 } 3077 3078 /*! \brief imacsec_plp_base_t_secy_intr_set 3079 * 3080 * This API is used to enable/disable SecY interrupts for specified events resulting in interrupts 3081 * 3082 * @param unit (input) BCM unit number 3083 * @param port (input) - port number 3084 * @param macsec_side (input) - selects egress or ingress path 3085 * 0 - egress path 3086 * 1 - ingress path 3087 * 3088 * @param [in] secy_intr 3089 * pointer to secy interrupt structure to send interrupt event list\n 3090 * 3091 * --------------------------------------------------------------\n 3092 * SECY Global AIC interrupt resources \n 3093 * --------------------------------------------------------------\n 3094 * Interrupt name event_mask bit number \n 3095 * ------------------------------------------------------------\n 3096 * BCM_PLP_BASE_T_SECY_EVENT_DROP_CLASS 0\n 3097 * BCM_PLP_BASE_T_SECY_EVENT_DROP_PP 1\n 3098 * BCM_PLP_BASE_T_SECY_EVENT_DROP_MTU 2\n 3099 * BCM_PLP_BASE_T_SECY_EVENT_CTRL_PKT 3\n 3100 * BCM_PLP_BASE_T_SECY_EVENT_DATA_PKT 4\n 3101 * BCM_PLP_BASE_T_SECY_EVENT_ENG_IRQ 5\n 3102 * BCM_PLP_BASE_T_SECY_EVENT_TCAM_MISS 6\n 3103 * BCM_PLP_BASE_T_SECY_EVENT_TCAM_MULT_HIT 7\n 3104 * BCM_PLP_BASE_T_SECY_EVENT_STAT_SA_THR 8\n 3105 * BCM_PLP_BASE_T_SECY_EVENT_STAT_SECY_THR 9\n 3106 * BCM_PLP_BASE_T_SECY_EVENT_STAT_IFC_THR 10\n 3107 * BCM_PLP_BASE_T_SECY_EVENT_STAT_GLOBAL_THR 11\n 3108 * BCM_PLP_BASE_T_SECY_EVENT_STAT_TC_THR 12\n 3109 * BCM_PLP_BASE_T_SECY_EVENT_STAT_RC_THR 13\n 3110 * BCM_PLP_BASE_T_SECY_EVENT_SC_MISS 14\n 3111 * BCM_PLP_BASE_T_SECY_EVENT_SC_MULT_HIT 15\n 3112 * BCM_PLP_BASE_T_SECY_EVENT_SA_PN_THR 16\n 3113 * BCM_PLP_BASE_T_SECY_EVENT_SA_EXPIRED 17\n 3114 * 3115 * @param enable [in] 3116 * 1 - Enable the interrupt 3117 * 0 - Disable the interrupt 3118 * This function is re-entrant for the same or different macsec_side's. 3119 * 3120 * This function can be called concurrently with any other SecY API function 3121 * for the same or different macsec_side. 3122 * 3123 * @return 3124 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 3125 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 3126 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 3127 */ 3128 3129 bcm_plp_base_t_secy_status_t imacsec_plp_base_t_secy_intr_set(int unit, soc_port_t port, unsigned int macsec_side, 3130 const bcm_plp_base_t_secy_intr_t *secy_intr, const unsigned int enable) 3131 { 3132 phy_ctrl_t *pc; 3133 int rv=0; 3134 bcm_plp_base_t_sec_access_t *pa; 3135 EXT_PHY_INIT_CHECK(unit,port); 3136 pc = EXT_PHY_SW_STATE(unit, port); 3137 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 3138 rv = bcm_base_t_secy_intr_set(pa, secy_intr, enable); 3139 if(rv !=0){ 3140 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_intr_set failed:%d\n "), rv)); 3141 } 3142 return rv; 3143 } 3144 3145 /*! \brief imacsec_plp_base_t_secy_intr_get 3146 * 3147 * This API is used to get enabled SecY interrupts events resulting in interrupts 3148 * 3149 * @param unit (input) BCM unit number 3150 * @param port (input) - port number 3151 * @param macsec_side (input) - selects egress or ingress path 3152 * 0 - egress path 3153 * 1 - ingress path 3154 * 3155 * @param[out] secy_intr 3156 * pointer to secy interrupt structure to get enabled interrupt event list\n 3157 * 3158 * --------------------------------------------------------------\n 3159 * SECY Global AIC interrupt resources \n 3160 * --------------------------------------------------------------\n 3161 * Interrupt name event_mask bit number \n 3162 * ------------------------------------------------------------\n 3163 * BCM_PLP_BASE_T_SECY_EVENT_DROP_CLASS 0\n 3164 * BCM_PLP_BASE_T_SECY_EVENT_DROP_PP 1\n 3165 * BCM_PLP_BASE_T_SECY_EVENT_DROP_MTU 2\n 3166 * BCM_PLP_BASE_T_SECY_EVENT_CTRL_PKT 3\n 3167 * BCM_PLP_BASE_T_SECY_EVENT_DATA_PKT 4\n 3168 * BCM_PLP_BASE_T_SECY_EVENT_ENG_IRQ 5\n 3169 * BCM_PLP_BASE_T_SECY_EVENT_TCAM_MISS 6\n 3170 * BCM_PLP_BASE_T_SECY_EVENT_TCAM_MULT_HIT 7\n 3171 * BCM_PLP_BASE_T_SECY_EVENT_STAT_SA_THR 8\n 3172 * BCM_PLP_BASE_T_SECY_EVENT_STAT_SECY_THR 9\n 3173 * BCM_PLP_BASE_T_SECY_EVENT_STAT_IFC_THR 10\n 3174 * BCM_PLP_BASE_T_SECY_EVENT_STAT_GLOBAL_THR 11\n 3175 * BCM_PLP_BASE_T_SECY_EVENT_STAT_TC_THR 12\n 3176 * BCM_PLP_BASE_T_SECY_EVENT_STAT_RC_THR 13\n 3177 * BCM_PLP_BASE_T_SECY_EVENT_SC_MISS 14\n 3178 * BCM_PLP_BASE_T_SECY_EVENT_SC_MULT_HIT 15\n 3179 * BCM_PLP_BASE_T_SECY_EVENT_SA_PN_THR 16\n 3180 * BCM_PLP_BASE_T_SECY_EVENT_SA_EXPIRED 17\n 3181 * 3182 * @param enable [out] 3183 * Return the status of enabled interrupt 3184 * 1 - Interrupts are enabled for specified event mask in interrupt source 3185 * 0 - Interrupts are disabled for specified event mask in interrupt source 3186 * This function is re-entrant for the same or different macsec_side's. 3187 * 3188 * This function can be called concurrently with any other SecY API function 3189 * for the same or different macsec_side. 3190 * 3191 * @return 3192 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 3193 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 3194 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 3195 */ 3196 3197 bcm_plp_base_t_secy_status_t imacsec_plp_base_t_secy_intr_get(int unit, soc_port_t port, unsigned int macsec_side, 3198 bcm_plp_base_t_secy_intr_t *secy_intr, unsigned int *enable) 3199 { 3200 phy_ctrl_t *pc; 3201 int rv=0; 3202 bcm_plp_base_t_sec_access_t *pa; 3203 EXT_PHY_INIT_CHECK(unit,port); 3204 pc = EXT_PHY_SW_STATE(unit, port); 3205 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 3206 rv = bcm_base_t_secy_intr_get(pa, secy_intr, enable); 3207 if(rv !=0){ 3208 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_intr_get failed:%d\n "), rv)); 3209 } 3210 return rv; 3211 } 3212 3213 /*! \brief imacsec_plp_base_t_secy_build_transform_record 3214 * * Construct the SA record for the operation described in params in 3215 * a memory buffer sa_buffer_p. 3216 * 3217 * @param unit (input) BCM unit number 3218 * @param port (input) - port number 3219 * @param macsec_side (input) - selects egress or ingress path 3220 * 0 - egress path 3221 * 1 - ingress path 3222 * 3223 * @param params (input) 3224 * Pointer to the SA parameters structure. 3225 * @param sa_buffer_p (input) 3226 * Pointer to the the SA memory buffer where transfer record is stored, 3227 * The sa_buffer_p argument must point to a word-aligned 3228 * memory buffer whose size in words is at least equal to the 3229 * corresponding size parameter returned by SABuilder_GetSize(). 3230 * 3231 * @return 3232 * BCM_PLP_BASE_T_SAB_STATUS_OK : Success 3233 * BCM_PLP_BASE_T_SAB_INVALID_PARAMETER : params is invalid, or the sa_buffer_p 3234 * BCM_PLP_BASE_T_SAB_UNSUPPORTED_FEATURE : params describes an operations that 3235 * is not supported on the hardware for which this SA builder 3236 * is configured. 3237 */ 3238 3239 int imacsec_plp_base_t_secy_build_transform_record(int unit, soc_port_t port, unsigned int macsec_side, 3240 bcm_plp_base_t_sa_builder_params_t *params, 3241 unsigned int *sa_buffer_p) 3242 { 3243 phy_ctrl_t *pc; 3244 int rv=0; 3245 bcm_plp_base_t_sec_access_t *pa; 3246 EXT_PHY_INIT_CHECK(unit,port); 3247 pc = EXT_PHY_SW_STATE(unit, port); 3248 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 3249 rv = bcm_base_t_secy_build_transform_record(pa, params,sa_buffer_p); 3250 if(rv !=0){ 3251 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_build_transform_record failed:%d\n "), rv)); 3252 } 3253 return rv; 3254 3255 } 3256 3257 /**! \brief imacsec_plp_base_t_secy_sa_active_e_get 3258 * 3259 * Return the handle of the currently active egress SA for a given vPort. 3260 * 3261 * @param unit (input) BCM unit number 3262 * @param port (input) - port number 3263 * @param macsec_side (input) - selects egress or ingress path 3264 * 0 - egress path 3265 * 1 - ingress path 3266 * 3267 * 3268 * @param [in] vport 3269 * vPort number to which the SA applies. 3270 * 3271 * @param [out] active_sa_handle_p 3272 * Currently active egress SA for the given vPort. 3273 * 3274 * This function is re-entrant for the same macsec_side.\n 3275 * This function is re-entrant for different macsec_side's.\n 3276 * 3277 * This function can be called concurrently with any other SecY API 3278 * function for the same or different macsec_side.\n 3279 * 3280 * @return 3281 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 3282 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 3283 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 3284 */ 3285 3286 int imacsec_plp_base_t_secy_sa_active_e_get(int unit, soc_port_t port, unsigned int macsec_side, 3287 const unsigned int vport, 3288 bcm_plp_base_t_secy_sa_handle_t * const active_sa_handle_p) 3289 { 3290 phy_ctrl_t *pc; 3291 int rv=0; 3292 bcm_plp_base_t_sec_access_t *pa; 3293 EXT_PHY_INIT_CHECK(unit,port); 3294 pc = EXT_PHY_SW_STATE(unit, port); 3295 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 3296 rv = bcm_base_t_secy_sa_active_e_get(pa, vport,active_sa_handle_p); 3297 if(rv !=0){ 3298 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_sa_active_e_get failed:%d\n "), rv)); 3299 } 3300 return rv; 3301 } 3302 3303 /**! \brief imacsec_plp_base_t_secy_sa_active_i_get 3304 * 3305 * Return the handles of the currently active ingress SA's for a given vPort 3306 * and SCI. 3307 * @param unit (input) BCM unit number 3308 * @param port (input) - port number 3309 * @param macsec_side (input) - selects egress or ingress path 3310 * 0 - egress path 3311 * 1 - ingress path 3312 * 3313 * 3314 * @param [in] vport 3315 * vPort number to which the SA applies. 3316 * 3317 * @param [in] sci_p 3318 * SCI for which the SA is desired. 3319 * 3320 * @param [out] active_sa_handle_p 3321 * Array of four currently active egress SA for the given vPort, one 3322 * for each AN from 0 to 3. Any SA that is not active is represented 3323 * by XtSecY_SAHandle_NULL. 3324 * 3325 * This function is re-entrant for the same macsec_side.\n 3326 * This function is re-entrant for different macsec_side's.\n 3327 * 3328 * This function can be called concurrently with any other SecY API 3329 * function for the same or different macsec_side.\n 3330 * 3331 * @return 3332 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 3333 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 3334 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 3335 */ 3336 3337 int imacsec_plp_base_t_secy_sa_active_i_get(int unit, soc_port_t port, unsigned int macsec_side, 3338 const unsigned int vport, 3339 const unsigned char * const sci_p, 3340 bcm_plp_base_t_secy_sa_handle_t * const active_sa_handle_p) 3341 { 3342 phy_ctrl_t *pc; 3343 int rv=0; 3344 bcm_plp_base_t_sec_access_t *pa; 3345 EXT_PHY_INIT_CHECK(unit,port); 3346 pc = EXT_PHY_SW_STATE(unit, port); 3347 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 3348 rv = bcm_base_t_secy_sa_active_i_get(pa, vport,sci_p, active_sa_handle_p); 3349 if(rv !=0){ 3350 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_sa_active_i_get failed:%d\n "), rv)); 3351 } 3352 return rv; 3353 } 3354 3355 /**---------------------------------------------------------------------------- 3356 * imacsec_plp_base_t_secy_sa_window_size_update 3357 * 3358 * Updates the Window Size field for an inbound SA. 3359 * 3360 * API use order: 3361 * This function may be called for the SAHandle obtained via the 3362 * imacsec_plp_base_t_secy_sa_add() function for the same macsec_side. 3363 * 3364 * @param unit (input) BCM unit number 3365 * @param port (input) - port number 3366 * @param macsec_side (input) - selects egress or ingress path 3367 * 0 - egress path 3368 * 1 - ingress path 3369 * 3370 * @param [in] sa_handle 3371 * SA handle of the SA to be updated. 3372 * 3373 * @param [in] window_size 3374 * 32-bit integer representing the anti-replay window size. 3375 * 3376 * This function is NOT re-entrant for the same macsec_side.\n 3377 * This function is re-entrant for different macsec_side's.\n 3378 * 3379 * This function cannot be called concurrently with the imacsec_plp_base_t_secy_sa_remove() 3380 * function for the same macsec_side.\n 3381 * This function can be called concurrently with any other SecY API 3382 * function for the same or different DeviceId. 3383 * 3384 * @return 3385 * BCM_PLP_BASE_T_SECY_STATUS_OK : success 3386 * BCM_PLP_BASE_T_SECY_ERROR_BAD_PARAMETER : incorrect input parameter 3387 * BCM_PLP_BASE_T_SECY_INTERNAL_ERROR : failure 3388 */ 3389 int imacsec_plp_base_t_secy_sa_window_size_update(int unit, soc_port_t port, unsigned int macsec_side, 3390 const bcm_plp_base_t_secy_sa_handle_t sa_handle, 3391 const unsigned int window_size) 3392 { 3393 phy_ctrl_t *pc; 3394 int rv=0; 3395 bcm_plp_base_t_sec_access_t *pa; 3396 EXT_PHY_INIT_CHECK(unit,port); 3397 pc = EXT_PHY_SW_STATE(unit, port); 3398 IMACSEC_PLP_BASE_T_SEC_ACCESS_GET(pc,pa,macsec_side); 3399 rv = bcm_base_t_secy_sa_window_size_update(pa, sa_handle,window_size); 3400 if(rv !=0){ 3401 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_secy_sa_window_size_update failed:%d\n "), rv)); 3402 } 3403 return rv; 3404 } 3405 3406 3407 /*! \brief imacsec_plp_base_t_version_get 3408 * 3409 * Get the IMACSEC software version information 3410 * 3411 * @param unit (input) BCM unit number 3412 * @param port (input) - port number 3413 * @param version_info (output) - Get the version information 3414 * version_info structure has two member variable 3415 * major_no - Indicates major software release 3416 * minor_no - Indicates enhancement after major software release 3417 * @return 3418 * return 0 on success 3419 */ 3420 3421 int imacsec_plp_base_t_version_get(int unit,soc_port_t port,bcm_plp_base_t_version_t* version_info) 3422 { 3423 int rv=0; 3424 phy_ctrl_t *pc; 3425 bcm_plp_base_t_sec_access_t *pa; 3426 EXT_PHY_INIT_CHECK(unit,port); 3427 pc = EXT_PHY_SW_STATE(unit, port); 3428 pa = (bcm_plp_base_t_sec_access_t *)(((char *)pc->driver_data + pc->size) - sizeof(bcm_plp_base_t_sec_access_t)); 3429 3430 if(pa==NULL){ 3431 return SOC_E_INTERNAL; 3432 } 3433 3434 rv = bcm_base_t_imacsec_version_get(pa, version_info); 3435 3436 if(rv !=0){ 3437 LOG_CLI((BSL_META_U(unit,"imacsec_plp_base_t_version_get failed:%d\n "), rv)); 3438 } 3439 return rv; 3440 } 3441 3442 3443 /*! \brief imacsec_plp_addr_read 3444 * 3445 * Reads the register address using mdio bus 3446 * 3447 * @param unit (input) BCM unit number 3448 * @param port (input) - port number 3449 * @param reg_addr (input) - Register address 3450 * @param value (output) - register value read 3451 * 3452 * @return 3453 * return 0 on success 3454 */ 3455 3456 int imacsec_plp_addr_read(int unit, 3457 unsigned int port, 3458 unsigned int reg_addr, 3459 unsigned int *value) 3460 { 3461 phy_ctrl_t *pc; 3462 bcm_plp_base_t_sec_access_t *pa; 3463 EXT_PHY_INIT_CHECK(unit,port); 3464 pc = EXT_PHY_SW_STATE(unit, port); 3465 pa = (bcm_plp_base_t_sec_access_t *)(((char *)pc->driver_data + pc->size) - sizeof(bcm_plp_base_t_sec_access_t)); 3466 if(pa==NULL){ 3467 return SOC_E_INTERNAL; 3468 } 3469 pa->phy_info.phy_addr= pa->macsec_dev_addr; 3470 *value = 0xffffffff; 3471 return plp_raw_read(&(pa->phy_info),reg_addr,value); 3472 } 3473 /*! \brief imacsec_plp_addr_write 3474 * 3475 * write the register address using mdio bus 3476 * 3477 * @param unit (input) BCM unit number 3478 * @param port (input) - port number 3479 * @param reg_addr (input) - Register address 3480 * @param value (input) - register value to write 3481 * @return 3482 * return 0 on success 3483 */ 3484 3485 int imacsec_plp_addr_write(int unit, 3486 unsigned int port, 3487 unsigned int reg_addr, 3488 unsigned int value) 3489 { 3490 phy_ctrl_t *pc; 3491 bcm_plp_base_t_sec_access_t *pa; 3492 EXT_PHY_INIT_CHECK(unit,port); 3493 pc = EXT_PHY_SW_STATE(unit, port); 3494 pa = (bcm_plp_base_t_sec_access_t *)(((char *)pc->driver_data + pc->size) - sizeof(bcm_plp_base_t_sec_access_t)); 3495 if(pa==NULL){ 3496 return SOC_E_INTERNAL; 3497 } 3498 pa->phy_info.phy_addr= pa->macsec_dev_addr; 3499 return plp_raw_write(&(pa->phy_info),reg_addr,value); 3500 } 3501 #endif /* INCLUDE_PLP_IMACSEC */