net/cnxk: support firmware version query
authorSatha Rao <skoteshwar@marvell.com>
Wed, 23 Jun 2021 04:46:51 +0000 (10:16 +0530)
committerJerin Jacob <jerinj@marvell.com>
Wed, 30 Jun 2021 00:21:50 +0000 (02:21 +0200)
Add callback to get ethdev firmware version.

Signed-off-by: Satha Rao <skoteshwar@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 9d7af2d..08776e0 100644 (file)
@@ -35,6 +35,7 @@ Packet type parsing  = Y
 Basic stats          = Y
 Stats per queue      = Y
 Extended stats       = Y
+FW version           = Y
 Module EEPROM dump   = Y
 Linux                = Y
 ARMv8                = Y
index 75c15d1..bafe050 100644 (file)
@@ -33,6 +33,7 @@ Packet type parsing  = Y
 Basic stats          = Y
 Stats per queue      = Y
 Extended stats       = Y
+FW version           = Y
 Module EEPROM dump   = Y
 Linux                = Y
 ARMv8                = Y
index 7870930..9d49175 100644 (file)
@@ -30,6 +30,7 @@ Packet type parsing  = Y
 Basic stats          = Y
 Stats per queue      = Y
 Extended stats       = Y
+FW version           = Y
 Module EEPROM dump   = Y
 Linux                = Y
 ARMv8                = Y
index d863810..26e4ddf 100644 (file)
@@ -1222,6 +1222,7 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
        .xstats_reset = cnxk_nix_xstats_reset,
        .xstats_get_by_id = cnxk_nix_xstats_get_by_id,
        .xstats_get_names_by_id = cnxk_nix_xstats_get_names_by_id,
+       .fw_version_get = cnxk_nix_fw_version_get,
        .rxq_info_get = cnxk_nix_rxq_info_get,
        .txq_info_get = cnxk_nix_txq_info_get,
        .tx_done_cleanup = cnxk_nix_tx_done_cleanup,
index 07c87ea..a25be8a 100644 (file)
@@ -313,6 +313,8 @@ int cnxk_nix_xstats_get_names_by_id(struct rte_eth_dev *eth_dev,
 int cnxk_nix_xstats_get_by_id(struct rte_eth_dev *eth_dev, const uint64_t *ids,
                              uint64_t *values, unsigned int n);
 int cnxk_nix_xstats_reset(struct rte_eth_dev *eth_dev);
+int cnxk_nix_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version,
+                           size_t fw_size);
 void cnxk_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t qid,
                           struct rte_eth_rxq_info *qinfo);
 void cnxk_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t qid,
index 36ca750..228c624 100644 (file)
@@ -639,6 +639,25 @@ cnxk_nix_pool_ops_supported(struct rte_eth_dev *eth_dev, const char *pool)
        return -ENOTSUP;
 }
 
+int
+cnxk_nix_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version,
+                       size_t fw_size)
+{
+       struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+       const char *str = roc_npc_profile_name_get(&dev->npc);
+       uint32_t size = strlen(str) + 1;
+
+       if (fw_size > size)
+               fw_size = size;
+
+       rte_strlcpy(fw_version, str, fw_size);
+
+       if (fw_size < size)
+               return size;
+
+       return 0;
+}
+
 void
 cnxk_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t qid,
                      struct rte_eth_rxq_info *qinfo)