diff --git a/include/osi_core.h b/include/osi_core.h index 9c8a99e..a9f6bbf 100644 --- a/include/osi_core.h +++ b/include/osi_core.h @@ -192,6 +192,7 @@ typedef my_lint_64 nvel64_t; * @brief Maximum number of Secure Channels */ #define OSI_MAX_NUM_SC 8U +#define OSI_MAX_NUM_SC_T26x 48U /** * @brief MACSEC Secure Channel Identifier length */ @@ -1377,7 +1378,7 @@ struct osi_macsec_sc_info { */ struct osi_macsec_lut_status { /** List of max SC's supported */ - struct osi_macsec_sc_info sc_info[OSI_MAX_NUM_SC]; + struct osi_macsec_sc_info sc_info[OSI_MAX_NUM_SC_T26x]; /** next available BYP LUT index * valid values are from 0 to NVETHERNETRM_PIF$OSI_BYP_LUT_MAX_INDEX */ nveu16_t next_byp_idx; @@ -1705,7 +1706,7 @@ struct osi_core_priv_data { /** Dummy SCI/SC/SA etc LUTs programmed with dummy parameter when no * session setup. SCI LUT hit created with VF's MACID * valid values are from 0 to 0xFF for each array element */ - nveu8_t macsec_dummy_sc_macids[OSI_MAX_NUM_SC][OSI_ETH_ALEN]; + nveu8_t macsec_dummy_sc_macids[OSI_MAX_NUM_SC_T26x][OSI_ETH_ALEN]; /** MACSEC initialization state * valid vaues are 0(not initialized) and 1(Initialized) */ nveu32_t macsec_initialized; diff --git a/osi/nvmacsecrm/macsec.c b/osi/nvmacsecrm/macsec.c index a563d52..e510078 100644 --- a/osi/nvmacsecrm/macsec.c +++ b/osi/nvmacsecrm/macsec.c @@ -5183,8 +5183,12 @@ static struct osi_macsec_sc_info *find_existing_sc( &osi_core->macsec_lut_status[ctlr]; struct osi_macsec_sc_info *sc_found = OSI_NULL; nveu32_t i; + const nveu32_t max_num_sc[MAX_MACSEC_IP_TYPES] = { + OSI_MAX_NUM_SC, + OSI_MAX_NUM_SC_T26x + }; - for (i = 0; i < OSI_MAX_NUM_SC; i++) { + for (i = 0; i < max_num_sc[osi_core->macsec]; i++) { if (osi_macsec_memcmp(lut_status_ptr->sc_info[i].sci, sc->sci, (nve32_t)OSI_SCI_LEN) == OSI_NONE_SIGNED) { sc_found = &lut_status_ptr->sc_info[i]; @@ -5222,8 +5226,12 @@ static nveu32_t get_avail_sc_idx(const struct osi_core_priv_data *const osi_core const struct osi_macsec_lut_status *lut_status_ptr = &osi_core->macsec_lut_status[ctlr]; nveu32_t i; + const nveu32_t max_num_sc[MAX_MACSEC_IP_TYPES] = { + OSI_MAX_NUM_SC, + OSI_MAX_NUM_SC_T26x + }; - for (i = 0; i < OSI_MAX_NUM_SC; i++) { + for (i = 0; i < max_num_sc[osi_core->macsec]; i++) { if (lut_status_ptr->sc_info[i].an_valid == OSI_NONE) { break; } @@ -5844,10 +5852,14 @@ static nve32_t add_new_sc(struct osi_core_priv_data *const osi_core, struct osi_macsec_lut_status *lut_status_ptr; nveu32_t avail_sc_idx = 0; struct osi_macsec_sc_info *new_sc = OSI_NULL; + const nveu32_t max_num_sc[MAX_MACSEC_IP_TYPES] = { + OSI_MAX_NUM_SC, + OSI_MAX_NUM_SC_T26x + }; lut_status_ptr = &osi_core->macsec_lut_status[ctlr]; - if (lut_status_ptr->num_of_sc_used >= OSI_MAX_NUM_SC) { + if (lut_status_ptr->num_of_sc_used >= max_num_sc[osi_core->macsec]) { OSI_CORE_ERR(osi_core->osd, OSI_LOG_ARG_HW_FAIL, "Err: Reached max SC LUT entries!\n", 0ULL); ret = -1; @@ -5855,7 +5867,7 @@ static nve32_t add_new_sc(struct osi_core_priv_data *const osi_core, } avail_sc_idx = get_avail_sc_idx(osi_core, ctlr); - if (avail_sc_idx == OSI_MAX_NUM_SC) { + if (avail_sc_idx == max_num_sc[osi_core->macsec]) { OSI_CORE_ERR(osi_core->osd, OSI_LOG_ARG_HW_FAIL, "Err: NO free SC Index\n", 0ULL); ret = -1; @@ -6057,6 +6069,10 @@ static nve32_t delete_dummy_sc(struct osi_core_priv_data *const osi_core, nveu16_t kt_idx = 0U; const nveu8_t zero_mac[OSI_ETH_ALEN] = {0U}; nve32_t ret = 0; + const nveu32_t max_num_sc[MAX_MACSEC_IP_TYPES] = { + OSI_MAX_NUM_SC, + OSI_MAX_NUM_SC_T26x + }; /** Using a dummy parameters used in add_dummy_sc */ dummy_sc.sci[6] = 0xFFU; @@ -6069,7 +6085,7 @@ static nve32_t delete_dummy_sc(struct osi_core_priv_data *const osi_core, dummy_sc.pn_window = 0x10U; dummy_sc.flags = 0U; - for (i = 0U; i < OSI_MAX_NUM_SC; i++) { + for (i = 0U; i < max_num_sc[osi_core->macsec]; i++) { if (osi_macsec_memcmp(&osi_core->macsec_dummy_sc_macids[i][0], sc->sci, (nve32_t)OSI_ETH_ALEN) == OSI_NONE_SIGNED) { existing_sc = find_existing_sc(osi_core, &dummy_sc, @@ -6124,6 +6140,10 @@ static nve32_t add_dummy_sc(struct osi_core_priv_data *const osi_core, nveu8_t * nve32_t ret = 0; nveu8_t i = 0; const nveu8_t zero_mac[OSI_ETH_ALEN] = {0U}; + const nveu32_t max_num_sc[MAX_MACSEC_IP_TYPES] = { + OSI_MAX_NUM_SC, + OSI_MAX_NUM_SC_T26x + }; /** Using dummy SC parameters to create TX SC entry in LUTs */ sc.sci[6] = 0xFFU; @@ -6142,7 +6162,7 @@ static nve32_t add_dummy_sc(struct osi_core_priv_data *const osi_core, nveu8_t * "Failed to program dummy sc\n", (nveul64_t)ret); goto exit_func; } - for (i = 0U; i < OSI_MAX_NUM_SC; i++) { + for (i = 0U; i < max_num_sc[osi_core->macsec]; i++) { if (osi_macsec_memcmp(&osi_core->macsec_dummy_sc_macids[i][0], macsec_vf_mac, (nve32_t)OSI_ETH_ALEN) == OSI_NONE_SIGNED) { break;