On 6/2/2019 4:24 PM, [email protected] wrote:
> From: Vamsi Attunuru <[email protected]>
>
> Add firmware version get operation.
>
> Signed-off-by: Vamsi Attunuru <[email protected]>
<...>
> @@ -209,6 +209,28 @@ otx2_nix_tx_done_cleanup(void *txq, uint32_t free_cnt)
> return 0;
> }
>
> +int
> +otx2_nix_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version,
> + size_t fw_size)
> +{
> + struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
> + int rc = (int)fw_size;
> +
> + if (fw_size > sizeof(dev->mkex_pfl_name))
> + rc = sizeof(dev->mkex_pfl_name);
> +
> + rc = strlcpy(fw_version, (char *)dev->mkex_pfl_name, rc);
> +
> + rc += 1; /* Add the size of '\0' */
> + if (fw_size < (uint32_t)rc)
> + goto done;
> + else
> + return 0;
> +
> +done:
> + return rc;
> +}
Up to you but this can be done without a 'goto':
...
if (fw_size < (uint32_t)rc)
return rc;
return 0;
}