mirror of
git://nv-tegra.nvidia.com/kernel/nvethernetrm.git
synced 2025-12-22 09:12:10 +03:00
osi: macsec: fixes for misra defects
Below are the rules addressed Rule: MISRA_C-2012_Rule_15.5 Diff: -90 Rule: MISRA_C-2012_Rule_2.5 Diff: -34 Rule: MISRA_C-2012_Rule_8.13 Diff: -5 Rule: MISRA_C-2012_Rule_8.6 Diff: -1 Rule: CERT_INT31-C Diff: -2 Bug 3691236 Change-Id: I0b943b7626ea47e34eee585e42f0c9b98d67a7f4 Signed-off-by: Sanath Kumar Gampa <sgampa@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/kernel/nvethernetrm/+/2732627 Reviewed-by: Narayan Reddy <narayanr@nvidia.com> Reviewed-by: Mahesh Patil <maheshp@nvidia.com> Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
Bhadram Varka
parent
879afe6abc
commit
bb47c20f52
@@ -41,7 +41,9 @@
|
||||
#define OSI_AN2_VALID OSI_BIT(2)
|
||||
#define OSI_AN3_VALID OSI_BIT(3)
|
||||
#define OSI_MAX_NUM_SA 4U
|
||||
#ifdef DEBUG_MACSEC
|
||||
#define OSI_CURR_AN_MAX 3
|
||||
#endif /* DEBUG_MACSEC */
|
||||
#define OSI_KEY_INDEX_MAX 31U
|
||||
#define OSI_PN_MAX_DEFAULT 0xFFFFFFFFU
|
||||
#define OSI_PN_THRESHOLD_DEFAULT 0xC0000000U
|
||||
@@ -120,8 +122,6 @@
|
||||
* @brief Helper macros for debug buffer table CONFIG register programming
|
||||
* @{
|
||||
*/
|
||||
#define OSI_DBG_TBL_READ OSI_LUT_READ
|
||||
#define OSI_DBG_TBL_WRITE OSI_LUT_WRITE
|
||||
/* Num of Tx debug buffers */
|
||||
#define OSI_TX_DBG_BUF_IDX_MAX 12U
|
||||
/* Num of Rx debug buffers */
|
||||
@@ -159,20 +159,15 @@
|
||||
*/
|
||||
#define OSI_MACSEC_TX_EN OSI_BIT(0)
|
||||
#define OSI_MACSEC_RX_EN OSI_BIT(1)
|
||||
/* MACSEC SECTAG + ICV + 2B ethertype adds upto 34B */
|
||||
#define MACSEC_TAG_ICV_LEN 34U
|
||||
/* MACSEC TZ key config cmd */
|
||||
#define OSI_MACSEC_CMD_TZ_CONFIG 0x1
|
||||
/* MACSEC TZ key table entries reset cmd */
|
||||
#define OSI_MACSEC_CMD_TZ_KT_RESET 0x2
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Indicates different operations on MACSEC SA
|
||||
*/
|
||||
#ifdef MACSEC_KEY_PROGRAM
|
||||
#define OSI_CREATE_SA 1U
|
||||
#endif /* MACSEC_KEY_PROGRAM */
|
||||
#define OSI_ENABLE_SA 2U
|
||||
#define OSI_DISABLE_SA 3U
|
||||
|
||||
/**
|
||||
* @brief MACSEC SA State LUT entry outputs structure
|
||||
@@ -238,6 +233,7 @@ struct osi_macsec_table_config {
|
||||
nveu16_t index;
|
||||
};
|
||||
|
||||
#if defined(MACSEC_KEY_PROGRAM) || defined(LINUX_OS)
|
||||
/**
|
||||
* @brief MACSEC Key Table entry structure
|
||||
*/
|
||||
@@ -247,6 +243,7 @@ struct osi_kt_entry {
|
||||
/** Indicates Hash-key */
|
||||
nveu8_t h[OSI_KEY_LEN_128];
|
||||
};
|
||||
#endif /* MACSEC_KEY_PROGRAM */
|
||||
|
||||
/**
|
||||
* @brief MACSEC BYP/SCI LUT entry inputs structure
|
||||
@@ -296,6 +293,7 @@ struct osi_macsec_lut_config {
|
||||
struct osi_sa_state_outputs sa_state_out;
|
||||
};
|
||||
|
||||
#if defined(MACSEC_KEY_PROGRAM) || defined(LINUX_OS)
|
||||
/**
|
||||
* @brief MACSEC Key Table config data structure
|
||||
*/
|
||||
@@ -307,6 +305,7 @@ struct osi_macsec_kt_config {
|
||||
/** Indicates key table entry valid or not, bit 31 */
|
||||
nveu32_t flags;
|
||||
};
|
||||
#endif /* MACSEC_KEY_PROGRAM */
|
||||
|
||||
/**
|
||||
* @brief MACSEC Debug buffer config data structure
|
||||
@@ -537,6 +536,7 @@ void osi_macsec_s_isr(struct osi_core_priv_data *const osi_core);
|
||||
nve32_t osi_macsec_config_lut(struct osi_core_priv_data *const osi_core,
|
||||
struct osi_macsec_lut_config *const lut_config);
|
||||
|
||||
#ifdef MACSEC_KEY_PROGRAM
|
||||
/**
|
||||
* @brief osi_macsec_config_kt - API to read or update the keys
|
||||
*
|
||||
@@ -563,6 +563,7 @@ nve32_t osi_macsec_config_lut(struct osi_core_priv_data *const osi_core,
|
||||
*/
|
||||
nve32_t osi_macsec_config_kt(struct osi_core_priv_data *const osi_core,
|
||||
struct osi_macsec_kt_config *const kt_config);
|
||||
#endif /* MACSEC_KEY_PROGRAM */
|
||||
|
||||
/**
|
||||
* @brief osi_macsec_cipher_config - API to update the cipher
|
||||
|
||||
@@ -6779,7 +6779,7 @@ static void eqos_config_for_macsec(struct osi_core_priv_data *const osi_core,
|
||||
if ((enable != OSI_ENABLE) && (enable != OSI_DISABLE)) {
|
||||
OSI_CORE_ERR(OSI_NULL, OSI_LOG_ARG_INVALID,
|
||||
"Failed to config EQOS per MACSEC\n", 0ULL);
|
||||
return;
|
||||
goto exit;
|
||||
}
|
||||
if (osi_core->mac_ver == OSI_EQOS_MAC_5_30) {
|
||||
/* stop MAC Tx */
|
||||
@@ -6847,6 +6847,8 @@ static void eqos_config_for_macsec(struct osi_core_priv_data *const osi_core,
|
||||
OSI_LOG_ARG_HW_FAIL, "Error: osi_core->hw_feature is NULL\n",
|
||||
0ULL);
|
||||
}
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
|
||||
#endif /* MACSEC_SUPPORT */
|
||||
|
||||
@@ -216,13 +216,13 @@ static int ivc_macsec_dbg_events_config(
|
||||
|
||||
ret = osi_core->osd_ops.ivc_send(osi_core, &msg, sizeof(msg));
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
msg.status = osi_memcpy((void *)dbg_buf_config,
|
||||
(void *)&msg.data.dbg_buf_config,
|
||||
sizeof(struct osi_macsec_dbg_buf_config));
|
||||
|
||||
exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -252,13 +252,13 @@ static int ivc_macsec_dbg_buf_config(
|
||||
|
||||
ret = osi_core->osd_ops.ivc_send(osi_core, &msg, sizeof(msg));
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
msg.status = osi_memcpy((void *)dbg_buf_config,
|
||||
(void *) &msg.data.dbg_buf_config,
|
||||
sizeof(struct osi_macsec_dbg_buf_config));
|
||||
|
||||
exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -360,10 +360,11 @@ static int ivc_macsec_config(struct osi_core_priv_data *const osi_core,
|
||||
|
||||
ret = osi_core->osd_ops.ivc_send(osi_core, &msg, sizeof(msg));
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
*kt_idx = msg.data.macsec_cfg.kt_idx;
|
||||
exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -525,12 +526,13 @@ static nve32_t ivc_macsec_lut_config(struct osi_core_priv_data *const osi_core,
|
||||
|
||||
ret = osi_core->osd_ops.ivc_send(osi_core, &msg, sizeof(msg));
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
msg.status = osi_memcpy((void *)lut_config,
|
||||
(void *)&msg.data.lut_config,
|
||||
sizeof(struct osi_macsec_lut_config));
|
||||
exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -48,8 +48,10 @@
|
||||
* @brief MACsec controller register offsets
|
||||
* @{
|
||||
*/
|
||||
#ifdef MACSEC_KEY_PROGRAM
|
||||
#define MACSEC_GCM_KEYTABLE_CONFIG 0x0000
|
||||
#define MACSEC_GCM_KEYTABLE_DATA(x) ((0x0004U) + ((x) * 4U))
|
||||
#endif /* MACSEC_KEY_PROGRAM */
|
||||
#define MACSEC_RX_ICV_ERR_CNTRL 0x4000
|
||||
#define MACSEC_INTERRUPT_COMMON_SR 0x4004
|
||||
#define MACSEC_TX_IMR 0x4008
|
||||
@@ -89,8 +91,9 @@
|
||||
#define MACSEC_TX_SCI_LUT_VALID 0xD028
|
||||
#define MACSEC_RX_BYP_LUT_VALID 0xD02C
|
||||
#define MACSEC_RX_SCI_LUT_VALID 0xD030
|
||||
|
||||
#ifdef OSI_DEBUG
|
||||
#define MACSEC_COMMON_IMR 0xD054
|
||||
#endif /* OSI_DEBUG */
|
||||
#define MACSEC_COMMON_ISR 0xD058
|
||||
#define MACSEC_TX_SC_KEY_INVALID_STS0_0 0xD064
|
||||
#define MACSEC_TX_SC_KEY_INVALID_STS1_0 0xD068
|
||||
@@ -114,6 +117,7 @@
|
||||
#define MACSEC_RX_SOT_DELAY 0xE01C
|
||||
/** @} */
|
||||
|
||||
#ifdef MACSEC_KEY_PROGRAM
|
||||
/**
|
||||
* @addtogroup MACSEC_GCM_KEYTABLE_CONFIG register
|
||||
*
|
||||
@@ -138,6 +142,7 @@
|
||||
#define MACSEC_KT_DATA_REG_SAK_CNT 8U
|
||||
#define MACSEC_KT_DATA_REG_H_CNT 4U
|
||||
/** @} */
|
||||
#endif /* MACSEC_KEY_PROGRAM */
|
||||
|
||||
/**
|
||||
* @addtogroup MACSEC_LUT_CONFIG register
|
||||
@@ -208,6 +213,7 @@
|
||||
#define MACSEC_TX_AES_MODE_AES256 OSI_BIT(1)
|
||||
/** @} */
|
||||
|
||||
#ifdef OSI_DEBUG
|
||||
/**
|
||||
* @addtogroup MACSEC_COMMON_IMR register
|
||||
*
|
||||
@@ -220,6 +226,7 @@
|
||||
#define MACSEC_TX_UNINIT_KEY_SLOT_INT_EN OSI_BIT(1)
|
||||
#define MACSEC_TX_LKUP_MISS_INT_EN OSI_BIT(0)
|
||||
/** @} */
|
||||
#endif /* OSI_DEBUG */
|
||||
|
||||
/**
|
||||
* @addtogroup MACSEC_TX_IMR register
|
||||
@@ -227,11 +234,12 @@
|
||||
* @brief Bit definitions of TX_INTERRUPT_MASK register
|
||||
* @{
|
||||
*/
|
||||
#define MACSEC_TX_MAC_CRC_ERROR_INT_EN OSI_BIT(16)
|
||||
#ifdef OSI_DEBUG
|
||||
#define MACSEC_TX_DBG_BUF_CAPTURE_DONE_INT_EN OSI_BIT(22)
|
||||
#define MACSEC_TX_MTU_CHECK_FAIL_INT_EN OSI_BIT(19)
|
||||
#define MACSEC_TX_AES_GCM_BUF_OVF_INT_EN OSI_BIT(18)
|
||||
#define MACSEC_TX_SC_AN_NOT_VALID_INT_EN OSI_BIT(17)
|
||||
#define MACSEC_TX_MAC_CRC_ERROR_INT_EN OSI_BIT(16)
|
||||
#define MACSEC_TX_PN_EXHAUSTED_INT_EN OSI_BIT(1)
|
||||
#define MACSEC_TX_PN_THRSHLD_RCHD_INT_EN OSI_BIT(0)
|
||||
/** @} */
|
||||
@@ -243,12 +251,13 @@
|
||||
* @{
|
||||
*/
|
||||
#define MACSEC_RX_DBG_BUF_CAPTURE_DONE_INT_EN OSI_BIT(22)
|
||||
#define MACSEC_RX_ICV_ERROR_INT_EN OSI_BIT(21)
|
||||
#define RX_REPLAY_ERROR_INT_EN OSI_BIT(20)
|
||||
#define MACSEC_RX_MTU_CHECK_FAIL_INT_EN OSI_BIT(19)
|
||||
#define MACSEC_RX_AES_GCM_BUF_OVF_INT_EN OSI_BIT(18)
|
||||
#define MACSEC_RX_MAC_CRC_ERROR_INT_EN OSI_BIT(16)
|
||||
#define MACSEC_RX_PN_EXHAUSTED_INT_EN OSI_BIT(1)
|
||||
#endif /* OSI_DEBUG */
|
||||
#define MACSEC_RX_ICV_ERROR_INT_EN OSI_BIT(21)
|
||||
#define MACSEC_RX_MAC_CRC_ERROR_INT_EN OSI_BIT(16)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
@@ -441,6 +450,8 @@
|
||||
|
||||
/* debug buffer data read/write length */
|
||||
#define DBG_BUF_LEN 4U
|
||||
#ifdef MACSEC_KEY_PROGRAM
|
||||
#define INTEGER_LEN 4U
|
||||
#endif /* MACSEC_KEY_PROGRAM */
|
||||
|
||||
#endif /* INCLUDED_MACSEC_H */
|
||||
|
||||
@@ -6133,7 +6133,7 @@ static void mgbe_config_for_macsec(struct osi_core_priv_data *const osi_core,
|
||||
if ((enable != OSI_ENABLE) && (enable != OSI_DISABLE)) {
|
||||
OSI_CORE_ERR(OSI_NULL, OSI_LOG_ARG_INVALID,
|
||||
"Failed to config MGBE per MACSEC\n", 0ULL);
|
||||
return;
|
||||
goto exit;
|
||||
}
|
||||
/* stop MAC Tx */
|
||||
mgbe_config_mac_tx(osi_core, OSI_DISABLE);
|
||||
@@ -6195,6 +6195,8 @@ static void mgbe_config_for_macsec(struct osi_core_priv_data *const osi_core,
|
||||
0ULL);
|
||||
}
|
||||
}
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
#endif /* MACSEC_SUPPORT */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user