nvethernetrm: Add DA to SCI LUT with peer MACID

Bug 4754899

Change-Id: I5c15770793d2f64fb54b565fd046ad9f9d7cb4bf
Signed-off-by: Sanath Kumar Gampa <sgampa@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/kernel/nvethernetrm/+/3237499
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Mahesh Patil <maheshp@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
This commit is contained in:
Sanath Kumar Gampa
2024-10-25 09:42:33 +00:00
committed by mobile promotions
parent 248fb6375c
commit 593c8fc44c
2 changed files with 15 additions and 0 deletions

View File

@@ -1334,6 +1334,9 @@ struct osi_macsec_sc_info {
2: Indicates offset as 50
*/
nveu8_t conf_offset;
/** Peer MACID is stored
* valid values are from 0 to UINT8_MAX */
nveu8_t peer_macid[OSI_ETH_ALEN];
};
/**

View File

@@ -5627,6 +5627,7 @@ static nve32_t add_upd_sc(struct osi_core_priv_data *const osi_core,
nve32_t ret = 0;
nveu32_t i;
nveu8_t error_mask = 0;
const nveu8_t zero_mac[OSI_ETH_ALEN] = {0U};
#ifdef MACSEC_KEY_PROGRAM
struct osi_macsec_kt_config kt_config = {0};
#endif /* MACSEC_KEY_PROGRAM */
@@ -5709,6 +5710,12 @@ static nve32_t add_upd_sc(struct osi_core_priv_data *const osi_core,
/* Extract the mac sa from the SCI itself */
copy_rev_order(lut_config.lut_in.sa, sc->sci, OSI_ETH_ALEN);
lut_config.flags |= OSI_LUT_FLAGS_SA_VALID;
/* Update peer MACID in DA of tx SCI_LUT */
copy_rev_order(lut_config.lut_in.da, sc->peer_macid, OSI_ETH_ALEN);
if (osi_macsec_memcmp(&sc->peer_macid[0], zero_mac,
(nve32_t)OSI_ETH_ALEN) != OSI_NONE_SIGNED) {
lut_config.flags |= OSI_LUT_FLAGS_DA_VALID;
}
lut_config.sci_lut_out.sc_index = sc->sc_idx_start;
for (i = 0; i < OSI_SCI_LEN; i++) {
lut_config.sci_lut_out.sci[i] = sc->sci[OSI_SCI_LEN - 1U - i];
@@ -5859,6 +5866,8 @@ static nve32_t add_new_sc(struct osi_core_priv_data *const osi_core,
}
new_sc = &lut_status_ptr->sc_info[avail_sc_idx];
memcpy_sci_sak_hkey(new_sc, sc);
(void)osi_macsec_memcpy(new_sc->peer_macid, sc->peer_macid,
OSI_ETH_ALEN);
new_sc->curr_an = sc->curr_an;
new_sc->next_pn = sc->next_pn;
new_sc->pn_window = sc->pn_window;
@@ -5984,6 +5993,9 @@ static nve32_t macsec_configure(struct osi_core_priv_data *const osi_core,
*/
*tmp_sc_p = *existing_sc;
memcpy_sci_sak_hkey(tmp_sc_p, sc);
(void)osi_macsec_memcpy(tmp_sc_p->peer_macid,
sc->peer_macid,
OSI_ETH_ALEN);
tmp_sc_p->curr_an = sc->curr_an;
tmp_sc_p->next_pn = sc->next_pn;
tmp_sc_p->pn_window = sc->pn_window;