mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
nvethernet:macsec:Related change to OSI misra fix
Fixed MISRA 15.5 and 2.5 errors in OSI hence these are the dependednt changes in Linux OSD Bug 3691236 Change-Id: Ie590082025235c48abb1588550121e80b92db487 Signed-off-by: Sanath Kumar Gampa <sgampa@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2735586 Reviewed-by: svcacv <svcacv@nvidia.com> Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com> Reviewed-by: Mahesh Patil <maheshp@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: Narayan Reddy <narayanr@nvidia.com> Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
Revanth Kumar Uppala
parent
c7376b2390
commit
6104d5e348
@@ -22,7 +22,7 @@ ccflags-y += -DLINUX_IVC -DUPDATED_PAD_CAL \
|
|||||||
-I$(srctree.nvidia)/drivers/net/ethernet/nvidia/nvethernet/nvethernetrm/include \
|
-I$(srctree.nvidia)/drivers/net/ethernet/nvidia/nvethernet/nvethernetrm/include \
|
||||||
-I$(srctree.nvidia)/drivers/net/ethernet/nvidia/nvethernet/nvethernetrm/osi/common/include
|
-I$(srctree.nvidia)/drivers/net/ethernet/nvidia/nvethernet/nvethernetrm/osi/common/include
|
||||||
|
|
||||||
ccflags-y += -DMACSEC_SUPPORT -DNET30 -DMACSEC_DEBUG -DOSI_DEBUG -DHSI_SUPPORT
|
ccflags-y += -DMACSEC_SUPPORT -DNET30 -DMACSEC_DEBUG -DOSI_DEBUG -DHSI_SUPPORT -DLINUX_OS
|
||||||
|
|
||||||
nvethernet-objs:= ether_linux.o \
|
nvethernet-objs:= ether_linux.o \
|
||||||
osd.o \
|
osd.o \
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ int macsec_open(struct macsec_priv_data *macsec_pdata,
|
|||||||
|
|
||||||
#ifndef MACSEC_KEY_PROGRAM
|
#ifndef MACSEC_KEY_PROGRAM
|
||||||
/* Clear KT entries */
|
/* Clear KT entries */
|
||||||
ret = macsec_tz_kt_config(pdata, OSI_MACSEC_CMD_TZ_KT_RESET,
|
ret = macsec_tz_kt_config(pdata, NV_MACSEC_CMD_TZ_KT_RESET,
|
||||||
OSI_NULL, genl_info);
|
OSI_NULL, genl_info);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(dev, "TZ key config failed %d\n", ret);
|
dev_err(dev, "TZ key config failed %d\n", ret);
|
||||||
@@ -768,8 +768,6 @@ static int macsec_dis_rx_sa(struct sk_buff *skb, struct genl_info *info)
|
|||||||
rx_sa.curr_an, rx_sa.next_pn);
|
rx_sa.curr_an, rx_sa.next_pn);
|
||||||
dev_info(dev, "\tkey: " KEYSTR, KEY2STR(rx_sa.sak));
|
dev_info(dev, "\tkey: " KEYSTR, KEY2STR(rx_sa.sak));
|
||||||
|
|
||||||
rx_sa.flags = OSI_DISABLE_SA;
|
|
||||||
|
|
||||||
mutex_lock(&macsec_pdata->lock);
|
mutex_lock(&macsec_pdata->lock);
|
||||||
ret = osi_macsec_config(pdata->osi_core, &rx_sa, OSI_DISABLE,
|
ret = osi_macsec_config(pdata->osi_core, &rx_sa, OSI_DISABLE,
|
||||||
OSI_CTLR_SEL_RX, &kt_idx);
|
OSI_CTLR_SEL_RX, &kt_idx);
|
||||||
@@ -785,7 +783,7 @@ static int macsec_dis_rx_sa(struct sk_buff *skb, struct genl_info *info)
|
|||||||
table_config->rw = OSI_LUT_WRITE;
|
table_config->rw = OSI_LUT_WRITE;
|
||||||
table_config->index = kt_idx;
|
table_config->index = kt_idx;
|
||||||
|
|
||||||
ret = macsec_tz_kt_config(pdata, OSI_MACSEC_CMD_TZ_CONFIG, &kt_config,
|
ret = macsec_tz_kt_config(pdata, NV_MACSEC_CMD_TZ_CONFIG, &kt_config,
|
||||||
info);
|
info);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(dev, "%s: failed to program SAK through TZ %d",
|
dev_err(dev, "%s: failed to program SAK through TZ %d",
|
||||||
@@ -892,8 +890,8 @@ static int macsec_create_rx_sa(struct sk_buff *skb, struct genl_info *info)
|
|||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
#endif /* MACSEC_KEY_PROGRAM */
|
|
||||||
rx_sa.flags = OSI_CREATE_SA;
|
rx_sa.flags = OSI_CREATE_SA;
|
||||||
|
#endif /* MACSEC_KEY_PROGRAM */
|
||||||
|
|
||||||
mutex_lock(&macsec_pdata->lock);
|
mutex_lock(&macsec_pdata->lock);
|
||||||
ret = osi_macsec_config(pdata->osi_core, &rx_sa, OSI_ENABLE,
|
ret = osi_macsec_config(pdata->osi_core, &rx_sa, OSI_ENABLE,
|
||||||
@@ -916,7 +914,7 @@ static int macsec_create_rx_sa(struct sk_buff *skb, struct genl_info *info)
|
|||||||
kt_config.entry.sak[i] = rx_sa.sak[i];
|
kt_config.entry.sak[i] = rx_sa.sak[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = macsec_tz_kt_config(pdata, OSI_MACSEC_CMD_TZ_CONFIG, &kt_config,
|
ret = macsec_tz_kt_config(pdata, NV_MACSEC_CMD_TZ_CONFIG, &kt_config,
|
||||||
info);
|
info);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(dev, "%s: failed to program SAK through TZ %d",
|
dev_err(dev, "%s: failed to program SAK through TZ %d",
|
||||||
@@ -1032,8 +1030,6 @@ static int macsec_dis_tx_sa(struct sk_buff *skb, struct genl_info *info)
|
|||||||
tx_sa.curr_an, tx_sa.next_pn);
|
tx_sa.curr_an, tx_sa.next_pn);
|
||||||
dev_info(dev, "\tkey: " KEYSTR, KEY2STR(tx_sa.sak));
|
dev_info(dev, "\tkey: " KEYSTR, KEY2STR(tx_sa.sak));
|
||||||
|
|
||||||
tx_sa.flags = OSI_DISABLE_SA;
|
|
||||||
|
|
||||||
mutex_lock(&macsec_pdata->lock);
|
mutex_lock(&macsec_pdata->lock);
|
||||||
ret = osi_macsec_config(pdata->osi_core, &tx_sa, OSI_DISABLE,
|
ret = osi_macsec_config(pdata->osi_core, &tx_sa, OSI_DISABLE,
|
||||||
OSI_CTLR_SEL_TX, &kt_idx);
|
OSI_CTLR_SEL_TX, &kt_idx);
|
||||||
@@ -1050,7 +1046,7 @@ static int macsec_dis_tx_sa(struct sk_buff *skb, struct genl_info *info)
|
|||||||
table_config->rw = OSI_LUT_WRITE;
|
table_config->rw = OSI_LUT_WRITE;
|
||||||
table_config->index = kt_idx;
|
table_config->index = kt_idx;
|
||||||
|
|
||||||
ret = macsec_tz_kt_config(pdata, OSI_MACSEC_CMD_TZ_CONFIG, &kt_config,
|
ret = macsec_tz_kt_config(pdata, NV_MACSEC_CMD_TZ_CONFIG, &kt_config,
|
||||||
info);
|
info);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(dev, "%s: failed to program SAK through TZ %d",
|
dev_err(dev, "%s: failed to program SAK through TZ %d",
|
||||||
@@ -1113,8 +1109,8 @@ static int macsec_create_tx_sa(struct sk_buff *skb, struct genl_info *info)
|
|||||||
tx_sa.sci[4], tx_sa.sci[5], tx_sa.sci[6], tx_sa.sci[7],
|
tx_sa.sci[4], tx_sa.sci[5], tx_sa.sci[6], tx_sa.sci[7],
|
||||||
tx_sa.curr_an, tx_sa.next_pn);
|
tx_sa.curr_an, tx_sa.next_pn);
|
||||||
dev_info(dev, "\tkey: " KEYSTR, KEY2STR(tx_sa.sak));
|
dev_info(dev, "\tkey: " KEYSTR, KEY2STR(tx_sa.sak));
|
||||||
tx_sa.flags = OSI_CREATE_SA;
|
|
||||||
#ifdef MACSEC_KEY_PROGRAM
|
#ifdef MACSEC_KEY_PROGRAM
|
||||||
|
tx_sa.flags = OSI_CREATE_SA;
|
||||||
ret = hkey_generation(tx_sa.sak, tx_sa.hkey);
|
ret = hkey_generation(tx_sa.sak, tx_sa.hkey);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
dev_err(dev, "%s: failed to Generate HKey", __func__);
|
dev_err(dev, "%s: failed to Generate HKey", __func__);
|
||||||
@@ -1144,7 +1140,7 @@ static int macsec_create_tx_sa(struct sk_buff *skb, struct genl_info *info)
|
|||||||
kt_config.entry.sak[i] = tx_sa.sak[i];
|
kt_config.entry.sak[i] = tx_sa.sak[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = macsec_tz_kt_config(pdata, OSI_MACSEC_CMD_TZ_CONFIG, &kt_config,
|
ret = macsec_tz_kt_config(pdata, NV_MACSEC_CMD_TZ_CONFIG, &kt_config,
|
||||||
info);
|
info);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(dev, "%s: failed to program SAK through TZ %d",
|
dev_err(dev, "%s: failed to program SAK through TZ %d",
|
||||||
@@ -1686,12 +1682,8 @@ static int macsec_tz_kt_config(struct ether_priv_data *pdata,
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remap osi tz cmd to netlink cmd */
|
if (cmd != NV_MACSEC_CMD_TZ_KT_RESET &&
|
||||||
if (cmd == OSI_MACSEC_CMD_TZ_CONFIG) {
|
cmd != NV_MACSEC_CMD_TZ_CONFIG) {
|
||||||
cmd = NV_MACSEC_CMD_TZ_CONFIG;
|
|
||||||
} else if (cmd == OSI_MACSEC_CMD_TZ_KT_RESET) {
|
|
||||||
cmd = NV_MACSEC_CMD_TZ_KT_RESET;
|
|
||||||
} else {
|
|
||||||
dev_err(dev, "%s: Wrong TZ cmd %d\n", __func__, cmd);
|
dev_err(dev, "%s: Wrong TZ cmd %d\n", __func__, cmd);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|||||||
@@ -39,6 +39,11 @@
|
|||||||
*/
|
*/
|
||||||
#define BYP_LUT_INPUTS 1
|
#define BYP_LUT_INPUTS 1
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief MACSEC SECTAG + ICV + 2B ethertype adds up to 34B
|
||||||
|
*/
|
||||||
|
#define MACSEC_TAG_ICV_LEN 34U
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Size of Macsec IRQ name.
|
* @brief Size of Macsec IRQ name.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1018,7 +1018,7 @@ static void dump_dbg_buffers(char **buf_p, unsigned short ctlr_sel,
|
|||||||
}
|
}
|
||||||
for (i = 0; i < idx_max; i++) {
|
for (i = 0; i < idx_max; i++) {
|
||||||
memset(&dbg_buf_config, OSI_NONE, sizeof(dbg_buf_config));
|
memset(&dbg_buf_config, OSI_NONE, sizeof(dbg_buf_config));
|
||||||
dbg_buf_config.rw = OSI_DBG_TBL_READ;
|
dbg_buf_config.rw = OSI_LUT_READ;
|
||||||
dbg_buf_config.ctlr_sel = ctlr_sel;
|
dbg_buf_config.ctlr_sel = ctlr_sel;
|
||||||
dbg_buf_config.index = i;
|
dbg_buf_config.index = i;
|
||||||
if (osi_macsec_config_dbg_buf(osi_core, &dbg_buf_config) < 0) {
|
if (osi_macsec_config_dbg_buf(osi_core, &dbg_buf_config) < 0) {
|
||||||
@@ -1037,7 +1037,7 @@ static void dump_dbg_buffers(char **buf_p, unsigned short ctlr_sel,
|
|||||||
/* reset debug buffer after buf read */
|
/* reset debug buffer after buf read */
|
||||||
for (i = 0; i < idx_max; i++) {
|
for (i = 0; i < idx_max; i++) {
|
||||||
memset(&dbg_buf_config, OSI_NONE, sizeof(dbg_buf_config));
|
memset(&dbg_buf_config, OSI_NONE, sizeof(dbg_buf_config));
|
||||||
dbg_buf_config.rw = OSI_DBG_TBL_WRITE;
|
dbg_buf_config.rw = OSI_LUT_WRITE;
|
||||||
dbg_buf_config.ctlr_sel = ctlr_sel;
|
dbg_buf_config.ctlr_sel = ctlr_sel;
|
||||||
dbg_buf_config.index = i;
|
dbg_buf_config.index = i;
|
||||||
if (osi_macsec_config_dbg_buf(osi_core, &dbg_buf_config) < 0) {
|
if (osi_macsec_config_dbg_buf(osi_core, &dbg_buf_config) < 0) {
|
||||||
@@ -1131,7 +1131,7 @@ static ssize_t macsec_dbg_events_store(struct device *dev,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbg_buf_config.ctlr_sel = controller;
|
dbg_buf_config.ctlr_sel = controller;
|
||||||
dbg_buf_config.rw = OSI_DBG_TBL_WRITE;
|
dbg_buf_config.rw = OSI_LUT_WRITE;
|
||||||
|
|
||||||
if (osi_macsec_dbg_events_config(osi_core, &dbg_buf_config) < 0) {
|
if (osi_macsec_dbg_events_config(osi_core, &dbg_buf_config) < 0) {
|
||||||
dev_err(dev, "%s: Failed to config dbg trigger events\n", __func__);
|
dev_err(dev, "%s: Failed to config dbg trigger events\n", __func__);
|
||||||
@@ -1672,7 +1672,7 @@ static ssize_t macsec_sc_state_lut_store(struct device *dev,
|
|||||||
|
|
||||||
if ((index > OSI_SC_LUT_MAX_INDEX) ||
|
if ((index > OSI_SC_LUT_MAX_INDEX) ||
|
||||||
(ctlr != OSI_CTLR_SEL_TX && ctlr != OSI_CTLR_SEL_RX) ||
|
(ctlr != OSI_CTLR_SEL_TX && ctlr != OSI_CTLR_SEL_RX) ||
|
||||||
(curr_an > OSI_CURR_AN_MAX)) {
|
(curr_an >= OSI_MAX_NUM_SA)) {
|
||||||
dev_err(pdata->dev, "%s:Invalid inputs", __func__);
|
dev_err(pdata->dev, "%s:Invalid inputs", __func__);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user