[dpdk-dev] [PATCH v1 48/58] net/octeontx2: add FW version get operation

Ferruh Yigit ferruh.yigit at intel.com
Thu Jun 6 18:06:19 CEST 2019


On 6/2/2019 4:24 PM, jerinj at marvell.com wrote:
> From: Vamsi Attunuru <vattunuru at marvell.com>
> 
> Add firmware version get operation.
> 
> Signed-off-by: Vamsi Attunuru <vattunuru at marvell.com>

<...>

> @@ -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;
}


More information about the dev mailing list