[dpdk-dev] [PATCH v2 51/62] net/cnxk: add ethdev firmware version get

Jerin Jacob jerinjacobk at gmail.com
Tue Jun 15 14:47:26 CEST 2021


On Mon, Jun 7, 2021 at 11:39 PM Nithin Dabilpuram
<ndabilpuram at marvell.com> wrote:
>
> From: Satha Rao <skoteshwar at marvell.com>
>
> Add callback to get ethdev firmware version.
>
> Signed-off-by: Satha Rao <skoteshwar at marvell.com>

> +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;
> +
> +       strlcpy(fw_version, str, fw_size);

use rte_strlcpy instead.

> +
> +       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)
> --
> 2.8.4
>


More information about the dev mailing list