net/cnxk: support EEPROM module queries

Patch implements eeprom module info get ethops for cn9k and
cn10k platforms.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
This commit is contained in:
Sunil Kumar Kori 2021-06-23 10:16:40 +05:30 committed by Jerin Jacob
parent fef6ee0729
commit aa898299d3
6 changed files with 48 additions and 0 deletions

View File

@ -31,6 +31,7 @@ L4 checksum offload = Y
Inner L3 checksum = Y
Inner L4 checksum = Y
Packet type parsing = Y
Module EEPROM dump = Y
Linux = Y
ARMv8 = Y
Usage doc = Y

View File

@ -29,6 +29,7 @@ L4 checksum offload = Y
Inner L3 checksum = Y
Inner L4 checksum = Y
Packet type parsing = Y
Module EEPROM dump = Y
Linux = Y
ARMv8 = Y
Usage doc = Y

View File

@ -26,6 +26,7 @@ L4 checksum offload = Y
Inner L3 checksum = Y
Inner L4 checksum = Y
Packet type parsing = Y
Module EEPROM dump = Y
Linux = Y
ARMv8 = Y
Usage doc = Y

View File

@ -1191,6 +1191,8 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
.flow_ctrl_set = cnxk_nix_flow_ctrl_set,
.dev_set_link_up = cnxk_nix_set_link_up,
.dev_set_link_down = cnxk_nix_set_link_down,
.get_module_info = cnxk_nix_get_module_info,
.get_module_eeprom = cnxk_nix_get_module_eeprom,
};
static int

View File

@ -253,6 +253,10 @@ int cnxk_nix_flow_ctrl_get(struct rte_eth_dev *eth_dev,
struct rte_eth_fc_conf *fc_conf);
int cnxk_nix_set_link_up(struct rte_eth_dev *eth_dev);
int cnxk_nix_set_link_down(struct rte_eth_dev *eth_dev);
int cnxk_nix_get_module_info(struct rte_eth_dev *eth_dev,
struct rte_eth_dev_module_info *modinfo);
int cnxk_nix_get_module_eeprom(struct rte_eth_dev *eth_dev,
struct rte_dev_eeprom_info *info);
int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
int cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,

View File

@ -559,3 +559,42 @@ cnxk_nix_set_link_down(struct rte_eth_dev *eth_dev)
exit:
return rc;
}
int
cnxk_nix_get_module_info(struct rte_eth_dev *eth_dev,
struct rte_eth_dev_module_info *modinfo)
{
struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
struct roc_nix_eeprom_info eeprom_info = {0};
struct roc_nix *nix = &dev->nix;
int rc;
rc = roc_nix_eeprom_info_get(nix, &eeprom_info);
if (rc)
return rc;
modinfo->type = eeprom_info.sff_id;
modinfo->eeprom_len = ROC_NIX_EEPROM_SIZE;
return 0;
}
int
cnxk_nix_get_module_eeprom(struct rte_eth_dev *eth_dev,
struct rte_dev_eeprom_info *info)
{
struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
struct roc_nix_eeprom_info eeprom_info = {0};
struct roc_nix *nix = &dev->nix;
int rc = -EINVAL;
if (!info->data || !info->length ||
(info->offset + info->length > ROC_NIX_EEPROM_SIZE))
return rc;
rc = roc_nix_eeprom_info_get(nix, &eeprom_info);
if (rc)
return rc;
rte_memcpy(info->data, eeprom_info.buf + info->offset, info->length);
return 0;
}