[dpdk-dev,v2,1/5] ethdev: add firmware version get

Message ID 1481008582-69416-2-git-send-email-qiming.yang@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
checkpatch/checkpatch success coding style OK

Commit Message

Qiming Yang Dec. 6, 2016, 7:16 a.m. UTC
  This patch adds a new API 'rte_eth_dev_fwver_get' for fetching firmware
version by a given device.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
v2 changes:
* modified some comment statements.
---
---
 lib/librte_ether/rte_ethdev.c          | 12 ++++++++++++
 lib/librte_ether/rte_ethdev.h          | 18 ++++++++++++++++++
 lib/librte_ether/rte_ether_version.map |  7 +++++++
 3 files changed, 37 insertions(+)
  

Comments

Ferruh Yigit Dec. 8, 2016, 11:07 a.m. UTC | #1
Hi Qiming,

On 12/6/2016 7:16 AM, Qiming Yang wrote:
> This patch adds a new API 'rte_eth_dev_fwver_get' for fetching firmware
> version by a given device.
> 
> Signed-off-by: Qiming Yang <qiming.yang@intel.com>

<...>

> @@ -1444,6 +1448,7 @@ struct eth_dev_ops {
>  	/**< Get names of extended statistics. */
>  	eth_queue_stats_mapping_set_t queue_stats_mapping_set;
>  	/**< Configure per queue stat counter mapping. */
> +	eth_fw_version_get_t       fw_version_get; /**< Get firmware version. */

Hi Qiming,

Not sure if I am missing something but this change is for following [1]
deprecation notice, right?
If so, notice suggest updating rte_eth_dev_info_get() to include
fw_version, but this patch adds a new eth_dev_ops.

Is it agreed to add a new eth_dev_ops for this?


[1]
* In 17.02 ABI change is planned: the ``rte_eth_dev_info`` structure
  will be extended with a new member ``fw_version`` in order to store
  the NIC firmware version.



>  	eth_dev_infos_get_t        dev_infos_get; /**< Get device info. */
>  	eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
>  	/**< Get packet types supported and identified by device*/

<...>
  
Qiming Yang Dec. 12, 2016, 1:28 a.m. UTC | #2
Hi, Yigit
Yes, we had planned to add  fw_version in rte_eth_dev_info_get(). But Remy think we should better to implement this feature through a way don't break the original ABI. So I change the implement.

-----Original Message-----
From: Yigit, Ferruh 
Sent: Thursday, December 8, 2016 7:07 PM
To: Yang, Qiming <qiming.yang@intel.com>; dev@dpdk.org
Cc: Thomas Monjalon <thomas.monjalon@6wind.com>
Subject: Re: [dpdk-dev] [PATCH v2 1/5] ethdev: add firmware version get

Hi Qiming,

On 12/6/2016 7:16 AM, Qiming Yang wrote:
> This patch adds a new API 'rte_eth_dev_fwver_get' for fetching 
> firmware version by a given device.
> 
> Signed-off-by: Qiming Yang <qiming.yang@intel.com>

<...>

> @@ -1444,6 +1448,7 @@ struct eth_dev_ops {
>  	/**< Get names of extended statistics. */
>  	eth_queue_stats_mapping_set_t queue_stats_mapping_set;
>  	/**< Configure per queue stat counter mapping. */
> +	eth_fw_version_get_t       fw_version_get; /**< Get firmware version. */

Hi Qiming,

Not sure if I am missing something but this change is for following [1] deprecation notice, right?
If so, notice suggest updating rte_eth_dev_info_get() to include fw_version, but this patch adds a new eth_dev_ops.

Is it agreed to add a new eth_dev_ops for this?


[1]
* In 17.02 ABI change is planned: the ``rte_eth_dev_info`` structure
  will be extended with a new member ``fw_version`` in order to store
  the NIC firmware version.



>  	eth_dev_infos_get_t        dev_infos_get; /**< Get device info. */
>  	eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
>  	/**< Get packet types supported and identified by device*/

<...>
  

Patch

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index fde8112..793e50f 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -1538,6 +1538,18 @@  rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id,
 }
 
 void
+rte_eth_dev_fwver_get(uint8_t port_id, char *fw_version, int fw_length)
+{
+	struct rte_eth_dev *dev;
+
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
+	dev = &rte_eth_devices[port_id];
+
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->fw_version_get);
+	(*dev->dev_ops->fw_version_get)(dev, fw_version, fw_length);
+}
+
+void
 rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)
 {
 	struct rte_eth_dev *dev;
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 9678179..2c05df4 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1150,6 +1150,10 @@  typedef uint32_t (*eth_rx_queue_count_t)(struct rte_eth_dev *dev,
 typedef int (*eth_rx_descriptor_done_t)(void *rxq, uint16_t offset);
 /**< @internal Check DD bit of specific RX descriptor */
 
+typedef void (*eth_fw_version_get_t)(struct rte_eth_dev *dev,
+				    char *fw_version, int fw_length);
+/**< @internal Get firmware information of an Ethernet device. */
+
 typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,
 	uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo);
 
@@ -1444,6 +1448,7 @@  struct eth_dev_ops {
 	/**< Get names of extended statistics. */
 	eth_queue_stats_mapping_set_t queue_stats_mapping_set;
 	/**< Configure per queue stat counter mapping. */
+	eth_fw_version_get_t       fw_version_get; /**< Get firmware version. */
 	eth_dev_infos_get_t        dev_infos_get; /**< Get device info. */
 	eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
 	/**< Get packet types supported and identified by device*/
@@ -2385,6 +2390,19 @@  void rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr);
 void rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info);
 
 /**
+ * Retrieve the firmware version of a device.
+ *
+ * @param port_id
+ *   The port identifier of the device.
+ * @param fw_version
+ *   A array pointer to store the firmware version of a device,
+ *   allocated by caller.
+ * @param fw_length
+ *   The size of the array pointed by fw_version.
+ */
+void rte_eth_dev_fwver_get(uint8_t port_id, char *fw_version, int fw_length);
+
+/**
  * Retrieve the supported packet types of an Ethernet device.
  *
  * When a packet type is announced as supported, it *must* be recognized by
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index 72be66d..5e6387f 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -147,3 +147,10 @@  DPDK_16.11 {
 	rte_eth_dev_pci_remove;
 
 } DPDK_16.07;
+
+DPDK_17.02 {
+	global:
+
+	rte_eth_dev_fwver_get;
+
+} DPDK_16.11;