]> git.droids-corp.org - dpdk.git/commitdiff
net/cnxk: support EEPROM module queries
authorSunil Kumar Kori <skori@marvell.com>
Wed, 23 Jun 2021 04:46:40 +0000 (10:16 +0530)
committerJerin Jacob <jerinj@marvell.com>
Tue, 29 Jun 2021 23:00:41 +0000 (01:00 +0200)
Patch implements eeprom module info get ethops for cn9k and
cn10k platforms.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
doc/guides/nics/features/cnxk.ini
doc/guides/nics/features/cnxk_vec.ini
doc/guides/nics/features/cnxk_vf.ini
drivers/net/cnxk/cnxk_ethdev.c
drivers/net/cnxk/cnxk_ethdev.h
drivers/net/cnxk/cnxk_ethdev_ops.c

index afd0f01e66e6cb7a310b82e621b067f2fdf491ef..b1e86414bdda1e19d5b0d295b8d2812c90f34eb0 100644 (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
index 4bd11ceb57a13a6b5a7467346813c5f06d1a1e0d..0f996344678fb790ede8d7c4bf4e0cabf498bb70 100644 (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
index 335d08248b9a9103ce56ea37738e15a3b613ac02..cecced95d3956e241458b0c4ab3be0bd287ef5d3 100644 (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
index a18d1d5ae6cc8a36884b51367afd31fd2656bf77..165c35477aa43c0bd9f0d21385196411ef57e566 100644 (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
index 5e982f92d9971930591b71325e06657b129a953d..083af2924e0b20d6a81e05435a51a0ca5b85ef6e 100644 (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,
index c8da129c37107c4a501f5467fe4edf37f9eb58cc..55b0411e6cf83748a7ee510b9665788d3a2c2012 100644 (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;
+}