DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: selwin.sebastian@amd.com
Cc: dev@dpdk.org, "Somalapuram, Amaranath" <Amaranath.Somalapuram@amd.com>
Subject: Re: [dpdk-dev] [PATCH v1] net/axgbe: add support for reading FW version
Date: Wed, 9 Dec 2020 14:17:38 +0000	[thread overview]
Message-ID: <12017189-0d86-2cea-8f65-f38dc57a8120@intel.com> (raw)
In-Reply-To: <20201119072607.5717-1-selwin.sebastian@amd.com>

On 11/19/2020 7:26 AM, selwin.sebastian@amd.com wrote:
> From: Selwin Sebastian <selwin.sebastian@amd.com>
> 
> Added support for fw_version_get API
> 
> Signed-off-by: Selwin Sebastian <selwin.sebastian@amd.com>
> ---
>   doc/guides/nics/features/axgbe.ini |  1 +
>   drivers/net/axgbe/axgbe_ethdev.c   |  1 +
>   drivers/net/axgbe/axgbe_rxtx.c     | 21 +++++++++++++++++++++
>   drivers/net/axgbe/axgbe_rxtx.h     |  3 +++
>   4 files changed, 26 insertions(+)
> 
> diff --git a/doc/guides/nics/features/axgbe.ini b/doc/guides/nics/features/axgbe.ini
> index 34df0d1ee..3adc5639f 100644
> --- a/doc/guides/nics/features/axgbe.ini
> +++ b/doc/guides/nics/features/axgbe.ini
> @@ -17,6 +17,7 @@ CRC offload          = Y
>   L3 checksum offload  = Y
>   L4 checksum offload  = Y
>   Basic stats          = Y
> +FW version           = Y
>   Linux UIO            = Y
>   x86-32               = Y
>   x86-64               = Y
> diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
> index cfe6aba73..1982c6a8e 100644
> --- a/drivers/net/axgbe/axgbe_ethdev.c
> +++ b/drivers/net/axgbe/axgbe_ethdev.c
> @@ -257,6 +257,7 @@ static const struct eth_dev_ops axgbe_eth_dev_ops = {
>   	.timesync_adjust_time         = axgbe_timesync_adjust_time,
>   	.timesync_read_time           = axgbe_timesync_read_time,
>   	.timesync_write_time          = axgbe_timesync_write_time,
> +	.fw_version_get			= axgbe_dev_fw_version_get,
>   };
>   
>   static int axgbe_phy_reset(struct axgbe_port *pdata)
> diff --git a/drivers/net/axgbe/axgbe_rxtx.c b/drivers/net/axgbe/axgbe_rxtx.c
> index 032e3cebc..227be33fa 100644
> --- a/drivers/net/axgbe/axgbe_rxtx.c
> +++ b/drivers/net/axgbe/axgbe_rxtx.c
> @@ -571,6 +571,27 @@ int axgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
>   	return 0;
>   }
>   
> +int axgbe_dev_fw_version_get(struct rte_eth_dev *eth_dev,
> +		char *fw_version, size_t fw_size)
> +{
> +	struct axgbe_port *pdata;
> +	struct axgbe_hw_features *hw_feat;
> +	char fw_ver[32];

Is the 'fw_ver' variable not used at all?

> +
> +	pdata = (struct axgbe_port *)eth_dev->data->dev_private;
> +	hw_feat = &pdata->hw_feat;
> +
> +	if (fw_version == NULL || fw_size <= 0)
> +		return -EINVAL;
> +
> +	snprintf(fw_version, sizeof(fw_ver), "%d.%d.%d",

Shouldn't use 'fw_size' for size limit, instead of 'sizeof(fw_ver)'?

> +			AXGMAC_GET_BITS(hw_feat->version, MAC_VR, USERVER),
> +			AXGMAC_GET_BITS(hw_feat->version, MAC_VR, DEVID),
> +			AXGMAC_GET_BITS(hw_feat->version, MAC_VR, SNPSVER));
> +
> +	return 0;

if the fw version string doesn't fit into the provided buffer, this shouldn't 
ignored silently, according to the API, size of the non truncated string should 
be returned.

> +}
> +

  parent reply	other threads:[~2020-12-09 14:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-19  7:26 selwin.sebastian
2020-11-19 11:26 ` Sebastian, Selwin
2020-11-19 11:35   ` Somalapuram, Amaranath
2020-12-09 14:17 ` Ferruh Yigit [this message]
2020-12-29  7:09   ` [dpdk-dev] [PATCH v2] " selwin.sebastian
2020-12-30 12:41     ` Somalapuram, Amaranath
2021-01-04 12:21     ` Ferruh Yigit
2021-01-06  8:00       ` [dpdk-dev] [PATCH v3] " selwin.sebastian
2021-01-07 10:44         ` Somalapuram, Amaranath
2021-01-11 13:14           ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12017189-0d86-2cea-8f65-f38dc57a8120@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=Amaranath.Somalapuram@amd.com \
    --cc=dev@dpdk.org \
    --cc=selwin.sebastian@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).