DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] net/axgbe: add support for reading FW version
@ 2020-11-19  7:26 selwin.sebastian
  2020-11-19 11:26 ` Sebastian, Selwin
  2020-12-09 14:17 ` Ferruh Yigit
  0 siblings, 2 replies; 11+ messages in thread
From: selwin.sebastian @ 2020-11-19  7:26 UTC (permalink / raw)
  To: dev

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];
+
+	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",
+			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;
+}
+
 static void axgbe_txq_prepare_tx_stop(struct axgbe_port *pdata,
 				      unsigned int queue)
 {
diff --git a/drivers/net/axgbe/axgbe_rxtx.h b/drivers/net/axgbe/axgbe_rxtx.h
index f2fbe9299..c2b11bb0e 100644
--- a/drivers/net/axgbe/axgbe_rxtx.h
+++ b/drivers/net/axgbe/axgbe_rxtx.h
@@ -162,6 +162,9 @@ void axgbe_dev_disable_tx(struct rte_eth_dev *dev);
 int axgbe_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int axgbe_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 
+int axgbe_dev_fw_version_get(struct rte_eth_dev *eth_dev,
+			char *fw_version, size_t fw_size);
+
 uint16_t axgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			 uint16_t nb_pkts);
 uint16_t axgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH v1] net/axgbe: add support for reading FW version
  2020-11-19  7:26 [dpdk-dev] [PATCH v1] net/axgbe: add support for reading FW version selwin.sebastian
@ 2020-11-19 11:26 ` Sebastian, Selwin
  2020-11-19 11:35   ` Somalapuram, Amaranath
  2020-12-09 14:17 ` Ferruh Yigit
  1 sibling, 1 reply; 11+ messages in thread
From: Sebastian, Selwin @ 2020-11-19 11:26 UTC (permalink / raw)
  To: Sebastian, Selwin, dev; +Cc: Somalapuram, Amaranath

[AMD Official Use Only - Internal Distribution Only]

+Amar

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of selwin.sebastian@amd.com
Sent: Thursday, November 19, 2020 12:56 PM
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v1] net/axgbe: add support for reading FW version

[CAUTION: External Email]

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];
+
+       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",
+                       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;
+}
+
 static void axgbe_txq_prepare_tx_stop(struct axgbe_port *pdata,
                                      unsigned int queue)  { diff --git a/drivers/net/axgbe/axgbe_rxtx.h b/drivers/net/axgbe/axgbe_rxtx.h index f2fbe9299..c2b11bb0e 100644
--- a/drivers/net/axgbe/axgbe_rxtx.h
+++ b/drivers/net/axgbe/axgbe_rxtx.h
@@ -162,6 +162,9 @@ void axgbe_dev_disable_tx(struct rte_eth_dev *dev);  int axgbe_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);  int axgbe_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);

+int axgbe_dev_fw_version_get(struct rte_eth_dev *eth_dev,
+                       char *fw_version, size_t fw_size);
+
 uint16_t axgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
                         uint16_t nb_pkts);  uint16_t axgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
--
2.17.1

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH v1] net/axgbe: add support for reading FW version
  2020-11-19 11:26 ` Sebastian, Selwin
@ 2020-11-19 11:35   ` Somalapuram, Amaranath
  0 siblings, 0 replies; 11+ messages in thread
From: Somalapuram, Amaranath @ 2020-11-19 11:35 UTC (permalink / raw)
  To: Sebastian, Selwin, dev, Ferruh Yigit


-----Original Message-----
From: Sebastian, Selwin <Selwin.Sebastian@amd.com> 
Sent: Thursday, November 19, 2020 4:56 PM
To: Sebastian, Selwin <Selwin.Sebastian@amd.com>; dev@dpdk.org
Cc: Somalapuram, Amaranath <Amaranath.Somalapuram@amd.com>
Subject: RE: [dpdk-dev] [PATCH v1] net/axgbe: add support for reading FW version

[AMD Official Use Only - Internal Distribution Only]

+Amar

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of selwin.sebastian@amd.com
Sent: Thursday, November 19, 2020 12:56 PM
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v1] net/axgbe: add support for reading FW version

[CAUTION: External Email]

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];
+
+       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",
+                       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;
+}
+
 static void axgbe_txq_prepare_tx_stop(struct axgbe_port *pdata,
                                      unsigned int queue)  { diff --git a/drivers/net/axgbe/axgbe_rxtx.h b/drivers/net/axgbe/axgbe_rxtx.h index f2fbe9299..c2b11bb0e 100644
--- a/drivers/net/axgbe/axgbe_rxtx.h
+++ b/drivers/net/axgbe/axgbe_rxtx.h
@@ -162,6 +162,9 @@ void axgbe_dev_disable_tx(struct rte_eth_dev *dev);  int axgbe_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);  int axgbe_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);

+int axgbe_dev_fw_version_get(struct rte_eth_dev *eth_dev,
+                       char *fw_version, size_t fw_size);
+
 uint16_t axgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
                         uint16_t nb_pkts);  uint16_t axgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
--
2.17.1

Acked-by: Amaranath Somalapuram <asomalap@amd.com>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH v1] net/axgbe: add support for reading FW version
  2020-11-19  7:26 [dpdk-dev] [PATCH v1] net/axgbe: add support for reading FW version selwin.sebastian
  2020-11-19 11:26 ` Sebastian, Selwin
@ 2020-12-09 14:17 ` Ferruh Yigit
  2020-12-29  7:09   ` [dpdk-dev] [PATCH v2] " selwin.sebastian
  1 sibling, 1 reply; 11+ messages in thread
From: Ferruh Yigit @ 2020-12-09 14:17 UTC (permalink / raw)
  To: selwin.sebastian; +Cc: dev, Somalapuram, Amaranath

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.

> +}
> +

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v2] net/axgbe: add support for reading FW version
  2020-12-09 14:17 ` Ferruh Yigit
@ 2020-12-29  7:09   ` selwin.sebastian
  2020-12-30 12:41     ` Somalapuram, Amaranath
  2021-01-04 12:21     ` Ferruh Yigit
  0 siblings, 2 replies; 11+ messages in thread
From: selwin.sebastian @ 2020-12-29  7:09 UTC (permalink / raw)
  To: dev; +Cc: amaranath.somalapuram, ferruh.yigit

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     | 25 +++++++++++++++++++++++++
 drivers/net/axgbe/axgbe_rxtx.h     |  3 +++
 4 files changed, 30 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..3298a294e 100644
--- a/drivers/net/axgbe/axgbe_rxtx.c
+++ b/drivers/net/axgbe/axgbe_rxtx.c
@@ -571,6 +571,31 @@ 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;
+	int ret;
+
+	pdata = (struct axgbe_port *)eth_dev->data->dev_private;
+	hw_feat = &pdata->hw_feat;
+
+	if (fw_version == NULL || fw_size <= 0)
+		return -EINVAL;
+
+	ret = snprintf(fw_version, fw_size, "%d.%d.%d",
+			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));
+	ret += 1; /* add the size of '\0' */
+
+	if (fw_size < (u32)ret)
+		return ret;
+	else
+		return 0;
+}
+
 static void axgbe_txq_prepare_tx_stop(struct axgbe_port *pdata,
 				      unsigned int queue)
 {
diff --git a/drivers/net/axgbe/axgbe_rxtx.h b/drivers/net/axgbe/axgbe_rxtx.h
index f2fbe9299..c2b11bb0e 100644
--- a/drivers/net/axgbe/axgbe_rxtx.h
+++ b/drivers/net/axgbe/axgbe_rxtx.h
@@ -162,6 +162,9 @@ void axgbe_dev_disable_tx(struct rte_eth_dev *dev);
 int axgbe_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int axgbe_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 
+int axgbe_dev_fw_version_get(struct rte_eth_dev *eth_dev,
+			char *fw_version, size_t fw_size);
+
 uint16_t axgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			 uint16_t nb_pkts);
 uint16_t axgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/axgbe: add support for reading FW version
  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
  1 sibling, 0 replies; 11+ messages in thread
From: Somalapuram, Amaranath @ 2020-12-30 12:41 UTC (permalink / raw)
  To: Sebastian, Selwin, dev; +Cc: ferruh.yigit



-----Original Message-----
From: Sebastian, Selwin <Selwin.Sebastian@amd.com> 
Sent: Tuesday, December 29, 2020 12:40 PM
To: dev@dpdk.org
Cc: Somalapuram, Amaranath <Amaranath.Somalapuram@amd.com>; ferruh.yigit@intel.com
Subject: [PATCH v2] net/axgbe: add support for reading FW version

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     | 25 +++++++++++++++++++++++++
 drivers/net/axgbe/axgbe_rxtx.h     |  3 +++
 4 files changed, 30 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..3298a294e 100644
--- a/drivers/net/axgbe/axgbe_rxtx.c
+++ b/drivers/net/axgbe/axgbe_rxtx.c
@@ -571,6 +571,31 @@ 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;
+	int ret;
+
+	pdata = (struct axgbe_port *)eth_dev->data->dev_private;
+	hw_feat = &pdata->hw_feat;
+
+	if (fw_version == NULL || fw_size <= 0)
+		return -EINVAL;
+
+	ret = snprintf(fw_version, fw_size, "%d.%d.%d",
+			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));
+	ret += 1; /* add the size of '\0' */
+
+	if (fw_size < (u32)ret)
+		return ret;
+	else
+		return 0;
+}
+
 static void axgbe_txq_prepare_tx_stop(struct axgbe_port *pdata,
 				      unsigned int queue)
 {
diff --git a/drivers/net/axgbe/axgbe_rxtx.h b/drivers/net/axgbe/axgbe_rxtx.h index f2fbe9299..c2b11bb0e 100644
--- a/drivers/net/axgbe/axgbe_rxtx.h
+++ b/drivers/net/axgbe/axgbe_rxtx.h
@@ -162,6 +162,9 @@ void axgbe_dev_disable_tx(struct rte_eth_dev *dev);  int axgbe_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);  int axgbe_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 
+int axgbe_dev_fw_version_get(struct rte_eth_dev *eth_dev,
+			char *fw_version, size_t fw_size);
+
 uint16_t axgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			 uint16_t nb_pkts);
 uint16_t axgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
--
2.17.1

Acked-by: Somalapuram Amaranath <asomalap@amd.com>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/axgbe: add support for reading FW version
  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
  1 sibling, 1 reply; 11+ messages in thread
From: Ferruh Yigit @ 2021-01-04 12:21 UTC (permalink / raw)
  To: selwin.sebastian, dev; +Cc: amaranath.somalapuram

On 12/29/2020 7:09 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     | 25 +++++++++++++++++++++++++
>   drivers/net/axgbe/axgbe_rxtx.h     |  3 +++
>   4 files changed, 30 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..3298a294e 100644
> --- a/drivers/net/axgbe/axgbe_rxtx.c
> +++ b/drivers/net/axgbe/axgbe_rxtx.c
> @@ -571,6 +571,31 @@ 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;
> +	int ret;
> +
> +	pdata = (struct axgbe_port *)eth_dev->data->dev_private;
> +	hw_feat = &pdata->hw_feat;
> +
> +	if (fw_version == NULL || fw_size <= 0)

'size_t' can't be negative, no need to compare '< 0' case.

> +		return -EINVAL;
> +
> +	ret = snprintf(fw_version, fw_size, "%d.%d.%d",
> +			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));
> +	ret += 1; /* add the size of '\0' */
> +

'snprintf' can return error, which should be taken into account.

> +	if (fw_size < (u32)ret)

instead of casting to 'u32', can cast to 'size_t' which is the type of the 
'fw_size'.

> +		return ret;
> +	else
> +		return 0;
> +}
> +
>   static void axgbe_txq_prepare_tx_stop(struct axgbe_port *pdata,
>   				      unsigned int queue)
>   {
> diff --git a/drivers/net/axgbe/axgbe_rxtx.h b/drivers/net/axgbe/axgbe_rxtx.h
> index f2fbe9299..c2b11bb0e 100644
> --- a/drivers/net/axgbe/axgbe_rxtx.h
> +++ b/drivers/net/axgbe/axgbe_rxtx.h
> @@ -162,6 +162,9 @@ void axgbe_dev_disable_tx(struct rte_eth_dev *dev);
>   int axgbe_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
>   int axgbe_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
>   
> +int axgbe_dev_fw_version_get(struct rte_eth_dev *eth_dev,
> +			char *fw_version, size_t fw_size);
> +
>   uint16_t axgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
>   			 uint16_t nb_pkts);
>   uint16_t axgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v3] net/axgbe: add support for reading FW version
  2021-01-04 12:21     ` Ferruh Yigit
@ 2021-01-06  8:00       ` selwin.sebastian
  2021-01-07 10:44         ` Somalapuram, Amaranath
  0 siblings, 1 reply; 11+ messages in thread
From: selwin.sebastian @ 2021-01-06  8:00 UTC (permalink / raw)
  To: dev; +Cc: amaranath.somalapuram, ferruh.yigit

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     | 28 ++++++++++++++++++++++++++++
 drivers/net/axgbe/axgbe_rxtx.h     |  3 +++
 4 files changed, 33 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..c10127a02 100644
--- a/drivers/net/axgbe/axgbe_rxtx.c
+++ b/drivers/net/axgbe/axgbe_rxtx.c
@@ -571,6 +571,34 @@ 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;
+	int ret;
+
+	pdata = (struct axgbe_port *)eth_dev->data->dev_private;
+	hw_feat = &pdata->hw_feat;
+
+	if (fw_version == NULL)
+		return -EINVAL;
+
+	ret = snprintf(fw_version, fw_size, "%d.%d.%d",
+			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));
+	if (ret < 0)
+		return -EINVAL;
+
+	ret += 1; /* add the size of '\0' */
+
+	if (fw_size < (size_t)ret)
+		return ret;
+	else
+		return 0;
+}
+
 static void axgbe_txq_prepare_tx_stop(struct axgbe_port *pdata,
 				      unsigned int queue)
 {
diff --git a/drivers/net/axgbe/axgbe_rxtx.h b/drivers/net/axgbe/axgbe_rxtx.h
index f2fbe9299..c2b11bb0e 100644
--- a/drivers/net/axgbe/axgbe_rxtx.h
+++ b/drivers/net/axgbe/axgbe_rxtx.h
@@ -162,6 +162,9 @@ void axgbe_dev_disable_tx(struct rte_eth_dev *dev);
 int axgbe_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int axgbe_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 
+int axgbe_dev_fw_version_get(struct rte_eth_dev *eth_dev,
+			char *fw_version, size_t fw_size);
+
 uint16_t axgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			 uint16_t nb_pkts);
 uint16_t axgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH v3] net/axgbe: add support for reading FW version
  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
  0 siblings, 1 reply; 11+ messages in thread
From: Somalapuram, Amaranath @ 2021-01-07 10:44 UTC (permalink / raw)
  To: Sebastian, Selwin, dev; +Cc: ferruh.yigit



-----Original Message-----
From: Sebastian, Selwin <Selwin.Sebastian@amd.com> 
Sent: Wednesday, January 6, 2021 1:31 PM
To: dev@dpdk.org
Cc: Somalapuram, Amaranath <Amaranath.Somalapuram@amd.com>; ferruh.yigit@intel.com
Subject: [PATCH v3] net/axgbe: add support for reading FW version

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     | 28 ++++++++++++++++++++++++++++
 drivers/net/axgbe/axgbe_rxtx.h     |  3 +++
 4 files changed, 33 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..c10127a02 100644
--- a/drivers/net/axgbe/axgbe_rxtx.c
+++ b/drivers/net/axgbe/axgbe_rxtx.c
@@ -571,6 +571,34 @@ 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;
+	int ret;
+
+	pdata = (struct axgbe_port *)eth_dev->data->dev_private;
+	hw_feat = &pdata->hw_feat;
+
+	if (fw_version == NULL)
+		return -EINVAL;
+
+	ret = snprintf(fw_version, fw_size, "%d.%d.%d",
+			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));
+	if (ret < 0)
+		return -EINVAL;
+
+	ret += 1; /* add the size of '\0' */
+
+	if (fw_size < (size_t)ret)
+		return ret;
+	else
+		return 0;
+}
+
 static void axgbe_txq_prepare_tx_stop(struct axgbe_port *pdata,
 				      unsigned int queue)
 {
diff --git a/drivers/net/axgbe/axgbe_rxtx.h b/drivers/net/axgbe/axgbe_rxtx.h index f2fbe9299..c2b11bb0e 100644
--- a/drivers/net/axgbe/axgbe_rxtx.h
+++ b/drivers/net/axgbe/axgbe_rxtx.h
@@ -162,6 +162,9 @@ void axgbe_dev_disable_tx(struct rte_eth_dev *dev);  int axgbe_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);  int axgbe_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 
+int axgbe_dev_fw_version_get(struct rte_eth_dev *eth_dev,
+			char *fw_version, size_t fw_size);
+
 uint16_t axgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			 uint16_t nb_pkts);
 uint16_t axgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
--
2.17.1

Acked-by: Somalapuram Amaranath <asomalap@amd.com>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH v3] net/axgbe: add support for reading FW version
  2021-01-07 10:44         ` Somalapuram, Amaranath
@ 2021-01-11 13:14           ` Ferruh Yigit
  0 siblings, 0 replies; 11+ messages in thread
From: Ferruh Yigit @ 2021-01-11 13:14 UTC (permalink / raw)
  To: Somalapuram, Amaranath, Sebastian, Selwin, dev

On 1/7/2021 10:44 AM, Somalapuram, Amaranath wrote:
> 
> 
> -----Original Message-----
> From: Sebastian, Selwin <Selwin.Sebastian@amd.com>
> Sent: Wednesday, January 6, 2021 1:31 PM
> To: dev@dpdk.org
> Cc: Somalapuram, Amaranath <Amaranath.Somalapuram@amd.com>; ferruh.yigit@intel.com
> Subject: [PATCH v3] net/axgbe: add support for reading FW version
> 
> From: Selwin Sebastian <selwin.sebastian@amd.com>
> 
> Added support for fw_version_get API
> 
> Signed-off-by: Selwin Sebastian <selwin.sebastian@amd.com>

<...>

> 
> Acked-by: Somalapuram Amaranath <asomalap@amd.com>
> 

Applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH v2] net/axgbe: add support for reading FW version
@ 2020-12-29  7:00 selwin.sebastian
  0 siblings, 0 replies; 11+ messages in thread
From: selwin.sebastian @ 2020-12-29  7:00 UTC (permalink / raw)
  To: dev; +Cc: amaranath.somalapuram, ferruh.yigit

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     | 25 +++++++++++++++++++++++++
 drivers/net/axgbe/axgbe_rxtx.h     |  3 +++
 4 files changed, 30 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..3298a294e 100644
--- a/drivers/net/axgbe/axgbe_rxtx.c
+++ b/drivers/net/axgbe/axgbe_rxtx.c
@@ -571,6 +571,31 @@ 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;
+	int ret;
+
+	pdata = (struct axgbe_port *)eth_dev->data->dev_private;
+	hw_feat = &pdata->hw_feat;
+
+	if (fw_version == NULL || fw_size <= 0)
+		return -EINVAL;
+
+	ret = snprintf(fw_version, fw_size, "%d.%d.%d",
+			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));
+	ret += 1; /* add the size of '\0' */
+
+	if (fw_size < (u32)ret)
+		return ret;
+	else
+		return 0;
+}
+
 static void axgbe_txq_prepare_tx_stop(struct axgbe_port *pdata,
 				      unsigned int queue)
 {
diff --git a/drivers/net/axgbe/axgbe_rxtx.h b/drivers/net/axgbe/axgbe_rxtx.h
index f2fbe9299..c2b11bb0e 100644
--- a/drivers/net/axgbe/axgbe_rxtx.h
+++ b/drivers/net/axgbe/axgbe_rxtx.h
@@ -162,6 +162,9 @@ void axgbe_dev_disable_tx(struct rte_eth_dev *dev);
 int axgbe_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int axgbe_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 
+int axgbe_dev_fw_version_get(struct rte_eth_dev *eth_dev,
+			char *fw_version, size_t fw_size);
+
 uint16_t axgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			 uint16_t nb_pkts);
 uint16_t axgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-01-11 13:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-19  7:26 [dpdk-dev] [PATCH v1] net/axgbe: add support for reading FW version selwin.sebastian
2020-11-19 11:26 ` Sebastian, Selwin
2020-11-19 11:35   ` Somalapuram, Amaranath
2020-12-09 14:17 ` Ferruh Yigit
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
2020-12-29  7:00 [dpdk-dev] [PATCH v2] " selwin.sebastian

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git