Skip to contentSkip to conversation

e1000: add firmware version get

PATCH New Qiming Yang 10 participants 128 messages Nov 17, 2016 – Feb 9, 2017 2 messages not in the archive Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 e1000: add firmware version get

---
 drivers/net/e1000/igb_ethdev.c | 46 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
drivers/net/e1000/igb_ethdev.c +46 -0
index 2fddf0c..c47f1c8 100644
@@ -120,6 +120,8 @@ static int eth_igb_xstats_get_names(struct rte_eth_dev *dev,
 				    unsigned limit);
 static void eth_igb_stats_reset(struct rte_eth_dev *dev);
 static void eth_igb_xstats_reset(struct rte_eth_dev *dev);
+static void eth_igb_fw_version_get(struct rte_eth_dev *dev,
+				   char *fw_version, int fw_length);
 static void eth_igb_infos_get(struct rte_eth_dev *dev,
 			      struct rte_eth_dev_info *dev_info);
 static const uint32_t *eth_igb_supported_ptypes_get(struct rte_eth_dev *dev);
@@ -388,6 +390,7 @@ static const struct eth_dev_ops eth_igb_ops = {
 	.xstats_get_names     = eth_igb_xstats_get_names,
 	.stats_reset          = eth_igb_stats_reset,
 	.xstats_reset         = eth_igb_xstats_reset,
+	.fw_version_get       = eth_igb_fw_version_get,
 	.dev_infos_get        = eth_igb_infos_get,
 	.dev_supported_ptypes_get = eth_igb_supported_ptypes_get,
 	.mtu_set              = eth_igb_mtu_set,
@@ -1977,6 +1980,49 @@ eth_igbvf_stats_reset(struct rte_eth_dev *dev)
 }
 
 static void
+eth_igb_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
+		       int fw_length)
+{
+	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct e1000_fw_version fw;
+
+	e1000_get_fw_version(hw, &fw);
+
+	switch (hw->mac.type) {
+	case e1000_i210:
+	case e1000_i211:
+		if (!(e1000_get_flash_presence_i210(hw))) {
+			snprintf(fw_version, fw_length,
+				 "%2d.%2d-%d",
+				 fw.invm_major, fw.invm_minor,
+				 fw.invm_img_type);
+			break;
+		}
+		/* fall through */
+	default:
+		/* if option rom is valid, display its version too*/
+		if (fw.or_valid) {
+			snprintf(fw_version, fw_length,
+				 "%d.%d, 0x%08x, %d.%d.%d",
+				 fw.eep_major, fw.eep_minor, fw.etrack_id,
+				 fw.or_major, fw.or_build, fw.or_patch);
+		/* no option rom */
+		} else {
+			if (fw.etrack_id != 0X0000) {
+			snprintf(fw_version, fw_length,
+				 "%d.%d, 0x%08x",
+				 fw.eep_major, fw.eep_minor, fw.etrack_id);
+			} else {
+			snprintf(fw_version, fw_length,
+				 "%d.%d.%d",
+				 fw.eep_major, fw.eep_minor, fw.eep_build);
+			}
+		}
+		break;
+	}
+}
+
+static void
 eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
 	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/5 ethdev: add firmware version get

This patch added API for 'rte_eth_dev_fwver_get'

void rte_eth_dev_fwver_get(uint8_t port_id,
char *fw_version, int fw_length);

---
 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(+)
lib/librte_ether/rte_ethdev.c +12 -0
index fde8112..793e50f 100644
@@ -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;
lib/librte_ether/rte_ethdev.h +18 -0
index 9678179..cf54f1b 100644
@@ -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 an Ethernet device.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param fw_version
+ *   A pointer the firmware version of an Ethernet device
+ * @param fw_length
+ *   The size of the firmware version, which should be large enough to store
+ *   the firmware version of the device.
+ */
+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
lib/librte_ether/rte_ether_version.map +7 -0
index 72be66d..5e6387f 100644
@@ -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;
Signature · 1 line
2.7.4
#122 lore raw

PATCH 1/1 ethtool: dispaly bus info and firmware version

In reply to Qiming Yang

This patch enhances the ethtool-API to support to show the bus information and firmware version as same as kernel version ethtool displayed.

---
 examples/ethtool/ethtool-app/ethapp.c | 2 ++
 examples/ethtool/lib/rte_ethtool.c    | 3 +++
 2 files changed, 5 insertions(+)
examples/ethtool/ethtool-app/ethapp.c +2 -0
index 38e466c..9b77385 100644
@@ -184,6 +184,8 @@ pcmd_drvinfo_callback(__rte_unused void *ptr_params,
 		printf("Port %i driver: %s (ver: %s)\n",
 			id_port, info.driver, info.version
 		      );
+		printf("bus-info: %s\n", info.bus_info);
+		printf("firmware-version: %s\n", info.fw_version);
 	}
 }
 
examples/ethtool/lib/rte_ethtool.c +3 -0
index a1f91d4..542179c 100644
@@ -54,6 +54,9 @@ rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo)
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
+	rte_eth_dev_fwver_get(port_id, drvinfo->fw_version,
+			      sizeof(drvinfo->fw_version));
+
 	memset(&dev_info, 0, sizeof(dev_info));
 	rte_eth_dev_info_get(port_id, &dev_info);
 
Signature · 1 line
2.7.4
#123 lore raw

PATCH 1/1 i40e: add firmware version get

In reply to Qiming Yang
---
 drivers/net/i40e/i40e_ethdev.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/net/i40e/i40e_ethdev.c +15 -0
index 67778ba..f79bc5e 100644
@@ -324,6 +324,8 @@ static int i40e_dev_queue_stats_mapping_set(struct rte_eth_dev *dev,
 					    uint16_t queue_id,
 					    uint8_t stat_idx,
 					    uint8_t is_rx);
+static void i40e_fw_version_get(struct rte_eth_dev *dev,
+				char *fw_version, int fw_length);
 static void i40e_dev_info_get(struct rte_eth_dev *dev,
 			      struct rte_eth_dev_info *dev_info);
 static int i40e_vlan_filter_set(struct rte_eth_dev *dev,
@@ -503,6 +505,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
 	.stats_reset                  = i40e_dev_stats_reset,
 	.xstats_reset                 = i40e_dev_stats_reset,
 	.queue_stats_mapping_set      = i40e_dev_queue_stats_mapping_set,
+	.fw_version_get               = i40e_fw_version_get,
 	.dev_infos_get                = i40e_dev_info_get,
 	.dev_supported_ptypes_get     = i40e_dev_supported_ptypes_get,
 	.vlan_filter_set              = i40e_vlan_filter_set,
@@ -2577,6 +2580,18 @@ i40e_dev_queue_stats_mapping_set(__rte_unused struct rte_eth_dev *dev,
 }
 
 static void
+i40e_fw_version_get(struct rte_eth_dev *dev, char *fw_version, int fw_length)
+{
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	snprintf(fw_version, fw_length,
+		 "%d.%d%d 0x%04x",
+		 ((hw->nvm.version >> 12) & 0xf),
+		 ((hw->nvm.version >> 4) & 0xff),
+		 (hw->nvm.version & 0xf), hw->nvm.eetrack);
+}
+
+static void
 i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
Signature · 1 line
2.7.4
#124 lore raw

PATCH 1/1 ixgbe: add firmware version get

In reply to Qiming Yang
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/net/ixgbe/ixgbe_ethdev.c +18 -0
index edc9b22..da9aa31 100644
@@ -193,6 +193,8 @@ static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 					     uint16_t queue_id,
 					     uint8_t stat_idx,
 					     uint8_t is_rx);
+static void ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
+				 int fw_length);
 static void ixgbe_dev_info_get(struct rte_eth_dev *dev,
 			       struct rte_eth_dev_info *dev_info);
 static const uint32_t *ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev);
@@ -537,6 +539,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
 	.xstats_reset         = ixgbe_dev_xstats_reset,
 	.xstats_get_names     = ixgbe_dev_xstats_get_names,
 	.queue_stats_mapping_set = ixgbe_dev_queue_stats_mapping_set,
+	.fw_version_get       = ixgbe_fw_version_get,
 	.dev_infos_get        = ixgbe_dev_info_get,
 	.dev_supported_ptypes_get = ixgbe_dev_supported_ptypes_get,
 	.mtu_set              = ixgbe_dev_mtu_set,
@@ -3029,6 +3032,21 @@ ixgbevf_dev_stats_reset(struct rte_eth_dev *dev)
 }
 
 static void
+ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, int fw_length)
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u16 eeprom_verh, eeprom_verl;
+	u32 etrack_id;
+
+	ixgbe_read_eeprom(hw, 0x2e, &eeprom_verh);
+	ixgbe_read_eeprom(hw, 0x2d, &eeprom_verl);
+
+	etrack_id = (eeprom_verh << 16) | eeprom_verl;
+	snprintf(fw_version, fw_length,
+		 "0x%08x", etrack_id);
+}
+
+static void
 ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
Signature · 1 line
2.7.4
#125 lore raw

PATCH v2 2/5 e1000: add firmware version get

In reply to Qiming Yang
---
 drivers/net/e1000/igb_ethdev.c | 46 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
drivers/net/e1000/igb_ethdev.c +46 -0
index 2fddf0c..c47f1c8 100644
@@ -120,6 +120,8 @@ static int eth_igb_xstats_get_names(struct rte_eth_dev *dev,
 				    unsigned limit);
 static void eth_igb_stats_reset(struct rte_eth_dev *dev);
 static void eth_igb_xstats_reset(struct rte_eth_dev *dev);
+static void eth_igb_fw_version_get(struct rte_eth_dev *dev,
+				   char *fw_version, int fw_length);
 static void eth_igb_infos_get(struct rte_eth_dev *dev,
 			      struct rte_eth_dev_info *dev_info);
 static const uint32_t *eth_igb_supported_ptypes_get(struct rte_eth_dev *dev);
@@ -388,6 +390,7 @@ static const struct eth_dev_ops eth_igb_ops = {
 	.xstats_get_names     = eth_igb_xstats_get_names,
 	.stats_reset          = eth_igb_stats_reset,
 	.xstats_reset         = eth_igb_xstats_reset,
+	.fw_version_get       = eth_igb_fw_version_get,
 	.dev_infos_get        = eth_igb_infos_get,
 	.dev_supported_ptypes_get = eth_igb_supported_ptypes_get,
 	.mtu_set              = eth_igb_mtu_set,
@@ -1977,6 +1980,49 @@ eth_igbvf_stats_reset(struct rte_eth_dev *dev)
 }
 
 static void
+eth_igb_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
+		       int fw_length)
+{
+	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct e1000_fw_version fw;
+
+	e1000_get_fw_version(hw, &fw);
+
+	switch (hw->mac.type) {
+	case e1000_i210:
+	case e1000_i211:
+		if (!(e1000_get_flash_presence_i210(hw))) {
+			snprintf(fw_version, fw_length,
+				 "%2d.%2d-%d",
+				 fw.invm_major, fw.invm_minor,
+				 fw.invm_img_type);
+			break;
+		}
+		/* fall through */
+	default:
+		/* if option rom is valid, display its version too*/
+		if (fw.or_valid) {
+			snprintf(fw_version, fw_length,
+				 "%d.%d, 0x%08x, %d.%d.%d",
+				 fw.eep_major, fw.eep_minor, fw.etrack_id,
+				 fw.or_major, fw.or_build, fw.or_patch);
+		/* no option rom */
+		} else {
+			if (fw.etrack_id != 0X0000) {
+			snprintf(fw_version, fw_length,
+				 "%d.%d, 0x%08x",
+				 fw.eep_major, fw.eep_minor, fw.etrack_id);
+			} else {
+			snprintf(fw_version, fw_length,
+				 "%d.%d.%d",
+				 fw.eep_major, fw.eep_minor, fw.eep_build);
+			}
+		}
+		break;
+	}
+}
+
+static void
 eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
 	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
Signature · 1 line
2.7.4
#126 lore raw

PATCH v2 3/5 ixgbe: add firmware version get

In reply to Qiming Yang
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/net/ixgbe/ixgbe_ethdev.c +18 -0
index edc9b22..da9aa31 100644
@@ -193,6 +193,8 @@ static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 					     uint16_t queue_id,
 					     uint8_t stat_idx,
 					     uint8_t is_rx);
+static void ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
+				 int fw_length);
 static void ixgbe_dev_info_get(struct rte_eth_dev *dev,
 			       struct rte_eth_dev_info *dev_info);
 static const uint32_t *ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev);
@@ -537,6 +539,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
 	.xstats_reset         = ixgbe_dev_xstats_reset,
 	.xstats_get_names     = ixgbe_dev_xstats_get_names,
 	.queue_stats_mapping_set = ixgbe_dev_queue_stats_mapping_set,
+	.fw_version_get       = ixgbe_fw_version_get,
 	.dev_infos_get        = ixgbe_dev_info_get,
 	.dev_supported_ptypes_get = ixgbe_dev_supported_ptypes_get,
 	.mtu_set              = ixgbe_dev_mtu_set,
@@ -3029,6 +3032,21 @@ ixgbevf_dev_stats_reset(struct rte_eth_dev *dev)
 }
 
 static void
+ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, int fw_length)
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u16 eeprom_verh, eeprom_verl;
+	u32 etrack_id;
+
+	ixgbe_read_eeprom(hw, 0x2e, &eeprom_verh);
+	ixgbe_read_eeprom(hw, 0x2d, &eeprom_verl);
+
+	etrack_id = (eeprom_verh << 16) | eeprom_verl;
+	snprintf(fw_version, fw_length,
+		 "0x%08x", etrack_id);
+}
+
+static void
 ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
Signature · 1 line
2.7.4
#127 lore raw

PATCH v2 4/5 i40e: add firmware version get

In reply to Qiming Yang
---
 drivers/net/i40e/i40e_ethdev.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/net/i40e/i40e_ethdev.c +15 -0
index 67778ba..f79bc5e 100644
@@ -324,6 +324,8 @@ static int i40e_dev_queue_stats_mapping_set(struct rte_eth_dev *dev,
 					    uint16_t queue_id,
 					    uint8_t stat_idx,
 					    uint8_t is_rx);
+static void i40e_fw_version_get(struct rte_eth_dev *dev,
+				char *fw_version, int fw_length);
 static void i40e_dev_info_get(struct rte_eth_dev *dev,
 			      struct rte_eth_dev_info *dev_info);
 static int i40e_vlan_filter_set(struct rte_eth_dev *dev,
@@ -503,6 +505,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
 	.stats_reset                  = i40e_dev_stats_reset,
 	.xstats_reset                 = i40e_dev_stats_reset,
 	.queue_stats_mapping_set      = i40e_dev_queue_stats_mapping_set,
+	.fw_version_get               = i40e_fw_version_get,
 	.dev_infos_get                = i40e_dev_info_get,
 	.dev_supported_ptypes_get     = i40e_dev_supported_ptypes_get,
 	.vlan_filter_set              = i40e_vlan_filter_set,
@@ -2577,6 +2580,18 @@ i40e_dev_queue_stats_mapping_set(__rte_unused struct rte_eth_dev *dev,
 }
 
 static void
+i40e_fw_version_get(struct rte_eth_dev *dev, char *fw_version, int fw_length)
+{
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	snprintf(fw_version, fw_length,
+		 "%d.%d%d 0x%04x",
+		 ((hw->nvm.version >> 12) & 0xf),
+		 ((hw->nvm.version >> 4) & 0xff),
+		 (hw->nvm.version & 0xf), hw->nvm.eetrack);
+}
+
+static void
 i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
Signature · 1 line
2.7.4
#128 lore raw

PATCH v2 5/5 ethtool: dispaly bus info and firmware version

In reply to Qiming Yang

This patch enhances the ethtool-API to support to show the bus information and firmware version as same as kernel version ethtool displayed.

---
 examples/ethtool/ethtool-app/ethapp.c | 2 ++
 examples/ethtool/lib/rte_ethtool.c    | 3 +++
 2 files changed, 5 insertions(+)
examples/ethtool/ethtool-app/ethapp.c +2 -0
index 38e466c..9b77385 100644
@@ -184,6 +184,8 @@ pcmd_drvinfo_callback(__rte_unused void *ptr_params,
 		printf("Port %i driver: %s (ver: %s)\n",
 			id_port, info.driver, info.version
 		      );
+		printf("bus-info: %s\n", info.bus_info);
+		printf("firmware-version: %s\n", info.fw_version);
 	}
 }
 
examples/ethtool/lib/rte_ethtool.c +3 -0
index a1f91d4..542179c 100644
@@ -54,6 +54,9 @@ rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo)
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
+	rte_eth_dev_fwver_get(port_id, drvinfo->fw_version,
+			      sizeof(drvinfo->fw_version));
+
 	memset(&dev_info, 0, sizeof(dev_info));
 	rte_eth_dev_info_get(port_id, &dev_info);
 
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH 1/5] ethdev: add firmware version get

In reply to Qiming Yang

2016-11-17 17:42, Qiming Yang:

Quoted 4 lines

This patch added API for 'rte_eth_dev_fwver_get'

void rte_eth_dev_fwver_get(uint8_t port_id,
char *fw_version, int fw_length);

Copying some code here doesn't help really help. Could you describe what we can expect in this string? How can we compare this version number across different devices of the same driver?
How does it apply to FPGA devices?
What is the potential use?

[...]

Quoted 2 lines

/**
+ * Retrieve the firmware version of an Ethernet device.

We should stop talking about Ethernet device.
Networking device is more appropriate.
And in this case, "device" is enough.

Quoted 8 lines

+ *
+ * @param port_id
+ * The port identifier of the Ethernet device.
+ * @param fw_version
+ * A pointer the firmware version of an Ethernet device
+ * @param fw_length
+ * The size of the firmware version, which should be large enough to store
+ * the firmware version of the device.

How do we know that the length is too small?

Quoted 2 lines

+ */
+void rte_eth_dev_fwver_get(uint8_t port_id, char *fw_version, int fw_length);

Why not returning some errors?

You forgot to remove the deprecation notice in this patch.

PS: the series is broken as some patches are not numbered and this one is not the first one. Please use a cover-letter to introduce such series.

#4 lore raw

Re: [PATCH 1/5] ethdev: add firmware version get

In reply to Qiming Yang
Quoted 4 lines · Qiming Yang

This patch added API for 'rte_eth_dev_fwver_get'

void rte_eth_dev_fwver_get(uint8_t port_id,
char *fw_version, int fw_length);

Suggest description such as:

This patch adds ethdev API for fetching firmware version.

Also see Thomas's comments. Looks like some stale patches got picked up by 'git send-mail *.patch'..

..Remy

#129 lore raw

Re: [PATCH 5/5] ethtool: dispaly bus info and firmware version

In reply to Qiming Yang
Quoted 3 lines · Qiming Yang

This patch enhances the ethtool-API to support to show the bus information and firmware version as same as kernel version ethtool displayed.

Suggest rewording as:

This patch enhances the ethtool example to support to show bus information and firmware version, in the same way that the Linux kernel ethtool does.

#3 lore raw

Re: [PATCH 1/5] ethdev: add firmware version get

In reply to Thomas Monjalon

Hi, Thomas

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Thursday, November 17, 2016 9:37 PM
To: Yang, Qiming <[email protected]>
Cc: [email protected]; Horton, Remy <[email protected]>; Wu, Jingjing <[email protected]>; Chen, Jing D <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 1/5] ethdev: add firmware version get

2016-11-17 17:42, Qiming Yang:

Quoted 4 lines

This patch added API for 'rte_eth_dev_fwver_get'

void rte_eth_dev_fwver_get(uint8_t port_id, char *fw_version, int fw_length);

Copying some code here doesn't help really help.
Could you describe what we can expect in this string?
How can we compare this version number across different devices of the same driver? How does it apply to FPGA devices?
What is the potential use?

Qiming: I'll add more describes in the next version.

[...]

Quoted 2 lines

/**
+ * Retrieve the firmware version of an Ethernet device.

We should stop talking about Ethernet device.
Networking device is more appropriate.
And in this case, "device" is enough.

Qiming: Got it.

Quoted 8 lines

+ *
+ * @param port_id
+ * The port identifier of the Ethernet device.
+ * @param fw_version
+ * A pointer the firmware version of an Ethernet device
+ * @param fw_length
+ * The size of the firmware version, which should be large enough to store
+ * the firmware version of the device.

How do we know that the length is too small?

Qiming: The length is a number large enough to store the firmware version. Original I use a fixed number 20, but in order to be more flexible, I replace it into a variable.

Review

Quoted 3 lines

+ */

(quoted diff) +2 -0
+void rte_eth_dev_fwver_get(uint8_t port_id, char *fw_version, int 
+fw_length);

Why not returning some errors?

Qiming: It's a good advice.

You forgot to remove the deprecation notice in this patch.

PS: the series is broken as some patches are not numbered and this one is not the first one. Please use a cover-letter to introduce such series.

Qiming: It's my fault. Thank you for your reminder, I will pay attention next time.

#5 lore raw

Re: [PATCH 1/5] ethdev: add firmware version get

In reply to Remy Horton

Yes, that's my fault. I have set their statuses to 'suspended'

Qiming

-----Original Message-----
From: Horton, Remy
Sent: Friday, November 18, 2016 9:10 AM
To: Yang, Qiming <[email protected]>; [email protected]
Cc: Wu, Jingjing <[email protected]>; Chen, Jing D <[email protected]>
Subject: Re: [PATCH 1/5] ethdev: add firmware version get

Quoted 4 lines · Qiming Yang

This patch added API for 'rte_eth_dev_fwver_get'

void rte_eth_dev_fwver_get(uint8_t port_id, char *fw_version, int fw_length);

Suggest description such as:

This patch adds ethdev API for fetching firmware version.

Also see Thomas's comments. Looks like some stale patches got picked up by 'git send-mail *.patch'..

..Remy

#6 lore raw

v2 cover example/ethtool: add bus info and fw version get

In reply to Qiming Yang

Now, the example ethtool can only show the driver information. From customers' point of view, it should be better if we can have the same way that the Linux kernel ethtool does to show the bus-info and firmware-version.

These five patches add a new API to fetch firmware version and implement the display in example ethtool.

Qiming Yang (5):
ethdev: add firmware version get
net/e1000: add firmware version get
net/ixgbe: add firmware version get
net/i40e: add firmware version get
ethtool: dispaly bus info and firmware version

 drivers/net/e1000/igb_ethdev.c         | 46 ++++++++++++++++++++++++++++++++++
 drivers/net/i40e/i40e_ethdev.c         | 15 +++++++++++
 drivers/net/ixgbe/ixgbe_ethdev.c       | 18 +++++++++++++
 examples/ethtool/ethtool-app/ethapp.c  |  2 ++
 examples/ethtool/lib/rte_ethtool.c     |  3 +++
 lib/librte_ether/rte_ethdev.c          | 12 +++++++++
 lib/librte_ether/rte_ethdev.h          | 18 +++++++++++++
 lib/librte_ether/rte_ether_version.map |  7 ++++++
 8 files changed, 121 insertions(+)
Signature · 1 line
2.7.4
#7 lore raw

PATCH v2 1/5 ethdev: add firmware version get

This patch adds a new API 'rte_eth_dev_fwver_get' for fetching firmware version by a given device.

---
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(+)
lib/librte_ether/rte_ethdev.c +12 -0
index fde8112..793e50f 100644
@@ -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;
lib/librte_ether/rte_ethdev.h +18 -0
index 9678179..2c05df4 100644
@@ -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
lib/librte_ether/rte_ether_version.map +7 -0
index 72be66d..5e6387f 100644
@@ -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;
Signature · 1 line
2.7.4
#10 lore raw

PATCH v2 2/5 net/e1000: add firmware version get

In reply to Qiming Yang
---
 drivers/net/e1000/igb_ethdev.c | 46 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
drivers/net/e1000/igb_ethdev.c +46 -0
index 2fddf0c..c47f1c8 100644
@@ -120,6 +120,8 @@ static int eth_igb_xstats_get_names(struct rte_eth_dev *dev,
 				    unsigned limit);
 static void eth_igb_stats_reset(struct rte_eth_dev *dev);
 static void eth_igb_xstats_reset(struct rte_eth_dev *dev);
+static void eth_igb_fw_version_get(struct rte_eth_dev *dev,
+				   char *fw_version, int fw_length);
 static void eth_igb_infos_get(struct rte_eth_dev *dev,
 			      struct rte_eth_dev_info *dev_info);
 static const uint32_t *eth_igb_supported_ptypes_get(struct rte_eth_dev *dev);
@@ -388,6 +390,7 @@ static const struct eth_dev_ops eth_igb_ops = {
 	.xstats_get_names     = eth_igb_xstats_get_names,
 	.stats_reset          = eth_igb_stats_reset,
 	.xstats_reset         = eth_igb_xstats_reset,
+	.fw_version_get       = eth_igb_fw_version_get,
 	.dev_infos_get        = eth_igb_infos_get,
 	.dev_supported_ptypes_get = eth_igb_supported_ptypes_get,
 	.mtu_set              = eth_igb_mtu_set,
@@ -1977,6 +1980,49 @@ eth_igbvf_stats_reset(struct rte_eth_dev *dev)
 }
 
 static void
+eth_igb_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
+		       int fw_length)
+{
+	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct e1000_fw_version fw;
+
+	e1000_get_fw_version(hw, &fw);
+
+	switch (hw->mac.type) {
+	case e1000_i210:
+	case e1000_i211:
+		if (!(e1000_get_flash_presence_i210(hw))) {
+			snprintf(fw_version, fw_length,
+				 "%2d.%2d-%d",
+				 fw.invm_major, fw.invm_minor,
+				 fw.invm_img_type);
+			break;
+		}
+		/* fall through */
+	default:
+		/* if option rom is valid, display its version too*/
+		if (fw.or_valid) {
+			snprintf(fw_version, fw_length,
+				 "%d.%d, 0x%08x, %d.%d.%d",
+				 fw.eep_major, fw.eep_minor, fw.etrack_id,
+				 fw.or_major, fw.or_build, fw.or_patch);
+		/* no option rom */
+		} else {
+			if (fw.etrack_id != 0X0000) {
+			snprintf(fw_version, fw_length,
+				 "%d.%d, 0x%08x",
+				 fw.eep_major, fw.eep_minor, fw.etrack_id);
+			} else {
+			snprintf(fw_version, fw_length,
+				 "%d.%d.%d",
+				 fw.eep_major, fw.eep_minor, fw.eep_build);
+			}
+		}
+		break;
+	}
+}
+
+static void
 eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
 	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
Signature · 1 line
2.7.4
#12 lore raw

PATCH v2 3/5 net/ixgbe: add firmware version get

In reply to Qiming Yang
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/net/ixgbe/ixgbe_ethdev.c +18 -0
index edc9b22..da9aa31 100644
@@ -193,6 +193,8 @@ static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 					     uint16_t queue_id,
 					     uint8_t stat_idx,
 					     uint8_t is_rx);
+static void ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
+				 int fw_length);
 static void ixgbe_dev_info_get(struct rte_eth_dev *dev,
 			       struct rte_eth_dev_info *dev_info);
 static const uint32_t *ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev);
@@ -537,6 +539,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
 	.xstats_reset         = ixgbe_dev_xstats_reset,
 	.xstats_get_names     = ixgbe_dev_xstats_get_names,
 	.queue_stats_mapping_set = ixgbe_dev_queue_stats_mapping_set,
+	.fw_version_get       = ixgbe_fw_version_get,
 	.dev_infos_get        = ixgbe_dev_info_get,
 	.dev_supported_ptypes_get = ixgbe_dev_supported_ptypes_get,
 	.mtu_set              = ixgbe_dev_mtu_set,
@@ -3029,6 +3032,21 @@ ixgbevf_dev_stats_reset(struct rte_eth_dev *dev)
 }
 
 static void
+ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, int fw_length)
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u16 eeprom_verh, eeprom_verl;
+	u32 etrack_id;
+
+	ixgbe_read_eeprom(hw, 0x2e, &eeprom_verh);
+	ixgbe_read_eeprom(hw, 0x2d, &eeprom_verl);
+
+	etrack_id = (eeprom_verh << 16) | eeprom_verl;
+	snprintf(fw_version, fw_length,
+		 "0x%08x", etrack_id);
+}
+
+static void
 ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
Signature · 1 line
2.7.4
#13 lore raw

PATCH v2 4/5 net/i40e: add firmware version get

In reply to Qiming Yang
---
 drivers/net/i40e/i40e_ethdev.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/net/i40e/i40e_ethdev.c +15 -0
index 67778ba..f79bc5e 100644
@@ -324,6 +324,8 @@ static int i40e_dev_queue_stats_mapping_set(struct rte_eth_dev *dev,
 					    uint16_t queue_id,
 					    uint8_t stat_idx,
 					    uint8_t is_rx);
+static void i40e_fw_version_get(struct rte_eth_dev *dev,
+				char *fw_version, int fw_length);
 static void i40e_dev_info_get(struct rte_eth_dev *dev,
 			      struct rte_eth_dev_info *dev_info);
 static int i40e_vlan_filter_set(struct rte_eth_dev *dev,
@@ -503,6 +505,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
 	.stats_reset                  = i40e_dev_stats_reset,
 	.xstats_reset                 = i40e_dev_stats_reset,
 	.queue_stats_mapping_set      = i40e_dev_queue_stats_mapping_set,
+	.fw_version_get               = i40e_fw_version_get,
 	.dev_infos_get                = i40e_dev_info_get,
 	.dev_supported_ptypes_get     = i40e_dev_supported_ptypes_get,
 	.vlan_filter_set              = i40e_vlan_filter_set,
@@ -2577,6 +2580,18 @@ i40e_dev_queue_stats_mapping_set(__rte_unused struct rte_eth_dev *dev,
 }
 
 static void
+i40e_fw_version_get(struct rte_eth_dev *dev, char *fw_version, int fw_length)
+{
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	snprintf(fw_version, fw_length,
+		 "%d.%d%d 0x%04x",
+		 ((hw->nvm.version >> 12) & 0xf),
+		 ((hw->nvm.version >> 4) & 0xff),
+		 (hw->nvm.version & 0xf), hw->nvm.eetrack);
+}
+
+static void
 i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
Signature · 1 line
2.7.4
#14 lore raw

PATCH v2 5/5 ethtool: dispaly bus info and firmware version

In reply to Qiming Yang

This patch enhances the ethtool example to support to show bus information and firmware version, in the same way that the Linux kernel ethtool does.

---
v2 changes:
* modified the commit log
---

---
 examples/ethtool/ethtool-app/ethapp.c | 2 ++
 examples/ethtool/lib/rte_ethtool.c    | 3 +++
 2 files changed, 5 insertions(+)
examples/ethtool/ethtool-app/ethapp.c +2 -0
index 38e466c..9b77385 100644
@@ -184,6 +184,8 @@ pcmd_drvinfo_callback(__rte_unused void *ptr_params,
 		printf("Port %i driver: %s (ver: %s)\n",
 			id_port, info.driver, info.version
 		      );
+		printf("bus-info: %s\n", info.bus_info);
+		printf("firmware-version: %s\n", info.fw_version);
 	}
 }
 
examples/ethtool/lib/rte_ethtool.c +3 -0
index a1f91d4..542179c 100644
@@ -54,6 +54,9 @@ rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo)
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
+	rte_eth_dev_fwver_get(port_id, drvinfo->fw_version,
+			      sizeof(drvinfo->fw_version));
+
 	memset(&dev_info, 0, sizeof(dev_info));
 	rte_eth_dev_info_get(port_id, &dev_info);
 
Signature · 1 line
2.7.4
#11 lore raw

Re: [PATCH v2 2/5] net/e1000: add firmware version get

In reply to Qiming Yang

Hi Qiming,

Quoted 6 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Qiming Yang
Sent: Tuesday, December 6, 2016 3:16 PM
To: [email protected]
Cc: Yang, Qiming
Subject: [dpdk-dev] [PATCH v2 2/5] net/e1000: add firmware version get

Seems commit log is missing.

Acked-by on the v2 series
#22 lore raw

Re: [PATCH v2 0/5] example/ethtool: add bus info and fw version get

In reply to Qiming Yang

On 06/12/2016 15:16, Qiming Yang wrote:
[..]

Quoted 6 lines

Qiming Yang (5):
ethdev: add firmware version get
net/e1000: add firmware version get
net/ixgbe: add firmware version get
net/i40e: add firmware version get
ethtool: dispaly bus info and firmware version

s/dispaly/display

doc/guides/rel_notes/release_17_02.rst ought to be updated as well. Code itself looks ok though..

#8 lore raw

Re: [PATCH v2 1/5] ethdev: add firmware version get

In reply to Qiming Yang

Hi Qiming,

Quoted 4 lines · Qiming Yang

This patch adds a new API 'rte_eth_dev_fwver_get' for fetching firmware version by a given device.

<...>

lib/librte_ether/rte_ethdev.h struct eth_dev_ops { · line 1451

Quoted 5 lines
lib/librte_ether/rte_ethdev.h +1 -0
@@ -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.

Quoted 3 lines
lib/librte_ether/rte_ethdev.h +0 -0
 	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*/

<...>

#9 lore raw

Re: [PATCH v2 1/5] ethdev: add firmware version get

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 <[email protected]>; [email protected]
Cc: Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2 1/5] ethdev: add firmware version get

Hi Qiming,

Quoted 4 lines · Qiming Yang

This patch adds a new API 'rte_eth_dev_fwver_get' for fetching firmware version by a given device.

<...>

lib/librte_ether/rte_ethdev.h struct eth_dev_ops { · line 1451

Quoted 5 lines
lib/librte_ether/rte_ethdev.h +1 -0
@@ -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.

Quoted 3 lines
lib/librte_ether/rte_ethdev.h +0 -0
 	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*/

<...>

author Acked-by Remy Horton
#23 lore raw

Re: [PATCH v2 0/5] example/ethtool: add bus info and fw version get

In reply to Remy Horton

Hi, Remy
I'll add this update in v3 patch, thank you for your remind.
BTW, It looks like Yigit don't agree the implement we used, he think we'd better not add a new ops to get this info.

-----Original Message-----
From: Horton, Remy
Sent: Thursday, December 8, 2016 4:34 PM
To: Yang, Qiming <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 0/5] example/ethtool: add bus info and fw version get

On 06/12/2016 15:16, Qiming Yang wrote:
[..]

Quoted 6 lines

Qiming Yang (5):
ethdev: add firmware version get
net/e1000: add firmware version get
net/ixgbe: add firmware version get
net/i40e: add firmware version get
ethtool: dispaly bus info and firmware version

s/dispaly/display

doc/guides/rel_notes/release_17_02.rst ought to be updated as well. Code itself looks ok though..

#24 lore raw

Re: [PATCH v2 0/5] example/ethtool: add bus info and fw version get

In reply to Remy Horton

2016-12-08 16:34, Remy Horton:

Quoted 10 lines · Qiming Yang

[..]

Quoted 6 lines

Qiming Yang (5):
ethdev: add firmware version get
net/e1000: add firmware version get
net/ixgbe: add firmware version get
net/i40e: add firmware version get
ethtool: dispaly bus info and firmware version

Quoted 6 lines

s/dispaly/display

doc/guides/rel_notes/release_17_02.rst ought to be updated as well. Code itself looks ok though..

It must be a feature in the table (doc/guides/nics/features/). The deprecation notice must be removed also.

I think it is OK to add a new dev_ops and a new API function for firmware query. Generally speaking, it is a good thing to avoid putting all informations in the same structure (e.g. rte_eth_dev_info). However, there is a balance to find. Could we plan to add more info to this new query? Instead of
rte_eth_dev_fwver_get(uint8_t port_id, char *fw_version, int fw_length)
could it fill a struct?
rte_eth_dev_fw_info_get(uint8_t port_id, struct rte_eth_dev_fw_info *fw_info)

We already have
rte_eth_dev_get_reg_info(uint8_t port_id, struct rte_dev_reg_info *info)
with
uint32_t version; /**< Device version */

There are also these functions (a bit related):
rte_eth_dev_get_eeprom_length(uint8_t port_id) rte_eth_dev_get_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info)

#25 lore raw

Re: [PATCH v2 0/5] example/ethtool: add bus info and fw version get

Quoted 16 lines · Thomas Monjalon

2016-12-08 16:34, Remy Horton:

Quoted 15 lines · Qiming Yang

[..]

Quoted 6 lines

Qiming Yang (5):
ethdev: add firmware version get
net/e1000: add firmware version get
net/ixgbe: add firmware version get
net/i40e: add firmware version get
ethtool: dispaly bus info and firmware version

s/dispaly/display

doc/guides/rel_notes/release_17_02.rst ought to be updated as well. Code itself looks ok though..

Quoted 8 lines
Quoted 1 line

It must be a feature in the table (doc/guides/nics/features/). The deprecation notice must be removed also.

I think it is OK to add a new dev_ops and a new API function for firmware query. Generally speaking, it is a good thing to avoid putting all informations in the same structure (e.g. rte_eth_dev_info).

OK.

Quoted 4 lines

However, there
is a balance to find. Could we plan to add more info to this new query? Instead of
rte_eth_dev_fwver_get(uint8_t port_id, char *fw_version, int fw_length)

Here there is another problem, the content and the format of the string is not defined. In this patchset it is not same for different PMDs. This is OK for just printing the data, but not good for an API. How can the application know what to expect.

Quoted 2 lines

could it fill a struct?
rte_eth_dev_fw_info_get(uint8_t port_id, struct rte_eth_dev_fw_info *fw_info)

I believe this is better. But the problem we are having with this usage
is: ABI breakage.

Since this struct will be a public structure, in the future if we want to add a new field to the struct, it will break the ABI, and just this change will cause a new version for whole ethdev library!

When all required fields received via arguments, one by one, instead of struct, at least ABI versioning can be done on the API when new field added, and can be possible to escape from ABI breakage. But this will be ugly when number of arguments increased.

Or any other opinion on how to define API to reduce ABI breakage?

Quoted 10 lines

We already have
rte_eth_dev_get_reg_info(uint8_t port_id, struct rte_dev_reg_info *info)
with
uint32_t version; /**< Device version */

There are also these functions (a bit related):
rte_eth_dev_get_eeprom_length(uint8_t port_id) rte_eth_dev_get_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info)

#26 lore raw

Re: [PATCH v2 0/5] example/ethtool: add bus info and fw version get

2016-12-22 14:36, Ferruh Yigit:

Quoted 11 lines · Thomas Monjalon
Quoted 3 lines

I think it is OK to add a new dev_ops and a new API function for firmware query. Generally speaking, it is a good thing to avoid putting all informations in the same structure (e.g. rte_eth_dev_info).

OK.

Quoted 4 lines

However, there
is a balance to find. Could we plan to add more info to this new query? Instead of
rte_eth_dev_fwver_get(uint8_t port_id, char *fw_version, int fw_length)

[...]

Quoted 10 lines
Quoted 2 lines

could it fill a struct?
rte_eth_dev_fw_info_get(uint8_t port_id, struct rte_eth_dev_fw_info *fw_info)

I believe this is better. But the problem we are having with this usage
is: ABI breakage.

Since this struct will be a public structure, in the future if we want to add a new field to the struct, it will break the ABI, and just this change will cause a new version for whole ethdev library!

Quoted 6 lines

When all required fields received via arguments, one by one, instead of struct, at least ABI versioning can be done on the API when new field added, and can be possible to escape from ABI breakage. But this will be ugly when number of arguments increased.

Or any other opinion on how to define API to reduce ABI breakage?

You're right.
But I don't think we should have a function per data. Just because it would be ugly :)
I hope the ABI could become stable with time.

#27 lore raw

Re: [PATCH v2 0/5] example/ethtool: add bus info and fw version get

Quoted 28 lines · Thomas Monjalon

2016-12-22 14:36, Ferruh Yigit:

Quoted 11 lines · Thomas Monjalon
Quoted 3 lines

I think it is OK to add a new dev_ops and a new API function for firmware query. Generally speaking, it is a good thing to avoid putting all informations in the same structure (e.g. rte_eth_dev_info).

OK.

Quoted 4 lines

However, there
is a balance to find. Could we plan to add more info to this new query? Instead of
rte_eth_dev_fwver_get(uint8_t port_id, char *fw_version, int fw_length)

[...]

Quoted 15 lines
Quoted 2 lines

could it fill a struct?
rte_eth_dev_fw_info_get(uint8_t port_id, struct rte_eth_dev_fw_info *fw_info)

I believe this is better. But the problem we are having with this usage
is: ABI breakage.

Since this struct will be a public structure, in the future if we want to add a new field to the struct, it will break the ABI, and just this change will cause a new version for whole ethdev library!

When all required fields received via arguments, one by one, instead of struct, at least ABI versioning can be done on the API when new field added, and can be possible to escape from ABI breakage. But this will be ugly when number of arguments increased.

Quoted 5 lines
Quoted 1 line

Or any other opinion on how to define API to reduce ABI breakage?

You're right.
But I don't think we should have a function per data. Just because it would be ugly :)

I am no suggesting function per data, instead something like:

rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t maj, uint32_t min);

And in the future if we need etrack_id too, we can have both in versioned manner:

rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t maj, uint32_t min);

rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t maj, uint32_t min,

	uint32_t etrack_id);

So my concern was if the number of the arguments becomes too many by time.

Quoted 2 lines

I hope the ABI could become stable with time.

#28 lore raw

Re: [PATCH v2 0/5] example/ethtool: add bus info and fw version get

2016-12-22 15:05, Ferruh Yigit:

Quoted 39 lines · Thomas Monjalon
Quoted 28 lines

2016-12-22 14:36, Ferruh Yigit:

Quoted 11 lines · Thomas Monjalon
Quoted 3 lines

I think it is OK to add a new dev_ops and a new API function for firmware query. Generally speaking, it is a good thing to avoid putting all informations in the same structure (e.g. rte_eth_dev_info).

OK.

Quoted 4 lines

However, there
is a balance to find. Could we plan to add more info to this new query? Instead of
rte_eth_dev_fwver_get(uint8_t port_id, char *fw_version, int fw_length)

[...]

Quoted 15 lines
Quoted 2 lines

could it fill a struct?
rte_eth_dev_fw_info_get(uint8_t port_id, struct rte_eth_dev_fw_info *fw_info)

I believe this is better. But the problem we are having with this usage
is: ABI breakage.

Since this struct will be a public structure, in the future if we want to add a new field to the struct, it will break the ABI, and just this change will cause a new version for whole ethdev library!

When all required fields received via arguments, one by one, instead of struct, at least ABI versioning can be done on the API when new field added, and can be possible to escape from ABI breakage. But this will be ugly when number of arguments increased.

Quoted 5 lines
Quoted 1 line

Or any other opinion on how to define API to reduce ABI breakage?

You're right.
But I don't think we should have a function per data. Just because it would be ugly :)

I am no suggesting function per data, instead something like:

rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t maj, uint32_t min);

Quoted 7 lines

And in the future if we need etrack_id too, we can have both in versioned manner:

rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t maj, uint32_t min);

rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t maj, uint32_t min,

	uint32_t etrack_id);

Oh I see. So it can be versioned with compat macros.

Quoted 1 line

So my concern was if the number of the arguments becomes too many by time.

It looks to be a good proposal. We should not have a dozen of arguments.

#29 lore raw

Re: [PATCH v2 0/5] example/ethtool: add bus info and fw version get

Quoted 45 lines · Thomas Monjalon

2016-12-22 15:05, Ferruh Yigit:

Quoted 44 lines · Thomas Monjalon
Quoted 28 lines

2016-12-22 14:36, Ferruh Yigit:

Quoted 11 lines · Thomas Monjalon
Quoted 3 lines

I think it is OK to add a new dev_ops and a new API function for firmware query. Generally speaking, it is a good thing to avoid putting all informations in the same structure (e.g. rte_eth_dev_info).

OK.

Quoted 4 lines

However, there
is a balance to find. Could we plan to add more info to this new query? Instead of
rte_eth_dev_fwver_get(uint8_t port_id, char *fw_version, int fw_length)

[...]

Quoted 15 lines
Quoted 2 lines

could it fill a struct?
rte_eth_dev_fw_info_get(uint8_t port_id, struct rte_eth_dev_fw_info *fw_info)

I believe this is better. But the problem we are having with this usage
is: ABI breakage.

Since this struct will be a public structure, in the future if we want to add a new field to the struct, it will break the ABI, and just this change will cause a new version for whole ethdev library!

When all required fields received via arguments, one by one, instead of struct, at least ABI versioning can be done on the API when new field added, and can be possible to escape from ABI breakage. But this will be ugly when number of arguments increased.

Quoted 5 lines
Quoted 1 line

Or any other opinion on how to define API to reduce ABI breakage?

You're right.
But I don't think we should have a function per data. Just because it would be ugly :)

I am no suggesting function per data, instead something like:

rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t maj, uint32_t min);

And in the future if we need etrack_id too, we can have both in versioned manner:

rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t maj, uint32_t min);

Quoted 9 lines
Quoted 2 lines

rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t maj, uint32_t min,

	uint32_t etrack_id);

Oh I see. So it can be versioned with compat macros.

Quoted 1 line

So my concern was if the number of the arguments becomes too many by time.

It looks to be a good proposal. We should not have a dozen of arguments.

So, I suggest trying this approach in this API.

Overall, change request for the patch becomes:
1- Change API, is following arguments good enough to start with?:
- FW_major_number
- FW_minor_number
- FW_patch_number
- Etrack_id

If so, API becomes:
rte_eth_dev_fw_version_get(uint8_t port_id, uint32_t *fw_major,

	uint32_t *fw_minor, uint32_t *fw_patch, uint32_t *etrack_id);

! Note, I have renamed API to rte_eth_dev_fw_version_get() from rte_eth_dev_fw_info_get() mentioned above, to narrow the scope of API.

and dev_ops name keeps same: fw_version_get

2- Add new feature in feature table (doc/guides/nics/features/), first patch can add to the default one, and each driver patch implements this feature should update its feature table.
Feature name can be "FW version"

3- Remove deprecation notice in the first patch.

Thanks,
ferruh

#15 lore raw

Re: [PATCH v2 5/5] ethtool: dispaly bus info and firmware version

In reply to Qiming Yang
Quoted 19 lines · Qiming Yang

This patch enhances the ethtool example to support to show bus information and firmware version, in the same way that the Linux kernel ethtool does.

---
v2 changes:
* modified the commit log
---

---
 examples/ethtool/ethtool-app/ethapp.c | 2 ++
 examples/ethtool/lib/rte_ethtool.c    | 3 +++
 2 files changed, 5 insertions(+)
examples/ethtool/ethtool-app/ethapp.c +0 -0
index 38e466c..9b77385 100644

examples/ethtool/ethtool-app/ethapp.c pcmd_drvinfo_callback(__rte_unused void *ptr_params, · line 187

Quoted 4 lines
examples/ethtool/ethtool-app/ethapp.c +1 -0
@@ -184,6 +184,8 @@ pcmd_drvinfo_callback(__rte_unused void *ptr_params,
 		printf("Port %i driver: %s (ver: %s)\n",
 			id_port, info.driver, info.version
 		      );
+		printf("bus-info: %s\n", info.bus_info);

Can you please remove above line from this patch, if you want can be a separate patch.

Thanks,
ferruh

Quoted 5 lines
examples/ethtool/ethtool-app/ethapp.c +1 -0
+		printf("firmware-version: %s\n", info.fw_version);
 	}
 }
 
examples/ethtool/lib/rte_ethtool.c +0 -0

<...>

#31 lore raw

v3 cover new API 'rte_eth_dev_fw_info_get'

In reply to Qiming Yang

These four patches added a new function ``rte_eth_dev_fwver_get()`` to fetch firmware related information by a given device. Information include major firmware version, minor firmware version, patch number and etrack id.

Qiming Yang (4):
ethdev: add firmware information get
net/e1000: add firmware version get
net/ixgbe: add firmware version get
net/i40e: add firmware version get

 doc/guides/nics/features/default.ini   |  1 +
 doc/guides/nics/features/i40e.ini      |  1 +
 doc/guides/nics/features/igb.ini       |  1 +
 doc/guides/nics/features/ixgbe.ini     |  1 +
 doc/guides/rel_notes/release_17_02.rst |  4 ++++
 drivers/net/e1000/igb_ethdev.c         | 43 ++++++++++++++++++++++++++++++++++
 drivers/net/i40e/i40e_ethdev.c         | 15 ++++++++++++
 drivers/net/ixgbe/ixgbe_ethdev.c       | 17 ++++++++++++++
 lib/librte_ether/rte_ethdev.c          | 14 +++++++++++
 lib/librte_ether/rte_ethdev.h          | 23 ++++++++++++++++++
 lib/librte_ether/rte_ether_version.map |  1 +
 11 files changed, 121 insertions(+)
Signature · 1 line
2.7.4
#32 lore raw

PATCH v3 1/4 ethdev: add firmware information get

This patch adds a new API 'rte_eth_dev_fw_info_get' for fetching firmware related information by a given device.

---
v2 changes:
* modified some comment statements.
v3 changes:
* change API, use rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t *fw_major, uint32_t *fw_minor, uint32_t *fw_patch, uint32_t *etrack_id) instead of rte_eth_dev_fwver_get(uint8_t port_id, char *fw_version, int fw_length).
Add statusment in /doc/guides/nics/features/default.ini and release_17_02.rst.
---

---
 doc/guides/nics/features/default.ini   |  1 +
 doc/guides/rel_notes/release_17_02.rst |  4 ++++
 lib/librte_ether/rte_ethdev.c          | 14 ++++++++++++++
 lib/librte_ether/rte_ethdev.h          | 23 +++++++++++++++++++++++
 lib/librte_ether/rte_ether_version.map |  1 +
 5 files changed, 43 insertions(+)
doc/guides/nics/features/default.ini +1 -0
index f1bf9bf..8237ee4 100644
@@ -66,3 +66,4 @@ x86-64               =
 Usage doc            =
 Design doc           =
 Perf doc             =
+FW version           =
doc/guides/rel_notes/release_17_02.rst +4 -0
index 180af82..f6dc6c0 100644
@@ -52,6 +52,10 @@ New Features
   See the :ref:`Generic flow API <Generic_flow_API>` documentation for more
   information.
 
+* **Added firmware information get API.**
+ Added a new function ``rte_eth_dev_fw_info_get()`` to fetch firmware related
+ information by a given device. Information include major firmware version,
+ minor firmware version, patch number and etrack id.
 
 Resolved Issues
 ---------------
lib/librte_ether/rte_ethdev.c +14 -0
index 280f0db..f399f09 100644
@@ -1586,6 +1586,20 @@ rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id,
 }
 
 void
+rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t *fw_major, uint32_t *fw_minor,
+	uint32_t *fw_patch, uint32_t *etrack_id)
+{
+	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_major, fw_minor,
+					fw_patch, etrack_id);
+}
+
+void
 rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)
 {
 	struct rte_eth_dev *dev;
lib/librte_ether/rte_ethdev.h +23 -0
index fb51754..829f652 100644
@@ -1150,6 +1150,11 @@ 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,
+		uint32_t *fw_major, uint32_t *fw_minor,
+		uint32_t *fw_patch, uint32_t *etrack_id);
+/**< @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);
 
@@ -1457,6 +1462,7 @@ struct eth_dev_ops {
 	eth_txq_info_get_t         txq_info_get; /**< retrieve TX queue information. */
 	eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
 	/**< Get packet types supported and identified by device. */
+	eth_fw_version_get_t       fw_version_get; /**< Get firmware version. */
 
 	vlan_filter_set_t          vlan_filter_set; /**< Filter VLAN Setup. */
 	vlan_tpid_set_t            vlan_tpid_set; /**< Outer/Inner VLAN TPID Setup. */
@@ -2395,6 +2401,23 @@ 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_major
+ *   A array pointer to store the major firmware version of a device.
+ * @param fw_minor
+ *   A array pointer to store the minor firmware version of a device.
+ * @param fw_patch
+ *   A array pointer to store the firmware patch number of a device.
+ * @param etrack_id
+ *   A array pointer to store the nvm version of a device.
+ */
+void rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t *fw_major,
+	uint32_t *fw_minor, uint32_t *fw_patch, uint32_t *etrack_id);
+
+/**
  * Retrieve the supported packet types of an Ethernet device.
  *
  * When a packet type is announced as supported, it *must* be recognized by
lib/librte_ether/rte_ether_version.map +1 -0
index a021781..a89bfaa 100644
@@ -156,5 +156,6 @@ DPDK_17.02 {
 	rte_flow_flush;
 	rte_flow_query;
 	rte_flow_validate;
+	rte_eth_dev_fw_info_get;
 
 } DPDK_16.11;
Signature · 1 line
2.7.4
#43 lore raw

PATCH v3 2/4 net/e1000: add firmware version get

In reply to Qiming Yang

This patch adds a new function eth_igb_fw_version_get.

---
v3 changes:
* use eth_igb_fw_version_get(struct rte_eth_dev *dev, u32 *fw_major, u32 *fw_minor, u32 *fw_minor, u32 *fw_patch, u32 *etrack_id) instead of eth_igb_fw_version_get(struct rte_eth_dev *dev, char *fw_version, int fw_length). Add statusment in /doc/guides/nics/features/igb.ini.
---

---
 doc/guides/nics/features/igb.ini |  1 +
 drivers/net/e1000/igb_ethdev.c   | 43 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)
doc/guides/nics/features/igb.ini +1 -0
index 9fafe72..ffd87ba 100644
@@ -39,6 +39,7 @@ EEPROM dump          = Y
 Registers dump       = Y
 BSD nic_uio          = Y
 Linux UIO            = Y
+FW version           = Y
 Linux VFIO           = Y
 x86-32               = Y
 x86-64               = Y
drivers/net/e1000/igb_ethdev.c +43 -0

61 lines not on this page · raw message

Signature · 1 line
2.7.4
#47 lore raw

PATCH v3 3/4 net/ixgbe: add firmware version get

In reply to Qiming Yang

This patch add a new function ixgbe_fw_version_get.

---
v3 changes:
* use ixgbe_fw_version_get(struct rte_eth_dev *dev, __rte_unused u32 *fw_major, __rte_unused u32 *fw_minor, __rte_unused u32 *fw_patch, u32 *etrack_id) instead of ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, int fw_length). Add statusment in /doc/guides/nics/features/ixgbe.ini.
---

---
 doc/guides/nics/features/ixgbe.ini |  1 +
 drivers/net/ixgbe/ixgbe_ethdev.c   | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)
doc/guides/nics/features/ixgbe.ini +1 -0
index 4a5667f..e4a0830 100644
@@ -52,3 +52,4 @@ Linux VFIO           = Y
 ARMv8                = Y
 x86-32               = Y
 x86-64               = Y
+FW_version           = Y
drivers/net/ixgbe/ixgbe_ethdev.c +17 -0
index ec2edad..e2234c0 100644
@@ -193,6 +193,9 @@ static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 					     uint16_t queue_id,
 					     uint8_t stat_idx,
 					     uint8_t is_rx);
+static void ixgbe_fw_version_get(struct rte_eth_dev *dev,
+	__rte_unused u32 *fw_major, __rte_unused u32 *fw_minor,
+	__rte_unused u32 *fw_patch, u32 *etrack_id);
 static void ixgbe_dev_info_get(struct rte_eth_dev *dev,
 			       struct rte_eth_dev_info *dev_info);
 static const uint32_t *ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev);
@@ -538,6 +541,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
 	.xstats_reset         = ixgbe_dev_xstats_reset,
 	.xstats_get_names     = ixgbe_dev_xstats_get_names,
 	.queue_stats_mapping_set = ixgbe_dev_queue_stats_mapping_set,
+	.fw_version_get       = ixgbe_fw_version_get,
 	.dev_infos_get        = ixgbe_dev_info_get,
 	.dev_supported_ptypes_get = ixgbe_dev_supported_ptypes_get,
 	.mtu_set              = ixgbe_dev_mtu_set,
@@ -3029,6 +3033,19 @@ ixgbevf_dev_stats_reset(struct rte_eth_dev *dev)
 }
 
 static void
+ixgbe_fw_version_get(struct rte_eth_dev *dev, __rte_unused u32 *fw_major,
+	__rte_unused u32 *fw_minor, __rte_unused u32 *fw_patch, u32 *etrack_id)
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u16 eeprom_verh, eeprom_verl;
+
+	ixgbe_read_eeprom(hw, 0x2e, &eeprom_verh);
+	ixgbe_read_eeprom(hw, 0x2d, &eeprom_verl);
+
+	*etrack_id = (eeprom_verh << 16) | eeprom_verl;
+}
+
+static void
 ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
 	struct rte_pci_device *pci_dev = IXGBE_DEV_TO_PCI(dev);
Signature · 1 line
2.7.4
#53 lore raw

PATCH v3 4/4 net/i40e: add firmware version get

In reply to Qiming Yang

This patch add a new function i40e_fw_version_get.

---
v3 changes:
* use i40e_fw_version_get(struct rte_eth_dev *dev, u32 *fw_major, u32 *fw_minor, __rte_unused u32 *fw_patch, u32 *etrack_id) instead of i40e_fw_version_get(struct rte_eth_dev *dev, char *fw_version, int fw_length). Add statusment in /doc/guides/nics/features/i40e.ini.
---

---
 doc/guides/nics/features/i40e.ini |  1 +
 drivers/net/i40e/i40e_ethdev.c    | 15 +++++++++++++++
 2 files changed, 16 insertions(+)
doc/guides/nics/features/i40e.ini +1 -0
index 0d143bc..6dab9f7 100644
@@ -46,3 +46,4 @@ Linux VFIO           = Y
 x86-32               = Y
 x86-64               = Y
 ARMv8                = Y
+FW version           = Y
drivers/net/i40e/i40e_ethdev.c +15 -0
index 8f63044..1dbbcc4 100644
@@ -324,6 +324,8 @@ static int i40e_dev_queue_stats_mapping_set(struct rte_eth_dev *dev,
 					    uint16_t queue_id,
 					    uint8_t stat_idx,
 					    uint8_t is_rx);
+static void i40e_fw_version_get(struct rte_eth_dev *dev, u32 *fw_major,
+	u32 *fw_minor, __rte_unused u32 *fw_patch, u32 *etrack_id);
 static void i40e_dev_info_get(struct rte_eth_dev *dev,
 			      struct rte_eth_dev_info *dev_info);
 static int i40e_vlan_filter_set(struct rte_eth_dev *dev,
@@ -503,6 +505,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
 	.stats_reset                  = i40e_dev_stats_reset,
 	.xstats_reset                 = i40e_dev_stats_reset,
 	.queue_stats_mapping_set      = i40e_dev_queue_stats_mapping_set,
+	.fw_version_get               = i40e_fw_version_get,
 	.dev_infos_get                = i40e_dev_info_get,
 	.dev_supported_ptypes_get     = i40e_dev_supported_ptypes_get,
 	.vlan_filter_set              = i40e_vlan_filter_set,
@@ -2590,6 +2593,18 @@ i40e_dev_queue_stats_mapping_set(__rte_unused struct rte_eth_dev *dev,
 }
 
 static void
+i40e_fw_version_get(struct rte_eth_dev *dev, u32 *fw_major, u32 *fw_minor,
+		__rte_unused u32 *fw_patch, u32 *etrack_id)
+{
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	*fw_major = (hw->nvm.version >> 12) & 0xf;
+	*fw_minor = ((hw->nvm.version >> 4) & 0xff) * 10 +
+			(hw->nvm.version & 0xf);
+	*etrack_id = hw->nvm.eetrack;
+}
+
+static void
 i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
Signature · 1 line
2.7.4
#16 lore raw

PATCH v3 1/1 ethtool: dispaly bus info and firmware version

In reply to Qiming Yang

This patch enhances the ethtool example to support to show bus information and firmware version, in the same way that the Linux kernel ethtool does.

---
v3 changes:
* split this patch from the patch set of rte_eth_dev_fw_info_get use the new version function.
---

---
 examples/ethtool/ethtool-app/ethapp.c |  2 ++
 examples/ethtool/lib/rte_ethtool.c    | 11 +++++++++++
 2 files changed, 13 insertions(+)
examples/ethtool/ethtool-app/ethapp.c +2 -0
index 6aeaa06..192d941 100644
@@ -185,6 +185,8 @@ pcmd_drvinfo_callback(__rte_unused void *ptr_params,
 		printf("Port %i driver: %s (ver: %s)\n",
 			id_port, info.driver, info.version
 		      );
+		printf("bus-info: %s\n", info.bus_info);
+		printf("firmware-version: %s\n", info.fw_version);
 	}
 }
 
examples/ethtool/lib/rte_ethtool.c +11 -0
index 6f0ce84..f62f1d3 100644
@@ -54,6 +54,11 @@ rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo)
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
+	uint32_t fw_major = 0;
+	uint32_t fw_minor = 0;
+	uint32_t etrack = 0;
+
+	rte_eth_dev_fw_info_get(port_id, &fw_major, &fw_minor, NULL, &etrack);
 	memset(&dev_info, 0, sizeof(dev_info));
 	rte_eth_dev_info_get(port_id, &dev_info);
 
@@ -61,6 +66,12 @@ rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo)
 		dev_info.driver_name);
 	snprintf(drvinfo->version, sizeof(drvinfo->version), "%s",
 		rte_version());
+	if (strcmp(drvinfo->driver, "net_ixgbe") == 0)
+		snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
+			 "0x%08x", etrack);
+	else
+		snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
+			 "%d.%02d 0x%08x", fw_major, fw_minor, etrack);
 	if (dev_info.pci_dev)
 		snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),
 			"%04x:%02x:%02x.%x",
Signature · 1 line
2.7.4
#33 lore raw

Re: [PATCH v3 1/4] ethdev: add firmware information get

In reply to Qiming Yang

2016-12-27 20:30, Qiming Yang:

Quoted 14 lines

/**
+ * Retrieve the firmware version of a device.
+ *
+ * @param port_id
+ * The port identifier of the device.
+ * @param fw_major
+ * A array pointer to store the major firmware version of a device.
+ * @param fw_minor
+ * A array pointer to store the minor firmware version of a device.
+ * @param fw_patch
+ * A array pointer to store the firmware patch number of a device.
+ * @param etrack_id
+ * A array pointer to store the nvm version of a device.
+ */

lib/librte_ether/rte_ethdev.h void rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr); · line 2418

Quoted 2 lines
lib/librte_ether/rte_ethdev.h +2 -0
+void rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t *fw_major,
+	uint32_t *fw_minor, uint32_t *fw_patch, uint32_t *etrack_id);

I have a reserve about the naming etrack_id. Please could you point to a document explaining this ID? Is it known outside of Intel?

#36 lore raw

Re: [PATCH v3 1/4] ethdev: add firmware information get

In reply to a message not in the archive

Hi, Ferruh
Please see the question below. In my opinion, etrack_id is just a name used to define the ID of one NIC. In kernel version ethtool, it will print this ID in the line of firmware verison.
I know what is etrack_id mean, but I really don't know why this named etrack_id.
Can you explain this question?

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Tuesday, January 3, 2017 4:40 PM
To: Yang, Qiming <[email protected]>
Subject: Re: [PATCH v3 1/4] ethdev: add firmware information get

Please reply below the question and on the mailing list. You'll have to explain why this name etrack_id.

2017-01-03 03:28, Yang, Qiming:

Quoted 34 lines

Hi, Thomas
etrack_id is not a terminology, it's decided by me. Which is store the unique number of the firmware.
firmware-version: 5.04 0x800024ca
800024ca is the etrack_id of this NIC.

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Monday, January 2, 2017 11:39 PM
To: Yang, Qiming <[email protected]>
Cc: [email protected]; Horton, Remy <[email protected]>; Yigit, Ferruh <[email protected]>
Subject: Re: [PATCH v3 1/4] ethdev: add firmware information get

2016-12-27 20:30, Qiming Yang:

Quoted 14 lines

/**
+ * Retrieve the firmware version of a device.
+ *
+ * @param port_id
+ * The port identifier of the device.
+ * @param fw_major
+ * A array pointer to store the major firmware version of a device.
+ * @param fw_minor
+ * A array pointer to store the minor firmware version of a device.
+ * @param fw_patch
+ * A array pointer to store the firmware patch number of a device.
+ * @param etrack_id
+ * A array pointer to store the nvm version of a device.
+ */

lib/librte_ether/rte_ethdev.h void rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr); · line 2418

Quoted 2 lines
lib/librte_ether/rte_ethdev.h +2 -0
+void rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t *fw_major,
+	uint32_t *fw_minor, uint32_t *fw_patch, uint32_t *etrack_id);

I have a reserve about the naming etrack_id. Please could you point to a document explaining this ID? Is it known outside of Intel?

#37 lore raw

Re: [PATCH v3 1/4] ethdev: add firmware information get

Quoted 4 lines · Qiming

Hi, Ferruh
Please see the question below. In my opinion, etrack_id is just a name used to define the ID of one NIC. In kernel version ethtool, it will print this ID in the line of firmware verison.
I know what is etrack_id mean, but I really don't know why this named etrack_id.

Hi Qiming,

I suggested the API based on fields you already used in your patch.

So, this API is to get FW version, is etrack_id something that defines (part of) firmware version?

Thanks,
ferruh

Quoted 48 lines

Can you explain this question?

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Tuesday, January 3, 2017 4:40 PM
To: Yang, Qiming <[email protected]>
Subject: Re: [PATCH v3 1/4] ethdev: add firmware information get

Please reply below the question and on the mailing list. You'll have to explain why this name etrack_id.

2017-01-03 03:28, Yang, Qiming:

Quoted 34 lines

Hi, Thomas
etrack_id is not a terminology, it's decided by me. Which is store the unique number of the firmware.
firmware-version: 5.04 0x800024ca
800024ca is the etrack_id of this NIC.

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Monday, January 2, 2017 11:39 PM
To: Yang, Qiming <[email protected]>
Cc: [email protected]; Horton, Remy <[email protected]>; Yigit, Ferruh <[email protected]>
Subject: Re: [PATCH v3 1/4] ethdev: add firmware information get

2016-12-27 20:30, Qiming Yang:

Quoted 14 lines

/**
+ * Retrieve the firmware version of a device.
+ *
+ * @param port_id
+ * The port identifier of the device.
+ * @param fw_major
+ * A array pointer to store the major firmware version of a device.
+ * @param fw_minor
+ * A array pointer to store the minor firmware version of a device.
+ * @param fw_patch
+ * A array pointer to store the firmware patch number of a device.
+ * @param etrack_id
+ * A array pointer to store the nvm version of a device.
+ */

lib/librte_ether/rte_ethdev.h void rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr); · line 2418

Quoted 2 lines
lib/librte_ether/rte_ethdev.h +2 -0
+void rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t *fw_major,
+	uint32_t *fw_minor, uint32_t *fw_patch, uint32_t *etrack_id);

I have a reserve about the naming etrack_id. Please could you point to a document explaining this ID? Is it known outside of Intel?

#42 lore raw

Re: [PATCH v3 1/4] ethdev: add firmware information get

In reply to Qiming Yang
Quoted 16 lines · Qiming Yang

This patch adds a new API 'rte_eth_dev_fw_info_get' for fetching firmware related information by a given device.

---
v2 changes:
* modified some comment statements.
v3 changes:
* change API, use rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t *fw_major, uint32_t *fw_minor, uint32_t *fw_patch, uint32_t *etrack_id) instead of rte_eth_dev_fwver_get(uint8_t port_id, char *fw_version, int fw_length).
Add statusment in /doc/guides/nics/features/default.ini and release_17_02.rst.
---

Quoted 7 lines
---
 doc/guides/nics/features/default.ini   |  1 +
 doc/guides/rel_notes/release_17_02.rst |  4 ++++
 lib/librte_ether/rte_ethdev.c          | 14 ++++++++++++++
 lib/librte_ether/rte_ethdev.h          | 23 +++++++++++++++++++++++
 lib/librte_ether/rte_ether_version.map |  1 +
 5 files changed, 43 insertions(+)

This patch also should remove deprecation notice.
Item 3 of the requested changes.

doc/guides/nics/features/default.ini x86-64 = · line 69

Quoted 10 lines
doc/guides/nics/features/default.ini +1 -0
index f1bf9bf..8237ee4 100644
@@ -66,3 +66,4 @@ x86-64               =
 Usage doc            =
 Design doc           =
 Perf doc             =
+FW version           =

I am not sure about this location, I think it can be before "EEPROM dump", what do you think?

Quoted 20 lines
doc/guides/rel_notes/release_17_02.rst +4 -0
index 180af82..f6dc6c0 100644
@@ -52,6 +52,10 @@ New Features
   See the :ref:`Generic flow API <Generic_flow_API>` documentation for more
   information.
 
+* **Added firmware information get API.**
+ Added a new function ``rte_eth_dev_fw_info_get()`` to fetch firmware related
+ information by a given device. Information include major firmware version,
+ minor firmware version, patch number and etrack id.
 
 Resolved Issues
 ---------------
lib/librte_ether/rte_ethdev.c +0 -0
index 280f0db..f399f09 100644

lib/librte_ether/rte_ethdev.c rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id, · line 1590

Quoted 5 lines
lib/librte_ether/rte_ethdev.c +2 -0
@@ -1586,6 +1586,20 @@ rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id,
 }
 
 void
+rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t *fw_major, uint32_t *fw_minor,
+	uint32_t *fw_patch, uint32_t *etrack_id)

I am for rte_eth_dev_fw_version_get(), to limit the scope of the API. And API name and eth_dev_ops name should match..

lib/librte_ether/rte_ethdev.c rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id, · line 1596

Quoted 6 lines
lib/librte_ether/rte_ethdev.c +6 -0
+{
+	struct rte_eth_dev *dev;
+
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
+	dev = &rte_eth_devices[port_id];
+

What do you think setting all arguments to zero here?

Quoted 5 lines
lib/librte_ether/rte_ethdev.c +5 -0
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->fw_version_get);
+	(*dev->dev_ops->fw_version_get)(dev, fw_major, fw_minor,
+					fw_patch, etrack_id);
+}
+

<...>

lib/librte_ether/rte_ether_version.map DPDK_17.02 { · line 159

Quoted 7 lines
lib/librte_ether/rte_ether_version.map +1 -0
@@ -156,5 +156,6 @@ DPDK_17.02 {
 	rte_flow_flush;
 	rte_flow_query;
 	rte_flow_validate;
+	rte_eth_dev_fw_info_get;

Please add this alphabetically sorted.

Quoted 3 lines
lib/librte_ether/rte_ether_version.map +0 -0
 } DPDK_16.11;
 
#44 lore raw

Re: [PATCH v3 2/4] net/e1000: add firmware version get

In reply to Qiming Yang
Quoted 20 lines · Qiming Yang

This patch adds a new function eth_igb_fw_version_get.

---
v3 changes:
* use eth_igb_fw_version_get(struct rte_eth_dev *dev, u32 *fw_major, u32 *fw_minor, u32 *fw_minor, u32 *fw_patch, u32 *etrack_id) instead of eth_igb_fw_version_get(struct rte_eth_dev *dev, char *fw_version, int fw_length). Add statusment in /doc/guides/nics/features/igb.ini.
---

---
 doc/guides/nics/features/igb.ini |  1 +
 drivers/net/e1000/igb_ethdev.c   | 43 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)
doc/guides/nics/features/igb.ini +0 -0
index 9fafe72..ffd87ba 100644

doc/guides/nics/features/igb.ini EEPROM dump = Y · line 42

Quoted 4 lines
doc/guides/nics/features/igb.ini +1 -0
@@ -39,6 +39,7 @@ EEPROM dump          = Y
 Registers dump       = Y
 BSD nic_uio          = Y
 Linux UIO            = Y
+FW version           = Y

Please keep same location with default.ini file. Why you are putting this just into middle of the uio and vfio?

drivers/net/e1000/igb_ethdev.c static int eth_igb_xstats_get_names(struct rte_eth_dev *dev, · line 124

Quoted 13 lines
doc/guides/nics/features/igb.ini +0 -0
 Linux VFIO           = Y
 x86-32               = Y
 x86-64               = Y
drivers/net/e1000/igb_ethdev.c +2 -0
index 4a15447..25344b7 100644
@@ -120,6 +120,8 @@ static int eth_igb_xstats_get_names(struct rte_eth_dev *dev,
 				    unsigned limit);
 static void eth_igb_stats_reset(struct rte_eth_dev *dev);
 static void eth_igb_xstats_reset(struct rte_eth_dev *dev);
+static void eth_igb_fw_version_get(struct rte_eth_dev *dev, u32 *fw_major,
+		u32 *fw_minor, u32 *fw_patch, u32 *etrack_id);

I think you can use a struct as parameter here. But beware, that struct should NOT be a public struct.

Quoted 14 lines
drivers/net/e1000/igb_ethdev.c +1 -0
 static void eth_igb_infos_get(struct rte_eth_dev *dev,
 			      struct rte_eth_dev_info *dev_info);
 static const uint32_t *eth_igb_supported_ptypes_get(struct rte_eth_dev *dev);
@@ -389,6 +391,7 @@ static const struct eth_dev_ops eth_igb_ops = {
 	.xstats_get_names     = eth_igb_xstats_get_names,
 	.stats_reset          = eth_igb_stats_reset,
 	.xstats_reset         = eth_igb_xstats_reset,
+	.fw_version_get       = eth_igb_fw_version_get,
 	.dev_infos_get        = eth_igb_infos_get,
 	.dev_supported_ptypes_get = eth_igb_supported_ptypes_get,
 	.mtu_set              = eth_igb_mtu_set,
@@ -1981,6 +1984,46 @@ eth_igbvf_stats_reset(struct rte_eth_dev *dev)
 }
 

<...>

#48 lore raw

Re: [PATCH v3 3/4] net/ixgbe: add firmware version get

In reply to Qiming Yang
Quoted 3 lines · Qiming Yang

This patch add a new function ixgbe_fw_version_get.

<...>

drivers/net/ixgbe/ixgbe_ethdev.c ixgbevf_dev_stats_reset(struct rte_eth_dev *dev) · line 3037

Quoted 4 lines

static void

drivers/net/ixgbe/ixgbe_ethdev.c +2 -0
+ixgbe_fw_version_get(struct rte_eth_dev *dev, __rte_unused u32 *fw_major,
+	__rte_unused u32 *fw_minor, __rte_unused u32 *fw_patch, u32 *etrack_id)

This API at least provide major and minor fw versions I think. Isn't there any kind of FW version information for ixgbe? Just providing etrack_id is not looking good.

Quoted 15 lines
drivers/net/ixgbe/ixgbe_ethdev.c +11 -0
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u16 eeprom_verh, eeprom_verl;
+
+	ixgbe_read_eeprom(hw, 0x2e, &eeprom_verh);
+	ixgbe_read_eeprom(hw, 0x2d, &eeprom_verl);
+
+	*etrack_id = (eeprom_verh << 16) | eeprom_verl;
+}
+
+static void
 ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
 	struct rte_pci_device *pci_dev = IXGBE_DEV_TO_PCI(dev);
#49 lore raw

Re: [PATCH v3 3/4] net/ixgbe: add firmware version get

You can see the kernel version ethtool, use command 'ethtool -i <ixgbe NIC name>'
driver: ixgbe
version: 4.2.1-k
firmware-version: 0x61bf0001

Ixgbe's FW version do not have the major and minor number, and the original purpose of this function is get FW version, so I think it's enough.

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, January 3, 2017 11:04 PM
To: Yang, Qiming <[email protected]>; [email protected]; [email protected]
Cc: Horton, Remy <[email protected]>
Subject: Re: [PATCH v3 3/4] net/ixgbe: add firmware version get

Quoted 3 lines · Qiming Yang

This patch add a new function ixgbe_fw_version_get.

<...>

Review

Quoted 5 lines

static void

(quoted diff) +3 -0
+ixgbe_fw_version_get(struct rte_eth_dev *dev, __rte_unused u32 *fw_major,
+	__rte_unused u32 *fw_minor, __rte_unused u32 *fw_patch, u32 
+*etrack_id)

This API at least provide major and minor fw versions I think. Isn't there any kind of FW version information for ixgbe? Just providing etrack_id is not looking good.

Quoted 14 lines
drivers/net/ixgbe/ixgbe_ethdev.c +10 -0
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u16 eeprom_verh, eeprom_verl;
+
+	ixgbe_read_eeprom(hw, 0x2e, &eeprom_verh);
+	ixgbe_read_eeprom(hw, 0x2d, &eeprom_verl);
+
+	*etrack_id = (eeprom_verh << 16) | eeprom_verl; }
+
+static void
 ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info 

*dev_info) {
struct rte_pci_device *pci_dev = IXGBE_DEV_TO_PCI(dev);

#45 lore raw

Re: [PATCH v3 2/4] net/e1000: add firmware version get

In reply to Ferruh Yigit

See the reply below.

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, January 3, 2017 11:03 PM
To: Yang, Qiming <[email protected]>; [email protected]; [email protected]
Cc: Horton, Remy <[email protected]>
Subject: Re: [PATCH v3 2/4] net/e1000: add firmware version get

Quoted 21 lines · Qiming Yang

This patch adds a new function eth_igb_fw_version_get.

---
v3 changes:
* use eth_igb_fw_version_get(struct rte_eth_dev *dev, u32 *fw_major, u32 *fw_minor, u32 *fw_minor, u32 *fw_patch, u32 *etrack_id) instead of eth_igb_fw_version_get(struct rte_eth_dev *dev, char *fw_version, int fw_length). Add statusment in /doc/guides/nics/features/igb.ini.
---

---
 doc/guides/nics/features/igb.ini |  1 +
 drivers/net/e1000/igb_ethdev.c   | 43 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)
doc/guides/nics/features/igb.ini +0 -0
index 9fafe72..ffd87ba 100644

doc/guides/nics/features/igb.ini EEPROM dump = Y · line 42

Quoted 4 lines
doc/guides/nics/features/igb.ini +1 -0
@@ -39,6 +39,7 @@ EEPROM dump          = Y
 Registers dump       = Y
 BSD nic_uio          = Y
 Linux UIO            = Y
+FW version           = Y

Please keep same location with default.ini file. Why you are putting this just into middle of the uio and vfio?
Qiming: It's a clerical error, I want to add this line at the end of this file.

drivers/net/e1000/igb_ethdev.c static int eth_igb_xstats_get_names(struct rte_eth_dev *dev, · line 124

Quoted 13 lines
doc/guides/nics/features/igb.ini +0 -0
 Linux VFIO           = Y
 x86-32               = Y
 x86-64               = Y
(quoted diff) +0 -0

b/drivers/net/e1000/igb_ethdev.c index 4a15447..25344b7 100644

drivers/net/e1000/igb_ethdev.c +2 -0
@@ -120,6 +120,8 @@ static int eth_igb_xstats_get_names(struct rte_eth_dev *dev,
 				    unsigned limit);
 static void eth_igb_stats_reset(struct rte_eth_dev *dev);  static 
 void eth_igb_xstats_reset(struct rte_eth_dev *dev);
+static void eth_igb_fw_version_get(struct rte_eth_dev *dev, u32 *fw_major,
+		u32 *fw_minor, u32 *fw_patch, u32 *etrack_id);

I think you can use a struct as parameter here. But beware, that struct should NOT be a public struct.
Qiming: I think only add a private struct for igb is unnecessary. Keep the arguments consistent with rte_eth_dev_fw_info_get is better. What do you think?

Quoted 14 lines
drivers/net/e1000/igb_ethdev.c +2 -0
 static void eth_igb_infos_get(struct rte_eth_dev *dev,
 			      struct rte_eth_dev_info *dev_info);  static const uint32_t 
 *eth_igb_supported_ptypes_get(struct rte_eth_dev *dev); @@ -389,6 
+391,7 @@ static const struct eth_dev_ops eth_igb_ops = {
 	.xstats_get_names     = eth_igb_xstats_get_names,
 	.stats_reset          = eth_igb_stats_reset,
 	.xstats_reset         = eth_igb_xstats_reset,
+	.fw_version_get       = eth_igb_fw_version_get,
 	.dev_infos_get        = eth_igb_infos_get,
 	.dev_supported_ptypes_get = eth_igb_supported_ptypes_get,
 	.mtu_set              = eth_igb_mtu_set,
@@ -1981,6 +1984,46 @@ eth_igbvf_stats_reset(struct rte_eth_dev *dev)  
 }
 

<...>

#38 lore raw

Re: [PATCH v3 1/4] ethdev: add firmware information get

In reply to Ferruh Yigit

Yes, in my opinion it is. And I use this name already exist in the share code from ND team.

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, January 3, 2017 10:49 PM
To: Yang, Qiming <[email protected]>
Cc: [email protected]; Horton, Remy <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [PATCH v3 1/4] ethdev: add firmware information get

Quoted 4 lines · Qiming

Hi, Ferruh
Please see the question below. In my opinion, etrack_id is just a name used to define the ID of one NIC. In kernel version ethtool, it will print this ID in the line of firmware verison.
I know what is etrack_id mean, but I really don't know why this named etrack_id.

Hi Qiming,

I suggested the API based on fields you already used in your patch.

So, this API is to get FW version, is etrack_id something that defines (part of) firmware version?

Thanks,
ferruh

Quoted 49 lines

Can you explain this question?

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Tuesday, January 3, 2017 4:40 PM
To: Yang, Qiming <[email protected]>
Subject: Re: [PATCH v3 1/4] ethdev: add firmware information get

Please reply below the question and on the mailing list. You'll have to explain why this name etrack_id.

2017-01-03 03:28, Yang, Qiming:

Quoted 35 lines

Hi, Thomas
etrack_id is not a terminology, it's decided by me. Which is store the unique number of the firmware.
firmware-version: 5.04 0x800024ca
800024ca is the etrack_id of this NIC.

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Monday, January 2, 2017 11:39 PM
To: Yang, Qiming <[email protected]>
Cc: [email protected]; Horton, Remy <[email protected]>; Yigit, Ferruh <[email protected]>
Subject: Re: [PATCH v3 1/4] ethdev: add firmware information get

2016-12-27 20:30, Qiming Yang:

Quoted 14 lines

/**
+ * Retrieve the firmware version of a device.
+ *
+ * @param port_id
+ * The port identifier of the device.
+ * @param fw_major
+ * A array pointer to store the major firmware version of a device.
+ * @param fw_minor
+ * A array pointer to store the minor firmware version of a device.
+ * @param fw_patch
+ * A array pointer to store the firmware patch number of a device.
+ * @param etrack_id
+ * A array pointer to store the nvm version of a device.
+ */

lib/librte_ether/rte_ethdev.h void rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr); · line 2418

Quoted 2 lines
lib/librte_ether/rte_ethdev.h +2 -0
+void rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t *fw_major,
+	uint32_t *fw_minor, uint32_t *fw_patch, uint32_t *etrack_id);

I have a reserve about the naming etrack_id. Please could you point to a document explaining this ID? Is it known outside of Intel?

#39 lore raw

Re: [PATCH v3 1/4] ethdev: add firmware information get

Quoted 30 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Yang, Qiming
Sent: Wednesday, January 4, 2017 11:33 AM
To: Yigit, Ferruh <[email protected]>
Cc: [email protected]; Horton, Remy <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 1/4] ethdev: add firmware information get

Yes, in my opinion it is. And I use this name already exist in the share code from ND team.

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, January 3, 2017 10:49 PM
To: Yang, Qiming <[email protected]>
Cc: [email protected]; Horton, Remy <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [PATCH v3 1/4] ethdev: add firmware information get

Quoted 2 lines · Qiming

Hi, Ferruh
Please see the question below. In my opinion, etrack_id is just a name used to

define the ID of one NIC.

Quoted 2 lines

In kernel version ethtool, it will print this ID in the line of firmware verison. I know what is etrack_id mean, but I really don't know why this named

etrack_id.

Hi Qiming,

Quoted 9 lines

I suggested the API based on fields you already used in your patch.

So, this API is to get FW version, is etrack_id something that defines (part of) firmware version?

Thanks,
ferruh

Different HW may have different version format, so it is better to use string.

And I prefer the API definition in your v2 patch like

rte_eth_dev_fwver_get(uint8_t port_id, char *fw_version, int fw_length);

Thanks
Jingjing

#17 lore raw

Re: [PATCH v3] ethtool: dispaly bus info and firmware version

In reply to Qiming Yang
Quoted 30 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Qiming Yang
Sent: Tuesday, December 27, 2016 9:06 PM
To: [email protected]; [email protected]
Cc: Horton, Remy <[email protected]>; Yigit, Ferruh <[email protected]>; Yang, Qiming <[email protected]>
Subject: [dpdk-dev] [PATCH v3] ethtool: dispaly bus info and firmware version

This patch enhances the ethtool example to support to show bus information and firmware version, in the same way that the Linux kernel ethtool does.

---
v3 changes:
* split this patch from the patch set of rte_eth_dev_fw_info_get use the new version function.
---

---
 examples/ethtool/ethtool-app/ethapp.c |  2 ++
 examples/ethtool/lib/rte_ethtool.c    | 11 +++++++++++
 2 files changed, 13 insertions(+)
examples/ethtool/ethtool-app/ethapp.c +0 -0
index 6aeaa06..192d941 100644

examples/ethtool/ethtool-app/ethapp.c pcmd_drvinfo_callback(__rte_unused void *ptr_params, · line 188

Quoted 4 lines
examples/ethtool/ethtool-app/ethapp.c +1 -0
@@ -185,6 +185,8 @@ pcmd_drvinfo_callback(__rte_unused void *ptr_params,
 		printf("Port %i driver: %s (ver: %s)\n",
 			id_port, info.driver, info.version
 		      );
+		printf("bus-info: %s\n", info.bus_info);

This patch has dependence on your get_fw_version patch set.

I think you may misunderstand Ferruh's comments,
I think what he said was ask you to remove bus-info print (above line) from that patch set, but keep firmware version print.

Thanks
Jingjing

#40 lore raw

Re: [PATCH v3 1/4] ethdev: add firmware information get

In reply to Wu, Jingjing
Quoted 39 lines · Jingjing
Quoted 30 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Yang, Qiming
Sent: Wednesday, January 4, 2017 11:33 AM
To: Yigit, Ferruh <[email protected]>
Cc: [email protected]; Horton, Remy <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 1/4] ethdev: add firmware information get

Yes, in my opinion it is. And I use this name already exist in the share code from ND team.

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, January 3, 2017 10:49 PM
To: Yang, Qiming <[email protected]>
Cc: [email protected]; Horton, Remy <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [PATCH v3 1/4] ethdev: add firmware information get

Quoted 2 lines · Qiming

Hi, Ferruh
Please see the question below. In my opinion, etrack_id is just a name used to

define the ID of one NIC.

Quoted 2 lines

In kernel version ethtool, it will print this ID in the line of firmware verison. I know what is etrack_id mean, but I really don't know why this named

etrack_id.

Hi Qiming,

Quoted 9 lines

I suggested the API based on fields you already used in your patch.

So, this API is to get FW version, is etrack_id something that defines (part of) firmware version?

Thanks,
ferruh

Quoted 5 lines

Different HW may have different version format, so it is better to use string.

And I prefer the API definition in your v2 patch like

rte_eth_dev_fwver_get(uint8_t port_id, char *fw_version, int fw_length);

The problem with this is the format and content of the string is not defined, as you said different HW has different version format. This is no problem if you will only print the string.

But this is a public API, if an application wants to call this API and do something useful according the FW version information, it will need to parse the string, and it will not able to parse it because format of the string is not defined. By making API fill some defined variables, app won't need to parse them, and API output won't be HW dependent.

Thanks,
ferruh

Quoted 4 lines

Thanks
Jingjing

#46 lore raw

Re: [PATCH v3 2/4] net/e1000: add firmware version get

In reply to Yang, Qiming
Quoted 48 lines · Qiming

See the reply below.

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, January 3, 2017 11:03 PM
To: Yang, Qiming <[email protected]>; [email protected]; [email protected]
Cc: Horton, Remy <[email protected]>
Subject: Re: [PATCH v3 2/4] net/e1000: add firmware version get

Quoted 21 lines · Qiming Yang

This patch adds a new function eth_igb_fw_version_get.

---
v3 changes:
* use eth_igb_fw_version_get(struct rte_eth_dev *dev, u32 *fw_major, u32 *fw_minor, u32 *fw_minor, u32 *fw_patch, u32 *etrack_id) instead of eth_igb_fw_version_get(struct rte_eth_dev *dev, char *fw_version, int fw_length). Add statusment in /doc/guides/nics/features/igb.ini.
---

---
 doc/guides/nics/features/igb.ini |  1 +
 drivers/net/e1000/igb_ethdev.c   | 43 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)
doc/guides/nics/features/igb.ini +0 -0
index 9fafe72..ffd87ba 100644

doc/guides/nics/features/igb.ini EEPROM dump = Y · line 42

Quoted 4 lines
doc/guides/nics/features/igb.ini +1 -0
@@ -39,6 +39,7 @@ EEPROM dump          = Y
 Registers dump       = Y
 BSD nic_uio          = Y
 Linux UIO            = Y
+FW version           = Y

Please keep same location with default.ini file. Why you are putting this just into middle of the uio and vfio?
Qiming: It's a clerical error, I want to add this line at the end of this file.

Quoted 9 lines
doc/guides/nics/features/igb.ini +0 -0
 Linux VFIO           = Y
 x86-32               = Y
 x86-64               = Y
(quoted diff) +0 -0

b/drivers/net/e1000/igb_ethdev.c index 4a15447..25344b7 100644

drivers/net/e1000/igb_ethdev.c +0 -0
@@ -120,6 +120,8 @@ static int eth_igb_xstats_get_names(struct rte_eth_dev *dev,
 				    unsigned limit);
Quoted 8 lines

drivers/net/e1000/igb_ethdev.c static int eth_igb_xstats_get_names(struct rte_eth_dev *dev, · line 124

Quoted 4 lines
drivers/net/e1000/igb_ethdev.c +2 -0
 static void eth_igb_stats_reset(struct rte_eth_dev *dev);  static 
 void eth_igb_xstats_reset(struct rte_eth_dev *dev);
+static void eth_igb_fw_version_get(struct rte_eth_dev *dev, u32 *fw_major,
+		u32 *fw_minor, u32 *fw_patch, u32 *etrack_id);

I think you can use a struct as parameter here. But beware, that struct should NOT be a public struct.
Qiming: I think only add a private struct for igb is unnecessary. Keep the arguments consistent with rte_eth_dev_fw_info_get is better. What do you think?

Both are OK.
Normally, I believe using struct is better. But we are not using struct in public API because of the ABI compatibility issues. Here it is internal usage, there is no ABI breakage concern, so it may be possible to use a struct.
But if you prefer to keep the arguments same here with public API, that is fine.

Quoted 18 lines
Quoted 15 lines
drivers/net/e1000/igb_ethdev.c +2 -0
 static void eth_igb_infos_get(struct rte_eth_dev *dev,
 			      struct rte_eth_dev_info *dev_info);  static const uint32_t 
 *eth_igb_supported_ptypes_get(struct rte_eth_dev *dev); @@ -389,6 
+391,7 @@ static const struct eth_dev_ops eth_igb_ops = {
 	.xstats_get_names     = eth_igb_xstats_get_names,
 	.stats_reset          = eth_igb_stats_reset,
 	.xstats_reset         = eth_igb_xstats_reset,
+	.fw_version_get       = eth_igb_fw_version_get,
 	.dev_infos_get        = eth_igb_infos_get,
 	.dev_supported_ptypes_get = eth_igb_supported_ptypes_get,
 	.mtu_set              = eth_igb_mtu_set,
@@ -1981,6 +1984,46 @@ eth_igbvf_stats_reset(struct rte_eth_dev *dev)  
 }
 

<...>

#50 lore raw

Re: [PATCH v3 3/4] net/ixgbe: add firmware version get

In reply to Yang, Qiming
Quoted 6 lines · Qiming

You can see the kernel version ethtool, use command 'ethtool -i <ixgbe NIC name>'
driver: ixgbe
version: 4.2.1-k
firmware-version: 0x61bf0001

Ixgbe's FW version do not have the major and minor number, and the original purpose of this function is get FW version, so I think it's enough.

Is etrack_id a unique value that defines the FW version on its own?

And is above definition true for all NICs (or at least Intel ones)? Because I can see i40e is using 4 bit value for etrack_id ?

Quoted 38 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, January 3, 2017 11:04 PM
To: Yang, Qiming <[email protected]>; [email protected]; [email protected]
Cc: Horton, Remy <[email protected]>
Subject: Re: [PATCH v3 3/4] net/ixgbe: add firmware version get

Quoted 3 lines · Qiming Yang

This patch add a new function ixgbe_fw_version_get.

<...>

Review

Quoted 5 lines

static void

(quoted diff) +3 -0
+ixgbe_fw_version_get(struct rte_eth_dev *dev, __rte_unused u32 *fw_major,
+	__rte_unused u32 *fw_minor, __rte_unused u32 *fw_patch, u32 
+*etrack_id)

This API at least provide major and minor fw versions I think. Isn't there any kind of FW version information for ixgbe? Just providing etrack_id is not looking good.

Quoted 14 lines
drivers/net/ixgbe/ixgbe_ethdev.c +10 -0
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u16 eeprom_verh, eeprom_verl;
+
+	ixgbe_read_eeprom(hw, 0x2e, &eeprom_verh);
+	ixgbe_read_eeprom(hw, 0x2d, &eeprom_verl);
+
+	*etrack_id = (eeprom_verh << 16) | eeprom_verl; }
+
+static void
 ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info 

*dev_info) {
struct rte_pci_device *pci_dev = IXGBE_DEV_TO_PCI(dev);

#51 lore raw

Re: [PATCH v3 3/4] net/ixgbe: add firmware version get

Yes, etrack_id is an unique value. But not all NICs have this value. I didn't find any value about fw version in fm10k.
I40e is 8 bit too.
firmware-version: 5.04 0x800024ca

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, January 4, 2017 5:06 PM
To: Yang, Qiming <[email protected]>; [email protected]; [email protected]
Cc: Horton, Remy <[email protected]>
Subject: Re: [PATCH v3 3/4] net/ixgbe: add firmware version get

Quoted 6 lines · Qiming

You can see the kernel version ethtool, use command 'ethtool -i <ixgbe NIC name>'
driver: ixgbe
version: 4.2.1-k
firmware-version: 0x61bf0001

Ixgbe's FW version do not have the major and minor number, and the original purpose of this function is get FW version, so I think it's enough.

Is etrack_id a unique value that defines the FW version on its own?

And is above definition true for all NICs (or at least Intel ones)? Because I can see i40e is using 4 bit value for etrack_id ?

Quoted 38 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, January 3, 2017 11:04 PM
To: Yang, Qiming <[email protected]>; [email protected]; [email protected]
Cc: Horton, Remy <[email protected]>
Subject: Re: [PATCH v3 3/4] net/ixgbe: add firmware version get

Quoted 3 lines · Qiming Yang

This patch add a new function ixgbe_fw_version_get.

<...>

Review

Quoted 5 lines

static void

(quoted diff) +3 -0
+ixgbe_fw_version_get(struct rte_eth_dev *dev, __rte_unused u32 *fw_major,
+	__rte_unused u32 *fw_minor, __rte_unused u32 *fw_patch, u32 
+*etrack_id)

This API at least provide major and minor fw versions I think. Isn't there any kind of FW version information for ixgbe? Just providing etrack_id is not looking good.

Quoted 14 lines
drivers/net/ixgbe/ixgbe_ethdev.c +10 -0
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u16 eeprom_verh, eeprom_verl;
+
+	ixgbe_read_eeprom(hw, 0x2e, &eeprom_verh);
+	ixgbe_read_eeprom(hw, 0x2d, &eeprom_verl);
+
+	*etrack_id = (eeprom_verh << 16) | eeprom_verl; }
+
+static void
 ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info 

*dev_info) {
struct rte_pci_device *pci_dev = IXGBE_DEV_TO_PCI(dev);

#52 lore raw

Re: [PATCH v3 3/4] net/ixgbe: add firmware version get

Quoted 2 lines · Qiming

Yes, etrack_id is an unique value. But not all NICs have this value. I didn't find any value about fw version in fm10k.

Yes, you are right, following is from i40e datasheet:

"
The EEPROM Manager tool writes a unique 32-bit eTrack_ID number in two sequential NVM words.
The eTrack_ID is written when EEPROM Manager tool creates an image on the Intel network. The eTrack_ID DB tracks NVM images back to a specific SCM build
"

So it is unique, and can be used to identify FW version. And yes it can be enough on its own without having major minor FW version fields.

Quoted 2 lines

I40e is 8 bit too.
firmware-version: 5.04 0x800024ca

Right, I read it wrong, i40e also has 32bits etrack-id.

Thanks,
ferruh

#54 lore raw

v4 cover new API 'rte_eth_dev_fw_version_get'

In reply to Qiming Yang

Now, the example ethtool can only show the driver information. From customers' point of view, it should be better if we can have the same way that the Linux kernel ethtool does to show firmware-version.

These five patches added a new function ``rte_eth_dev_fw_version_get()`` to fetch firmware version related information and implement the display in example ethtool.

Qiming Yang (5):
ethdev: add firmware version get
net/e1000: add firmware version get
net/ixgbe: add firmware version get
net/i40e: add firmware version get
ethtool: dispaly firmware version

 doc/guides/nics/features/default.ini   |  1 +
 doc/guides/nics/features/i40e.ini      |  1 +
 doc/guides/nics/features/igb.ini       |  1 +
 doc/guides/nics/features/ixgbe.ini     |  1 +
 doc/guides/rel_notes/deprecation.rst   |  4 ----
 doc/guides/rel_notes/release_17_02.rst |  3 +++
 drivers/net/e1000/igb_ethdev.c         | 43 ++++++++++++++++++++++++++++++++++
 drivers/net/i40e/i40e_ethdev.c         | 15 ++++++++++++
 drivers/net/ixgbe/ixgbe_ethdev.c       | 17 ++++++++++++++
 examples/ethtool/ethtool-app/ethapp.c  |  1 +
 examples/ethtool/lib/rte_ethtool.c     | 12 ++++++++++
 lib/librte_ether/rte_ethdev.c          | 14 +++++++++++
 lib/librte_ether/rte_ethdev.h          | 23 ++++++++++++++++++
 lib/librte_ether/rte_ether_version.map |  1 +
 14 files changed, 133 insertions(+), 4 deletions(-)
Signature · 1 line
2.7.4
#55 lore raw

PATCH v4 1/5 ethdev: add firmware version get

This patch adds a new API 'rte_eth_dev_fw_version_get' for fetching firmware version related information by a given device.

---
v2 changes:
* modified some comment statements.
v3 changes:
* change API, use rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t *fw_major, uint32_t *fw_minor, uint32_t *fw_patch, uint32_t *etrack_id) instead of rte_eth_dev_fwver_get(uint8_t port_id, char *fw_version, int fw_length).
Add statusment in /doc/guides/nics/features/default.ini and release_17_02.rst.
v4 changes:
* remove deprecation notice, rename API as rte_eth_dev_fw_version_get
---

---
 doc/guides/nics/features/default.ini   |  1 +
 doc/guides/rel_notes/deprecation.rst   |  4 ----
 doc/guides/rel_notes/release_17_02.rst |  3 +++
 lib/librte_ether/rte_ethdev.c          | 14 ++++++++++++++
 lib/librte_ether/rte_ethdev.h          | 23 +++++++++++++++++++++++
 lib/librte_ether/rte_ether_version.map |  1 +
 6 files changed, 42 insertions(+), 4 deletions(-)
doc/guides/nics/features/default.ini +1 -0
index f1bf9bf..ae40d57 100644
@@ -50,6 +50,7 @@ Timesync             =
 Basic stats          =
 Extended stats       =
 Stats per queue      =
+FW version           =
 EEPROM dump          =
 Registers dump       =
 Multiprocess aware   =
doc/guides/rel_notes/deprecation.rst +0 -4
index 1438c77..291e03d 100644
@@ -30,10 +30,6 @@ Deprecation Notices
   ``nb_seg_max`` and ``nb_mtu_seg_max`` providing information about number of
   segments limit to be transmitted by device for TSO/non-TSO packets.
 
-* 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.
-
 * ethdev: an API change is planned for 17.02 for the function
   ``_rte_eth_dev_callback_process``. In 17.02 the function will return an ``int``
   instead of ``void`` and a fourth parameter ``void *ret_param`` will be added.
doc/guides/rel_notes/release_17_02.rst +3 -0
index 180af82..d6958d4 100644
@@ -52,6 +52,9 @@ New Features
   See the :ref:`Generic flow API <Generic_flow_API>` documentation for more
   information.
 
+* **Added firmware version get API.**
+ Added a new function ``rte_eth_dev_fw_version_get()`` to fetch firmware version
+ related information by a given device.
 
 Resolved Issues
 ---------------
lib/librte_ether/rte_ethdev.c +14 -0
index 280f0db..a4b20b5 100644
@@ -1586,6 +1586,20 @@ rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id,
 }
 
 void
+rte_eth_dev_fw_version_get(uint8_t port_id, uint32_t *fw_major,
+		uint32_t *fw_minor, uint32_t *fw_patch, uint32_t *etrack_id)
+{
+	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_major, fw_minor,
+					fw_patch, etrack_id);
+}
+
+void
 rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)
 {
 	struct rte_eth_dev *dev;
lib/librte_ether/rte_ethdev.h +23 -0
index fb51754..9c7efa1 100644
@@ -1150,6 +1150,11 @@ 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,
+		uint32_t *fw_major, uint32_t *fw_minor,
+		uint32_t *fw_patch, uint32_t *etrack_id);
+/**< @internal Get firmware version 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);
 
@@ -1457,6 +1462,7 @@ struct eth_dev_ops {
 	eth_txq_info_get_t         txq_info_get; /**< retrieve TX queue information. */
 	eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
 	/**< Get packet types supported and identified by device. */
+	eth_fw_version_get_t       fw_version_get; /**< Get firmware version. */
 
 	vlan_filter_set_t          vlan_filter_set; /**< Filter VLAN Setup. */
 	vlan_tpid_set_t            vlan_tpid_set; /**< Outer/Inner VLAN TPID Setup. */
@@ -2395,6 +2401,23 @@ 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_major
+ *   A pointer to store the major firmware version of a device.
+ * @param fw_minor
+ *   A pointer to store the minor firmware version of a device.
+ * @param fw_patch
+ *   A pointer to store the firmware patch number of a device.
+ * @param etrack_id
+ *   A pointer to store the nvm version of a device.
+ */
+void rte_eth_dev_fw_version_get(uint8_t port_id, uint32_t *fw_major,
+	uint32_t *fw_minor, uint32_t *fw_patch, uint32_t *etrack_id);
+
+/**
  * Retrieve the supported packet types of an Ethernet device.
  *
  * When a packet type is announced as supported, it *must* be recognized by
lib/librte_ether/rte_ether_version.map +1 -0
index a021781..0cf94ed 100644
@@ -151,6 +151,7 @@ DPDK_17.02 {
 	global:
 
 	_rte_eth_dev_reset;
+	rte_eth_dev_fw_version_get;
 	rte_flow_create;
 	rte_flow_destroy;
 	rte_flow_flush;
Signature · 1 line
2.7.4
#58 lore raw

PATCH v4 2/5 net/e1000: add firmware version get

In reply to Qiming Yang

This patch adds a new function eth_igb_fw_version_get.

---
v3 changes:
* use eth_igb_fw_version_get(struct rte_eth_dev *dev, u32 *fw_major, u32 *fw_minor, u32 *fw_minor, u32 *fw_patch, u32 *etrack_id) instead of eth_igb_fw_version_get(struct rte_eth_dev *dev, char *fw_version, int fw_length). Add statusment in /doc/guides/nics/features/igb.ini.
---

---
 doc/guides/nics/features/igb.ini |  1 +
 drivers/net/e1000/igb_ethdev.c   | 43 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)
doc/guides/nics/features/igb.ini +1 -0
index 9fafe72..26ae008 100644
@@ -35,6 +35,7 @@ Packet type parsing  = Y
 Timesync             = Y
 Basic stats          = Y
 Extended stats       = Y
+FW version           = Y
 EEPROM dump          = Y
 Registers dump       = Y
 BSD nic_uio          = Y
drivers/net/e1000/igb_ethdev.c +43 -0

61 lines not on this page · raw message

Signature · 1 line
2.7.4
#61 lore raw

PATCH v4 3/5 net/ixgbe: add firmware version get

In reply to Qiming Yang

This patch add a new function ixgbe_fw_version_get.

---
v3 changes:
* use ixgbe_fw_version_get(struct rte_eth_dev *dev, __rte_unused u32 *fw_major, __rte_unused u32 *fw_minor, __rte_unused u32 *fw_patch, u32 *etrack_id) instead of ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, int fw_length). Add statusment in /doc/guides/nics/features/ixgbe.ini.
---

---
 doc/guides/nics/features/ixgbe.ini |  1 +
 drivers/net/ixgbe/ixgbe_ethdev.c   | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)
doc/guides/nics/features/ixgbe.ini +1 -0
index 4a5667f..b46287a 100644
@@ -43,6 +43,7 @@ Timesync             = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
+FW_version           = Y
 EEPROM dump          = Y
 Registers dump       = Y
 Multiprocess aware   = Y
drivers/net/ixgbe/ixgbe_ethdev.c +17 -0
index ec2edad..e2234c0 100644
@@ -193,6 +193,9 @@ static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 					     uint16_t queue_id,
 					     uint8_t stat_idx,
 					     uint8_t is_rx);
+static void ixgbe_fw_version_get(struct rte_eth_dev *dev,
+	__rte_unused u32 *fw_major, __rte_unused u32 *fw_minor,
+	__rte_unused u32 *fw_patch, u32 *etrack_id);
 static void ixgbe_dev_info_get(struct rte_eth_dev *dev,
 			       struct rte_eth_dev_info *dev_info);
 static const uint32_t *ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev);
@@ -538,6 +541,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
 	.xstats_reset         = ixgbe_dev_xstats_reset,
 	.xstats_get_names     = ixgbe_dev_xstats_get_names,
 	.queue_stats_mapping_set = ixgbe_dev_queue_stats_mapping_set,
+	.fw_version_get       = ixgbe_fw_version_get,
 	.dev_infos_get        = ixgbe_dev_info_get,
 	.dev_supported_ptypes_get = ixgbe_dev_supported_ptypes_get,
 	.mtu_set              = ixgbe_dev_mtu_set,
@@ -3029,6 +3033,19 @@ ixgbevf_dev_stats_reset(struct rte_eth_dev *dev)
 }
 
 static void
+ixgbe_fw_version_get(struct rte_eth_dev *dev, __rte_unused u32 *fw_major,
+	__rte_unused u32 *fw_minor, __rte_unused u32 *fw_patch, u32 *etrack_id)
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u16 eeprom_verh, eeprom_verl;
+
+	ixgbe_read_eeprom(hw, 0x2e, &eeprom_verh);
+	ixgbe_read_eeprom(hw, 0x2d, &eeprom_verl);
+
+	*etrack_id = (eeprom_verh << 16) | eeprom_verl;
+}
+
+static void
 ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
 	struct rte_pci_device *pci_dev = IXGBE_DEV_TO_PCI(dev);
Signature · 1 line
2.7.4
#62 lore raw

PATCH v4 4/5 net/i40e: add firmware version get

In reply to Qiming Yang

This patch add a new function i40e_fw_version_get.

---
v3 changes:
* use i40e_fw_version_get(struct rte_eth_dev *dev, u32 *fw_major, u32 *fw_minor, __rte_unused u32 *fw_patch, u32 *etrack_id) instead of i40e_fw_version_get(struct rte_eth_dev *dev, char *fw_version, int fw_length). Add statusment in /doc/guides/nics/features/i40e.ini.
---

---
 doc/guides/nics/features/i40e.ini |  1 +
 drivers/net/i40e/i40e_ethdev.c    | 15 +++++++++++++++
 2 files changed, 16 insertions(+)
doc/guides/nics/features/i40e.ini +1 -0
index 0d143bc..6dab9f7 100644
@@ -46,3 +46,4 @@ Linux VFIO           = Y
 x86-32               = Y
 x86-64               = Y
 ARMv8                = Y
+FW version           = Y
drivers/net/i40e/i40e_ethdev.c +15 -0
index 8f63044..1dbbcc4 100644
@@ -324,6 +324,8 @@ static int i40e_dev_queue_stats_mapping_set(struct rte_eth_dev *dev,
 					    uint16_t queue_id,
 					    uint8_t stat_idx,
 					    uint8_t is_rx);
+static void i40e_fw_version_get(struct rte_eth_dev *dev, u32 *fw_major,
+	u32 *fw_minor, __rte_unused u32 *fw_patch, u32 *etrack_id);
 static void i40e_dev_info_get(struct rte_eth_dev *dev,
 			      struct rte_eth_dev_info *dev_info);
 static int i40e_vlan_filter_set(struct rte_eth_dev *dev,
@@ -503,6 +505,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
 	.stats_reset                  = i40e_dev_stats_reset,
 	.xstats_reset                 = i40e_dev_stats_reset,
 	.queue_stats_mapping_set      = i40e_dev_queue_stats_mapping_set,
+	.fw_version_get               = i40e_fw_version_get,
 	.dev_infos_get                = i40e_dev_info_get,
 	.dev_supported_ptypes_get     = i40e_dev_supported_ptypes_get,
 	.vlan_filter_set              = i40e_vlan_filter_set,
@@ -2590,6 +2593,18 @@ i40e_dev_queue_stats_mapping_set(__rte_unused struct rte_eth_dev *dev,
 }
 
 static void
+i40e_fw_version_get(struct rte_eth_dev *dev, u32 *fw_major, u32 *fw_minor,
+		__rte_unused u32 *fw_patch, u32 *etrack_id)
+{
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	*fw_major = (hw->nvm.version >> 12) & 0xf;
+	*fw_minor = ((hw->nvm.version >> 4) & 0xff) * 10 +
+			(hw->nvm.version & 0xf);
+	*etrack_id = hw->nvm.eetrack;
+}
+
+static void
 i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
Signature · 1 line
2.7.4
#64 lore raw

PATCH v4 5/5 ethtool: dispaly firmware version

In reply to Qiming Yang

This patch enhances the ethtool example to support to show firmware version, in the same way that the Linux kernel ethtool does.

---
v4 changes:
* split bus info print from this patch set
---

---
 examples/ethtool/ethtool-app/ethapp.c |  1 +
 examples/ethtool/lib/rte_ethtool.c    | 12 ++++++++++++
 2 files changed, 13 insertions(+)
examples/ethtool/ethtool-app/ethapp.c +1 -0
index 6aeaa06..85c31ac 100644
@@ -185,6 +185,7 @@ pcmd_drvinfo_callback(__rte_unused void *ptr_params,
 		printf("Port %i driver: %s (ver: %s)\n",
 			id_port, info.driver, info.version
 		      );
+		printf("firmware-version: %s\n", info.fw_version);
 	}
 }
 
examples/ethtool/lib/rte_ethtool.c +12 -0
index 6f0ce84..741468f 100644
@@ -54,6 +54,12 @@ rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo)
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
+	uint32_t fw_major = 0;
+	uint32_t fw_minor = 0;
+	uint32_t etrack = 0;
+
+	rte_eth_dev_fw_version_get(port_id, &fw_major, &fw_minor,
+				   NULL, &etrack);
 	memset(&dev_info, 0, sizeof(dev_info));
 	rte_eth_dev_info_get(port_id, &dev_info);
 
@@ -61,6 +67,12 @@ rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo)
 		dev_info.driver_name);
 	snprintf(drvinfo->version, sizeof(drvinfo->version), "%s",
 		rte_version());
+	if (strcmp(drvinfo->driver, "net_ixgbe") == 0)
+		snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
+			 "0x%08x", etrack);
+	else
+		snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
+			 "%d.%02d 0x%08x", fw_major, fw_minor, etrack);
 	if (dev_info.pci_dev)
 		snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),
 			"%04x:%02x:%02x.%x",
Signature · 1 line
2.7.4
#18 lore raw

PATCH v4 1/1 ethtool: dispaly bus information

In reply to Qiming Yang

This patch enhances the ethtool example to support to show bus information, in the same way that the Linux kernel ethtool does.

---
v4 changes:
* split bus info print from patch set ethdev: add firmware version get
---

---
 examples/ethtool/ethtool-app/ethapp.c | 1 +
 1 file changed, 1 insertion(+)
examples/ethtool/ethtool-app/ethapp.c +1 -0
index 85c31ac..35269ea 100644
@@ -186,6 +186,7 @@ pcmd_drvinfo_callback(__rte_unused void *ptr_params,
 			id_port, info.driver, info.version
 		      );
 		printf("firmware-version: %s\n", info.fw_version);
+		printf("bus-info: %s\n", info.bus_info);
 	}
 }
 
Signature · 1 line
2.7.4
#59 lore raw

Re: [PATCH v4 2/5] net/e1000: add firmware version get

In reply to Qiming Yang
Quoted 4 lines · Qiming Yang

This patch adds a new function eth_igb_fw_version_get.

---

<...>

Quoted 5 lines

static void

drivers/net/e1000/igb_ethdev.c +3 -0
+eth_igb_fw_version_get(struct rte_eth_dev *dev, u32 *fw_major, u32 *fw_minor,
+			u32 *fw_patch, u32 *etrack_id)
+{

<...>

drivers/net/e1000/igb_ethdev.c eth_igbvf_stats_reset(struct rte_eth_dev *dev) · line 2016

Quoted 13 lines
drivers/net/e1000/igb_ethdev.c +13 -0
+	default:
+		/* if option rom is valid, display its version too*/
+		if (fw.or_valid) {
+			*fw_major = fw.eep_major;
+			*fw_minor = fw.eep_minor;
+			*etrack_id = fw.etrack_id;
+			*fw_patch = fw.or_patch;
+		/* no option rom */
+		} else {
+			if (fw.etrack_id != 0X0000) {
+			*fw_major = fw.eep_major;
+			*fw_minor = fw.eep_minor;
+			*etrack_id = fw.etrack_id;

indentation is wrong here. Also it looks like major, minor assignment is common and can be moved from if statement.

Quoted 8 lines
drivers/net/e1000/igb_ethdev.c +8 -0
+			} else {
+			*fw_major = fw.eep_major;
+			*fw_minor = fw.eep_minor;
+			}
+		}
+		break;
+	}
+}

<...>

#63 lore raw

Re: [PATCH v4 4/5] net/i40e: add firmware version get

In reply to Qiming Yang
Quoted 4 lines · Qiming Yang

This patch add a new function i40e_fw_version_get.

---

<...>

doc/guides/nics/features/i40e.ini Linux VFIO = Y · line 49

Quoted 10 lines
doc/guides/nics/features/i40e.ini +1 -0
index 0d143bc..6dab9f7 100644
@@ -46,3 +46,4 @@ Linux VFIO           = Y
 x86-32               = Y
 x86-64               = Y
 ARMv8                = Y
+FW version           = Y

Please put same location with default.ini

<...>

#65 lore raw

Re: [PATCH v4 5/5] ethtool: dispaly firmware version

In reply to Qiming Yang
Quoted 5 lines · Qiming Yang

This patch enhances the ethtool example to support to show firmware version, in the same way that the Linux kernel ethtool does.

<...>

examples/ethtool/lib/rte_ethtool.c rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo) · line 70

Quoted 6 lines
examples/ethtool/lib/rte_ethtool.c +1 -0
@@ -61,6 +67,12 @@ rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo)
 		dev_info.driver_name);
 	snprintf(drvinfo->version, sizeof(drvinfo->version), "%s",
 		rte_version());
+	if (strcmp(drvinfo->driver, "net_ixgbe") == 0)

Do you need this check. I think it is not good idea to add this kind of checks into ethtool app. Why not just print "%d.%d.%d %#X, major, minor, patch, etrack" for all cases ?

Quoted 9 lines
examples/ethtool/lib/rte_ethtool.c +5 -0
+		snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
+			 "0x%08x", etrack);
+	else
+		snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
+			 "%d.%02d 0x%08x", fw_major, fw_minor, etrack);
 	if (dev_info.pci_dev)
 		snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),
 			"%04x:%02x:%02x.%x",
#19 lore raw

Re: [PATCH v4] ethtool: dispaly bus information

In reply to Qiming Yang
Quoted 10 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Qiming Yang
Sent: Wednesday, January 4, 2017 12:18 PM
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Zhang, Helin <[email protected]>; Horton, Remy <[email protected]>; Yang, Qiming <[email protected]>
Subject: [dpdk-dev] [PATCH v4] ethtool: dispaly bus information

Typo: s/dispaly/display in this and other patches.

#41 lore raw

Re: [PATCH v3 1/4] ethdev: add firmware information get

In reply to Ferruh Yigit
Quoted 11 lines
Quoted 6 lines

Different HW may have different version format, so it is better to use string.

And I prefer the API definition in your v2 patch like

rte_eth_dev_fwver_get(uint8_t port_id, char *fw_version, int fw_length);

The problem with this is the format and content of the string is not defined, as you said different HW has different version format. This is no problem if you will only print the string.

Quoted 6 lines

But this is a public API, if an application wants to call this API and do something useful according the FW version information, it will need to parse the string, and it will not able to parse it because format of the string is not defined. By making API fill some defined variables, app won't need to parse them, and API output won't be HW dependent.

As my understand, the firmware version is specific things to each HW. The format cannot be generic at all, or at least we have no standard to follow. I think the API should not be HW dependent, but about the output, application should know What the string's meaning. Otherwise why we need to provide the firmware info?

Thanks
Jingjing

#66 lore raw

Re: [PATCH v4 5/5] ethtool: dispaly firmware version

In reply to Ferruh Yigit

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, January 4, 2017 10:01 PM
To: Yang, Qiming <[email protected]>; [email protected]
Cc: Zhang, Helin <[email protected]>; Horton, Remy <[email protected]>
Subject: Re: [PATCH v4 5/5] ethtool: dispaly firmware version

Quoted 4 lines · Qiming Yang

This patch enhances the ethtool example to support to show firmware version, in the same way that the Linux kernel ethtool does.

<...>

examples/ethtool/lib/rte_ethtool.c rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo) · line 70

Quoted 6 lines
examples/ethtool/lib/rte_ethtool.c +1 -0
@@ -61,6 +67,12 @@ rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo)
 		dev_info.driver_name);
 	snprintf(drvinfo->version, sizeof(drvinfo->version), "%s",
 		rte_version());
+	if (strcmp(drvinfo->driver, "net_ixgbe") == 0)

Do you need this check. I think it is not good idea to add this kind of checks into ethtool app. Why not just print "%d.%d.%d %#X, major, minor, patch, etrack" for all cases ?
Qiming: because I want to keep the format same with kernel version ethtool.

Quoted 9 lines
examples/ethtool/lib/rte_ethtool.c +5 -0
+		snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
+			 "0x%08x", etrack);
+	else
+		snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
+			 "%d.%02d 0x%08x", fw_major, fw_minor, etrack);
 	if (dev_info.pci_dev)
 		snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),
 			"%04x:%02x:%02x.%x",
#60 lore raw

Re: [PATCH v4 2/5] net/e1000: add firmware version get

In reply to Ferruh Yigit

-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, January 4, 2017 10:00 PM
To: Yang, Qiming <[email protected]>; [email protected]
Cc: Zhang, Helin <[email protected]>; Horton, Remy <[email protected]>
Subject: Re: [PATCH v4 2/5] net/e1000: add firmware version get

Quoted 4 lines · Qiming Yang

This patch adds a new function eth_igb_fw_version_get.

---

<...>

Quoted 5 lines

static void

drivers/net/e1000/igb_ethdev.c +3 -0
+eth_igb_fw_version_get(struct rte_eth_dev *dev, u32 *fw_major, u32 *fw_minor,
+			u32 *fw_patch, u32 *etrack_id)
+{

<...>

drivers/net/e1000/igb_ethdev.c eth_igbvf_stats_reset(struct rte_eth_dev *dev) · line 2016

Quoted 13 lines
drivers/net/e1000/igb_ethdev.c +13 -0
+	default:
+		/* if option rom is valid, display its version too*/
+		if (fw.or_valid) {
+			*fw_major = fw.eep_major;
+			*fw_minor = fw.eep_minor;
+			*etrack_id = fw.etrack_id;
+			*fw_patch = fw.or_patch;
+		/* no option rom */
+		} else {
+			if (fw.etrack_id != 0X0000) {
+			*fw_major = fw.eep_major;
+			*fw_minor = fw.eep_minor;
+			*etrack_id = fw.etrack_id;

indentation is wrong here. Also it looks like major, minor assignment is common and can be moved from if statement.
Qiming: will correct them

Quoted 8 lines
drivers/net/e1000/igb_ethdev.c +8 -0
+			} else {
+			*fw_major = fw.eep_major;
+			*fw_minor = fw.eep_minor;
+			}
+		}
+		break;
+	}
+}

<...>

#20 lore raw

Re: [PATCH v4] ethtool: dispaly bus information

In reply to Mcnamara, John

-----Original Message-----
From: Mcnamara, John
Sent: Wednesday, January 4, 2017 10:49 PM
To: Yang, Qiming <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Zhang, Helin <[email protected]>; Horton, Remy <[email protected]>; Yang, Qiming <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v4] ethtool: dispaly bus information

Quoted 8 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Qiming Yang
Sent: Wednesday, January 4, 2017 12:18 PM
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Zhang, Helin <[email protected]>; Horton, Remy <[email protected]>; Yang, Qiming <[email protected]>
Subject: [dpdk-dev] [PATCH v4] ethtool: dispaly bus information

Typo: s/dispaly/display in this and other patches.
Qiming: Will correct them, thank you.

#30 lore raw

Re: [PATCH v2 0/5] example/ethtool: add bus info and fw version get

In reply to Thomas Monjalon
Quoted 61 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Thomas Monjalon
Sent: Thursday, December 22, 2016 11:31 PM
To: Yigit, Ferruh
Cc: Yang, Qiming; [email protected]; Horton, Remy
Subject: Re: [dpdk-dev] [PATCH v2 0/5] example/ethtool: add bus info and fw version get

2016-12-22 15:05, Ferruh Yigit:

Quoted 42 lines · Thomas Monjalon
Quoted 31 lines

2016-12-22 14:36, Ferruh Yigit:

Quoted 12 lines · Thomas Monjalon
Quoted 3 lines

I think it is OK to add a new dev_ops and a new API function for firmware query. Generally speaking, it is a good thing to avoid putting all informations in the same structure (e.g. rte_eth_dev_info).

OK.

Quoted 5 lines

However, there
is a balance to find. Could we plan to add more info to this new query? Instead of
rte_eth_dev_fwver_get(uint8_t port_id, char *fw_version, int
fw_length)

[...]

Quoted 17 lines
Quoted 3 lines

could it fill a struct?
rte_eth_dev_fw_info_get(uint8_t port_id, struct
rte_eth_dev_fw_info *fw_info)

I believe this is better. But the problem we are having with this usage
is: ABI breakage.

Since this struct will be a public structure, in the future if we want to add a new field to the struct, it will break the ABI, and just this change will cause a new version for whole ethdev library!

When all required fields received via arguments, one by one, instead of struct, at least ABI versioning can be done on the API when new field added, and can be possible to escape from ABI breakage. But this will be ugly when number of arguments increased.

Quoted 5 lines
Quoted 1 line

Or any other opinion on how to define API to reduce ABI breakage?

You're right.
But I don't think we should have a function per data. Just because it would be ugly :)

I am no suggesting function per data, instead something like:

rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t maj, uint32_t min);

Quoted 7 lines

And in the future if we need etrack_id too, we can have both in versioned manner:

rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t maj, uint32_t min);

rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t maj, uint32_t min,

	uint32_t etrack_id);
Quoted 6 lines

Oh I see. So it can be versioned with compat macros.

Quoted 1 line

So my concern was if the number of the arguments becomes too many by

time.

It looks to be a good proposal. We should not have a dozen of arguments.

I'd suggest to do that the similar way of kernel driver/ethtool (Linux or FreeBSD) does, which should be well discussed.
In addition, for future extention, and avoid breaking any ABI in a strcuture, we can just pre-define a lot of bytes as reserved, e.g. 64 bytes. Inside DPDK, there are several strucutres defined like this, e.g. mbuf.

Thanks,
Helin

#56 lore raw

Re: [PATCH v4 1/5] ethdev: add firmware version get

In reply to Qiming Yang

2017-01-04 20:03, Qiming Yang:

Quoted 2 lines

This patch adds a new API 'rte_eth_dev_fw_version_get' for fetching firmware version related information by a given device.

[...]

Quoted 14 lines

/**
+ * Retrieve the firmware version of a device.
+ *
+ * @param port_id
+ * The port identifier of the device.
+ * @param fw_major
+ * A pointer to store the major firmware version of a device.
+ * @param fw_minor
+ * A pointer to store the minor firmware version of a device.
+ * @param fw_patch
+ * A pointer to store the firmware patch number of a device.
+ * @param etrack_id
+ * A pointer to store the nvm version of a device.
+ */

lib/librte_ether/rte_ethdev.h void rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr); · line 2418

Quoted 2 lines
lib/librte_ether/rte_ethdev.h +2 -0
+void rte_eth_dev_fw_version_get(uint8_t port_id, uint32_t *fw_major,
+	uint32_t *fw_minor, uint32_t *fw_patch, uint32_t *etrack_id);

After reading few comments, I think it should just fill a string. There is no way the firmware version can be generalized or standardized. If the application wants to do some processing like number comparisons, it has to be aware of the specific firmware version string format. If you want to help the application to parse this string, it should be a PMD specific API.

#67 lore raw

Re: [PATCH v4 5/5] ethtool: dispaly firmware version

In reply to Yang, Qiming

On 05/01/2017 01:31, Yang, Qiming wrote:
[..]

Quoted 6 lines

examples/ethtool/lib/rte_ethtool.c rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo) · line 70

Quoted 1 line
examples/ethtool/lib/rte_ethtool.c +1 -0
+	if (strcmp(drvinfo->driver, "net_ixgbe") == 0)

Do you need this check. I think it is not good idea to add this kind of checks into ethtool app. Why not just print "%d.%d.%d %#X, major, minor, patch, etrack" for all cases ?
Qiming: because I want to keep the format same with kernel version ethtool.

My feeling is that if we're going to have driver-specific output, then the task of constructing the string should be pushed down into the PMDs. It would also solve the headache of trying to standardise, as Thomas has mentioned..

..Remy

#57 lore raw

Re: [PATCH v4 1/5] ethdev: add firmware version get

In reply to Thomas Monjalon

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Thursday, January 5, 2017 9:45 PM
To: Yang, Qiming <[email protected]>
Cc: [email protected]; Yigit, Ferruh <[email protected]>; Zhang, Helin <[email protected]>; Horton, Remy <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v4 1/5] ethdev: add firmware version get

2017-01-04 20:03, Qiming Yang:

Quoted 2 lines

This patch adds a new API 'rte_eth_dev_fw_version_get' for fetching firmware version related information by a given device.

[...]

Quoted 14 lines

/**
+ * Retrieve the firmware version of a device.
+ *
+ * @param port_id
+ * The port identifier of the device.
+ * @param fw_major
+ * A pointer to store the major firmware version of a device.
+ * @param fw_minor
+ * A pointer to store the minor firmware version of a device.
+ * @param fw_patch
+ * A pointer to store the firmware patch number of a device.
+ * @param etrack_id
+ * A pointer to store the nvm version of a device.
+ */

lib/librte_ether/rte_ethdev.h void rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr); · line 2418

Quoted 2 lines
lib/librte_ether/rte_ethdev.h +2 -0
+void rte_eth_dev_fw_version_get(uint8_t port_id, uint32_t *fw_major,
+	uint32_t *fw_minor, uint32_t *fw_patch, uint32_t *etrack_id);

After reading few comments, I think it should just fill a string.
There is no way the firmware version can be generalized or standardized.
If the application wants to do some processing like number comparisons, it has to be aware of the specific firmware version string format. If you want to help the application to parse this string, it should be a PMD specific API.
Qiming: I agree with you.

#68 lore raw

v5 cover new API 'rte_eth_dev_fw_version_get'

In reply to Qiming Yang

Now, the example ethtool can only show the driver information. From customers' point of view, it should be better if we can have the same way that the Linux kernel ethtool does to show firmware version.

These five patches added a new function ``rte_eth_dev_fw_version_get()`` to fetch firmware version related information and implement the display in example ethtool.

Qiming Yang (5):
ethdev: add firmware version get
net/e1000: add firmware version get
net/ixgbe: add firmware version get
net/i40e: add firmware version get
ethtool: display firmware version

 doc/guides/nics/features/default.ini   |  1 +
 doc/guides/nics/features/i40e.ini      |  1 +
 doc/guides/nics/features/igb.ini       |  1 +
 doc/guides/nics/features/ixgbe.ini     |  1 +
 doc/guides/rel_notes/deprecation.rst   |  4 ---
 doc/guides/rel_notes/release_17_02.rst |  3 +++
 drivers/net/e1000/igb_ethdev.c         | 46 ++++++++++++++++++++++++++++++++++
 drivers/net/i40e/i40e_ethdev.c         | 15 +++++++++++
 drivers/net/ixgbe/ixgbe_ethdev.c       | 18 +++++++++++++
 examples/ethtool/ethtool-app/ethapp.c  |  1 +
 examples/ethtool/lib/rte_ethtool.c     |  3 +++
 lib/librte_ether/rte_ethdev.c          | 12 +++++++++
 lib/librte_ether/rte_ethdev.h          | 20 +++++++++++++++
 lib/librte_ether/rte_ether_version.map |  1 +
 14 files changed, 123 insertions(+), 4 deletions(-)
Signature · 1 line
2.7.4
#69 lore raw

PATCH v5 1/5 ethdev: add firmware version get

This patch adds a new API 'rte_eth_dev_fw_version_get' for fetching firmware version by a given device.

---
v2 changes:
* modified some comment statements.
v3 changes:
* change API, use rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t *fw_major, uint32_t *fw_minor, uint32_t *fw_patch, uint32_t *etrack_id) instead of rte_eth_dev_fwver_get(uint8_t port_id, char *fw_version, int fw_length).
Add statusment in /doc/guides/nics/features/default.ini and release_17_02.rst.
v4 changes:
* remove deprecation notice, rename API as rte_eth_dev_fw_version_get. v5 changes:
* change API, use rte_eth_dev_fw_version_get(uint8_t port_id, char *fw_version, int fw_length).
---

---
 doc/guides/nics/features/default.ini   |  1 +
 doc/guides/rel_notes/deprecation.rst   |  4 ----
 doc/guides/rel_notes/release_17_02.rst |  3 +++
 lib/librte_ether/rte_ethdev.c          | 12 ++++++++++++
 lib/librte_ether/rte_ethdev.h          | 20 ++++++++++++++++++++
 lib/librte_ether/rte_ether_version.map |  1 +
 6 files changed, 37 insertions(+), 4 deletions(-)
doc/guides/nics/features/default.ini +1 -0
index f1bf9bf..ae40d57 100644
@@ -50,6 +50,7 @@ Timesync             =
 Basic stats          =
 Extended stats       =
 Stats per queue      =
+FW version           =
 EEPROM dump          =
 Registers dump       =
 Multiprocess aware   =
doc/guides/rel_notes/deprecation.rst +0 -4
index 1438c77..291e03d 100644
@@ -30,10 +30,6 @@ Deprecation Notices
   ``nb_seg_max`` and ``nb_mtu_seg_max`` providing information about number of
   segments limit to be transmitted by device for TSO/non-TSO packets.
 
-* 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.
-
 * ethdev: an API change is planned for 17.02 for the function
   ``_rte_eth_dev_callback_process``. In 17.02 the function will return an ``int``
   instead of ``void`` and a fourth parameter ``void *ret_param`` will be added.
doc/guides/rel_notes/release_17_02.rst +3 -0
index 180af82..260033d 100644
@@ -52,6 +52,9 @@ New Features
   See the :ref:`Generic flow API <Generic_flow_API>` documentation for more
   information.
 
+* **Added firmware version get API.**
+ Added a new function ``rte_eth_dev_fw_version_get()`` to fetch firmware
+ version by a given device.
 
 Resolved Issues
 ---------------
lib/librte_ether/rte_ethdev.c +12 -0
index 280f0db..cb80476 100644
@@ -1586,6 +1586,18 @@ rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id,
 }
 
 void
+rte_eth_dev_fw_version_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;
lib/librte_ether/rte_ethdev.h +20 -0
index fb51754..2be31d2 100644
@@ -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);
 
@@ -1455,6 +1459,7 @@ struct eth_dev_ops {
 	eth_dev_infos_get_t        dev_infos_get; /**< Get device info. */
 	eth_rxq_info_get_t         rxq_info_get; /**< retrieve RX queue information. */
 	eth_txq_info_get_t         txq_info_get; /**< retrieve TX queue information. */
+	eth_fw_version_get_t       fw_version_get; /**< Get firmware version. */
 	eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
 	/**< Get packet types supported and identified by device. */
 
@@ -2395,6 +2400,21 @@ 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, which should be
+ *   large enough to store firmware version of the device.
+ */
+void rte_eth_dev_fw_version_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
lib/librte_ether/rte_ether_version.map +1 -0
index a021781..0cf94ed 100644
@@ -151,6 +151,7 @@ DPDK_17.02 {
 	global:
 
 	_rte_eth_dev_reset;
+	rte_eth_dev_fw_version_get;
 	rte_flow_create;
 	rte_flow_destroy;
 	rte_flow_flush;
Signature · 1 line
2.7.4
#75 lore raw

PATCH v5 2/5 net/e1000: add firmware version get

In reply to Qiming Yang

This patch adds a new function eth_igb_fw_version_get.

---
v3 changes:
* use eth_igb_fw_version_get(struct rte_eth_dev *dev, u32 *fw_major, u32 *fw_minor, u32 *fw_minor, u32 *fw_patch, u32 *etrack_id) instead of eth_igb_fw_version_get(struct rte_eth_dev *dev, char *fw_version, int fw_length). Add statusment in /doc/guides/nics/features/igb.ini.
v5 changes:
* use the function interface in patch v2.
---

---
 doc/guides/nics/features/igb.ini |  1 +
 drivers/net/e1000/igb_ethdev.c   | 46 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)
doc/guides/nics/features/igb.ini +1 -0
index 9fafe72..26ae008 100644
@@ -35,6 +35,7 @@ Packet type parsing  = Y
 Timesync             = Y
 Basic stats          = Y
 Extended stats       = Y
+FW version           = Y
 EEPROM dump          = Y
 Registers dump       = Y
 BSD nic_uio          = Y
drivers/net/e1000/igb_ethdev.c +46 -0

64 lines not on this page · raw message

Signature · 1 line
2.7.4
#78 lore raw

PATCH v5 3/5 net/ixgbe: add firmware version get

In reply to Qiming Yang

This patch adds a new function ixgbe_fw_version_get.

---
v3 changes:
* use ixgbe_fw_version_get(struct rte_eth_dev *dev, __rte_unused u32 *fw_major, __rte_unused u32 *fw_minor, __rte_unused u32 *fw_patch, u32 *etrack_id) instead of ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, int fw_length). Add statusment
in /doc/guides/nics/features/ixgbe.ini.
v5 changes:
* use the function interface in patch v2.
---

---
 doc/guides/nics/features/ixgbe.ini |  1 +
 drivers/net/ixgbe/ixgbe_ethdev.c   | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)
doc/guides/nics/features/ixgbe.ini +1 -0
index 4a5667f..e7104c2 100644
@@ -43,6 +43,7 @@ Timesync             = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
+FW version           = Y
 EEPROM dump          = Y
 Registers dump       = Y
 Multiprocess aware   = Y
drivers/net/ixgbe/ixgbe_ethdev.c +18 -0
index ec2edad..407f398 100644
@@ -193,6 +193,8 @@ static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 					     uint16_t queue_id,
 					     uint8_t stat_idx,
 					     uint8_t is_rx);
+static void ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
+				 int fw_length);
 static void ixgbe_dev_info_get(struct rte_eth_dev *dev,
 			       struct rte_eth_dev_info *dev_info);
 static const uint32_t *ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev);
@@ -538,6 +540,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
 	.xstats_reset         = ixgbe_dev_xstats_reset,
 	.xstats_get_names     = ixgbe_dev_xstats_get_names,
 	.queue_stats_mapping_set = ixgbe_dev_queue_stats_mapping_set,
+	.fw_version_get       = ixgbe_fw_version_get,
 	.dev_infos_get        = ixgbe_dev_info_get,
 	.dev_supported_ptypes_get = ixgbe_dev_supported_ptypes_get,
 	.mtu_set              = ixgbe_dev_mtu_set,
@@ -3029,6 +3032,21 @@ ixgbevf_dev_stats_reset(struct rte_eth_dev *dev)
 }
 
 static void
+ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, int fw_length)
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u16 eeprom_verh, eeprom_verl;
+	u32 etrack_id;
+
+	ixgbe_read_eeprom(hw, 0x2e, &eeprom_verh);
+	ixgbe_read_eeprom(hw, 0x2d, &eeprom_verl);
+
+	etrack_id = (eeprom_verh << 16) | eeprom_verl;
+	snprintf(fw_version, fw_length,
+		 "0x%08x", etrack_id);
+}
+
+static void
 ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
 	struct rte_pci_device *pci_dev = IXGBE_DEV_TO_PCI(dev);
Signature · 1 line
2.7.4
#79 lore raw

PATCH v5 4/5 net/i40e: add firmware version get

In reply to Qiming Yang

This patch add a new function i40e_fw_version_get.

---
v3 changes:
* use i40e_fw_version_get(struct rte_eth_dev *dev, u32 *fw_major, u32 *fw_minor, __rte_unused u32 *fw_patch, u32 *etrack_id) instead of i40e_fw_version_get(struct rte_eth_dev *dev, char *fw_version, int fw_length). Add statusment in /doc/guides/nics/features/i40e.ini.
v5 changes:
* use the function interface in patch v2.
---

---
 doc/guides/nics/features/i40e.ini |  1 +
 drivers/net/i40e/i40e_ethdev.c    | 15 +++++++++++++++
 2 files changed, 16 insertions(+)
doc/guides/nics/features/i40e.ini +1 -0
index 0d143bc..0dbc3c3 100644
@@ -39,6 +39,7 @@ Packet type parsing  = Y
 Timesync             = Y
 Basic stats          = Y
 Extended stats       = Y
+FW version           = Y
 Multiprocess aware   = Y
 BSD nic_uio          = Y
 Linux UIO            = Y
drivers/net/i40e/i40e_ethdev.c +15 -0
index 8f63044..ff6f106 100644
@@ -324,6 +324,8 @@ static int i40e_dev_queue_stats_mapping_set(struct rte_eth_dev *dev,
 					    uint16_t queue_id,
 					    uint8_t stat_idx,
 					    uint8_t is_rx);
+static void i40e_fw_version_get(struct rte_eth_dev *dev,
+				char *fw_version, int fw_length);
 static void i40e_dev_info_get(struct rte_eth_dev *dev,
 			      struct rte_eth_dev_info *dev_info);
 static int i40e_vlan_filter_set(struct rte_eth_dev *dev,
@@ -503,6 +505,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
 	.stats_reset                  = i40e_dev_stats_reset,
 	.xstats_reset                 = i40e_dev_stats_reset,
 	.queue_stats_mapping_set      = i40e_dev_queue_stats_mapping_set,
+	.fw_version_get               = i40e_fw_version_get,
 	.dev_infos_get                = i40e_dev_info_get,
 	.dev_supported_ptypes_get     = i40e_dev_supported_ptypes_get,
 	.vlan_filter_set              = i40e_vlan_filter_set,
@@ -2590,6 +2593,18 @@ i40e_dev_queue_stats_mapping_set(__rte_unused struct rte_eth_dev *dev,
 }
 
 static void
+i40e_fw_version_get(struct rte_eth_dev *dev, char *fw_version, int fw_length)
+{
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	snprintf(fw_version, fw_length,
+		 "%d.%d%d 0x%08x",
+		 ((hw->nvm.version >> 12) & 0xf),
+		 ((hw->nvm.version >> 4) & 0xff),
+		 (hw->nvm.version & 0xf), hw->nvm.eetrack);
+}
+
+static void
 i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
Signature · 1 line
2.7.4
#81 lore raw

PATCH v5 5/5 ethtool: display firmware version

In reply to Qiming Yang

This patch enhances the ethtool example to support to show firmware version, in the same way that the Linux kernel ethtool does.

---
v4 changes:
* split bus info print from this patch set
---

---
 examples/ethtool/ethtool-app/ethapp.c | 1 +
 examples/ethtool/lib/rte_ethtool.c    | 3 +++
 2 files changed, 4 insertions(+)
examples/ethtool/ethtool-app/ethapp.c +1 -0
index 6aeaa06..85c31ac 100644
@@ -185,6 +185,7 @@ pcmd_drvinfo_callback(__rte_unused void *ptr_params,
 		printf("Port %i driver: %s (ver: %s)\n",
 			id_port, info.driver, info.version
 		      );
+		printf("firmware-version: %s\n", info.fw_version);
 	}
 }
 
examples/ethtool/lib/rte_ethtool.c +3 -0
index 6f0ce84..36f4ae8 100644
@@ -54,6 +54,9 @@ rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo)
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
+	rte_eth_dev_fw_version_get(port_id, drvinfo->fw_version,
+			      sizeof(drvinfo->fw_version));
+
 	memset(&dev_info, 0, sizeof(dev_info));
 	rte_eth_dev_info_get(port_id, &dev_info);
 
Signature · 1 line
2.7.4
#70 lore raw

Re: [PATCH v5 1/5] ethdev: add firmware version get

In reply to Qiming Yang
Quoted 76 lines · Qiming Yang

This patch adds a new API 'rte_eth_dev_fw_version_get' for fetching firmware version by a given device.

---
v2 changes:
* modified some comment statements.
v3 changes:
* change API, use rte_eth_dev_fw_info_get(uint8_t port_id, uint32_t *fw_major, uint32_t *fw_minor, uint32_t *fw_patch, uint32_t *etrack_id) instead of rte_eth_dev_fwver_get(uint8_t port_id, char *fw_version, int fw_length).
Add statusment in /doc/guides/nics/features/default.ini and release_17_02.rst.
v4 changes:
* remove deprecation notice, rename API as rte_eth_dev_fw_version_get. v5 changes:
* change API, use rte_eth_dev_fw_version_get(uint8_t port_id, char *fw_version, int fw_length).
---

---
  doc/guides/nics/features/default.ini   |  1 +
  doc/guides/rel_notes/deprecation.rst   |  4 ----
  doc/guides/rel_notes/release_17_02.rst |  3 +++
  lib/librte_ether/rte_ethdev.c          | 12 ++++++++++++
  lib/librte_ether/rte_ethdev.h          | 20 ++++++++++++++++++++
  lib/librte_ether/rte_ether_version.map |  1 +
  6 files changed, 37 insertions(+), 4 deletions(-)
doc/guides/nics/features/default.ini +1 -0
index f1bf9bf..ae40d57 100644
@@ -50,6 +50,7 @@ Timesync             =
  Basic stats          =
  Extended stats       =
  Stats per queue      =
+FW version           =
  EEPROM dump          =
  Registers dump       =
  Multiprocess aware   =
doc/guides/rel_notes/deprecation.rst +0 -4
index 1438c77..291e03d 100644
@@ -30,10 +30,6 @@ Deprecation Notices
    ``nb_seg_max`` and ``nb_mtu_seg_max`` providing information about number of
    segments limit to be transmitted by device for TSO/non-TSO packets.
 
-* 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.
-
  * ethdev: an API change is planned for 17.02 for the function
    ``_rte_eth_dev_callback_process``. In 17.02 the function will return an ``int``
    instead of ``void`` and a fourth parameter ``void *ret_param`` will be added.
doc/guides/rel_notes/release_17_02.rst +3 -0
index 180af82..260033d 100644
@@ -52,6 +52,9 @@ New Features
    See the :ref:`Generic flow API <Generic_flow_API>` documentation for more
    information.
 
+* **Added firmware version get API.**
+ Added a new function ``rte_eth_dev_fw_version_get()`` to fetch firmware
+ version by a given device.
 
  Resolved Issues
  ---------------
lib/librte_ether/rte_ethdev.c +0 -0
index 280f0db..cb80476 100644

lib/librte_ether/rte_ethdev.c rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id, · line 1589

Quoted 4 lines
lib/librte_ether/rte_ethdev.c +1 -0
@@ -1586,6 +1586,18 @@ rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id,
  }
 
  void
+rte_eth_dev_fw_version_get(uint8_t port_id, char *fw_version, int fw_length)

May be size_t should be used for fw_length? Corresponding argument of the snprintf() has size_t type, sizeof(drvinfo.fw_version) is used as value of the parameter.

Also the prototype does not provide a way to communicate that fw_length is insufficient to store firmware version. I'd suggest snprintf()-like return value. It is pretty easy for PMD to provide and convenient for the API function caller to handle.

Quoted 71 lines
lib/librte_ether/rte_ethdev.c +11 -0
+{
+	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;
lib/librte_ether/rte_ethdev.h +20 -0
index fb51754..2be31d2 100644
@@ -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);
 
@@ -1455,6 +1459,7 @@ struct eth_dev_ops {
  	eth_dev_infos_get_t        dev_infos_get; /**< Get device info. */
  	eth_rxq_info_get_t         rxq_info_get; /**< retrieve RX queue information. */
  	eth_txq_info_get_t         txq_info_get; /**< retrieve TX queue information. */
+	eth_fw_version_get_t       fw_version_get; /**< Get firmware version. */
  	eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
  	/**< Get packet types supported and identified by device. */
 
@@ -2395,6 +2400,21 @@ 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, which should be
+ *   large enough to store firmware version of the device.
+ */
+void rte_eth_dev_fw_version_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
lib/librte_ether/rte_ether_version.map +1 -0
index a021781..0cf94ed 100644
@@ -151,6 +151,7 @@ DPDK_17.02 {
  	global:
 
  	_rte_eth_dev_reset;
+	rte_eth_dev_fw_version_get;
  	rte_flow_create;
  	rte_flow_destroy;
  	rte_flow_flush;
#76 lore raw

Re: [PATCH v5 2/5] net/e1000: add firmware version get

In reply to Qiming Yang
Quoted 18 lines · On Sun, 8 Jan 2017 12:11:32 +0800 Qiming Yang <[email protected]> wrote:
drivers/net/e1000/igb_ethdev.c +18 -0
+	switch (hw->mac.type) {
+	case e1000_i210:
+	case e1000_i211:
+		if (!(e1000_get_flash_presence_i210(hw))) {
+			snprintf(fw_version, fw_length,
+				 "%2d.%2d-%d",
+				 fw.invm_major, fw.invm_minor,
+				 fw.invm_img_type);
+			break;
+		}
+		/* fall through */
+	default:
+		/* if option rom is valid, display its version too*/
+		if (fw.or_valid) {
+			snprintf(fw_version, fw_length,
+				 "%d.%d, 0x%08x, %d.%d.%d",
+				 fw.eep_major, fw.eep_minor, fw.etrack_id,
+				 fw.or_major, fw.or_build, fw.or_patch);

drivers/net/e1000/igb_ethdev.c eth_igbvf_stats_reset(struct rte_eth_dev *dev) · line 2022

Quoted 10 lines
drivers/net/e1000/igb_ethdev.c +10 -0
+		/* no option rom */
+		} else {
+			if (fw.etrack_id != 0X0000) {
+			snprintf(fw_version, fw_length,
+				 "%d.%d, 0x%08x",
+				 fw.eep_major, fw.eep_minor, fw.etrack_id);
+			} else {
+			snprintf(fw_version, fw_length,
+				 "%d.%d.%d",
+				 fw.eep_major, fw.eep_minor, fw.eep_build);

Indentation is incorrect here.

#71 lore raw

Re: [PATCH v5 1/5] ethdev: add firmware version get

In reply to Qiming Yang

lib/librte_ether/rte_ethdev.c rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id, · line 1598

Quoted 11 lines · On Sun, 8 Jan 2017 12:11:31 +0800 Qiming Yang <[email protected]> wrote:

void

lib/librte_ether/rte_ethdev.c +10 -0
+rte_eth_dev_fw_version_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);
+}

Maybe dev argument to fw_version_get should be:
const struct rte_eth_dev *dev

#80 lore raw

Re: [PATCH v5 4/5] net/i40e: add firmware version get

In reply to Qiming Yang

drivers/net/i40e/i40e_ethdev.c i40e_dev_queue_stats_mapping_set(__rte_unused struct rte_eth_dev *dev, · line 2604

Quoted 10 lines · On Sun, 8 Jan 2017 12:11:34 +0800 Qiming Yang <[email protected]> wrote:

static void

drivers/net/i40e/i40e_ethdev.c +9 -0
+i40e_fw_version_get(struct rte_eth_dev *dev, char *fw_version, int fw_length)
+{
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	snprintf(fw_version, fw_length,
+		 "%d.%d%d 0x%08x",
+		 ((hw->nvm.version >> 12) & 0xf),
+		 ((hw->nvm.version >> 4) & 0xff),
+		 (hw->nvm.version & 0xf), hw->nvm.eetrack);

It would be good to have same constants and format between Linux kernel driver and DPDK.

Use %u as format specifier for unsigned values

static inline char *i40e_nvm_version_str(struct i40e_hw *hw)

{
	static char buf[32];
	u32 full_ver;
	u8 ver, patch;
	u16 build;

	full_ver = hw->nvm.oem_ver;
	ver = (u8)(full_ver >> I40E_OEM_VER_SHIFT);
	build = (u16)((full_ver >> I40E_OEM_VER_BUILD_SHIFT) &
		 I40E_OEM_VER_BUILD_MASK);
	patch = (u8)(full_ver & I40E_OEM_VER_PATCH_MASK);

	snprintf(buf, sizeof(buf),
		 "%x.%02x 0x%x %d.%d.%d",
		 (hw->nvm.version & I40E_NVM_VERSION_HI_MASK) >>
			I40E_NVM_VERSION_HI_SHIFT,
		 (hw->nvm.version & I40E_NVM_VERSION_LO_MASK) >>
			I40E_NVM_VERSION_LO_SHIFT,
		 hw->nvm.eetrack, ver, build, patch);
#82 lore raw

Re: [PATCH v5 5/5] ethtool: display firmware version

In reply to Qiming Yang

examples/ethtool/lib/rte_ethtool.c rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo) · line 61

Quoted 11 lines · On Sun, 8 Jan 2017 12:11:35 +0800 Qiming Yang <[email protected]> wrote:
examples/ethtool/lib/rte_ethtool.c +3 -0
@@ -54,6 +54,9 @@ rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo)
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
+	rte_eth_dev_fw_version_get(port_id, drvinfo->fw_version,
+			      sizeof(drvinfo->fw_version));
+
 	memset(&dev_info, 0, sizeof(dev_info));
 	rte_eth_dev_info_get(port_id, &dev_info);

That memset is redundant since dev_info_get() does memset as first thing.

#77 lore raw

Re: [PATCH v5 2/5] net/e1000: add firmware version get

In reply to Stephen Hemminger

-----Original Message-----
From: Stephen Hemminger [mailto:[email protected]]
Sent: Monday, January 9, 2017 7:04 AM
To: Yang, Qiming <[email protected]>
Cc: [email protected]; Yigit, Ferruh <[email protected]>; Zhang, Helin <[email protected]>; Horton, Remy <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 2/5] net/e1000: add firmware version get

Quoted 18 lines · On Sun, 8 Jan 2017 12:11:32 +0800 Qiming Yang <[email protected]> wrote:
drivers/net/e1000/igb_ethdev.c +18 -0
+	switch (hw->mac.type) {
+	case e1000_i210:
+	case e1000_i211:
+		if (!(e1000_get_flash_presence_i210(hw))) {
+			snprintf(fw_version, fw_length,
+				 "%2d.%2d-%d",
+				 fw.invm_major, fw.invm_minor,
+				 fw.invm_img_type);
+			break;
+		}
+		/* fall through */
+	default:
+		/* if option rom is valid, display its version too*/
+		if (fw.or_valid) {
+			snprintf(fw_version, fw_length,
+				 "%d.%d, 0x%08x, %d.%d.%d",
+				 fw.eep_major, fw.eep_minor, fw.etrack_id,
+				 fw.or_major, fw.or_build, fw.or_patch);

drivers/net/e1000/igb_ethdev.c eth_igbvf_stats_reset(struct rte_eth_dev *dev) · line 2022

Quoted 10 lines
drivers/net/e1000/igb_ethdev.c +10 -0
+		/* no option rom */
+		} else {
+			if (fw.etrack_id != 0X0000) {
+			snprintf(fw_version, fw_length,
+				 "%d.%d, 0x%08x",
+				 fw.eep_major, fw.eep_minor, fw.etrack_id);
+			} else {
+			snprintf(fw_version, fw_length,
+				 "%d.%d.%d",
+				 fw.eep_major, fw.eep_minor, fw.eep_build);

Indentation is incorrect here.
Qiming: my mistake.

#72 lore raw

Re: [PATCH v5 1/5] ethdev: add firmware version get

In reply to Stephen Hemminger

-----Original Message-----
From: Stephen Hemminger [mailto:[email protected]]
Sent: Monday, January 9, 2017 7:05 AM
To: Yang, Qiming <[email protected]>
Cc: [email protected]; Yigit, Ferruh <[email protected]>; Zhang, Helin <[email protected]>; Horton, Remy <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 1/5] ethdev: add firmware version get

lib/librte_ether/rte_ethdev.c rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id,

Quoted 10 lines · On Sun, 8 Jan 2017 12:11:31 +0800 Qiming Yang <[email protected]> wrote:

void

lib/librte_ether/rte_ethdev.c +9 -0
+rte_eth_dev_fw_version_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); }

Maybe dev argument to fw_version_get should be:
const struct rte_eth_dev *dev
Qiming: do you means the argument to ops fw_version_get?
why should add 'const'? both two are OK, but we usually use struct rte_eth_dev *dev.

#73 lore raw

Re: [PATCH v5 1/5] ethdev: add firmware version get

Quoted 2 lines · Qiming

-----Original Message-----
From: Stephen Hemminger [mailto:[email protected]]

[..]

Quoted 7 lines
Quoted 7 lines

void

lib/librte_ether/rte_ethdev.c +6 -0
+rte_eth_dev_fw_version_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];
Quoted 8 lines

lib/librte_ether/rte_ethdev.c rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id,

Quoted 3 lines
lib/librte_ether/rte_ethdev.c +3 -0
+
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->fw_version_get);
+	(*dev->dev_ops->fw_version_get)(dev, fw_version, fw_length); }

Maybe dev argument to fw_version_get should be:
const struct rte_eth_dev *dev
Qiming: do you means the argument to ops fw_version_get?
why should add 'const'? both two are OK, but we usually use struct rte_eth_dev *dev.

Does seem a bit odd to me as I don't think any of the other rte_dev_ops entrypoints use const. Maybe they should but if that's now policy (I've been under a rock recently) probably better to do them all in a seperate cleanup patchset..

#74 lore raw

Re: [PATCH v5 1/5] ethdev: add firmware version get

Quoted 20 lines · On Mon, 9 Jan 2017 10:01:40 +0000 Remy Horton <[email protected]> wrote:
Quoted 2 lines · Qiming

-----Original Message-----
From: Stephen Hemminger [mailto:[email protected]]

[..]

Quoted 7 lines
Quoted 7 lines

void

lib/librte_ether/rte_ethdev.c +6 -0
+rte_eth_dev_fw_version_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];
Quoted 8 lines

lib/librte_ether/rte_ethdev.c rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id,

Quoted 3 lines
lib/librte_ether/rte_ethdev.c +3 -0
+
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->fw_version_get);
+	(*dev->dev_ops->fw_version_get)(dev, fw_version, fw_length); }  

Maybe dev argument to fw_version_get should be:
const struct rte_eth_dev *dev
Qiming: do you means the argument to ops fw_version_get?
why should add 'const'? both two are OK, but we usually use struct rte_eth_dev *dev.

Quoted 4 lines

Does seem a bit odd to me as I don't think any of the other rte_dev_ops entrypoints use const. Maybe they should but if that's now policy (I've been under a rock recently) probably better to do them all in a seperate cleanup patchset..

DPDK is somewhat lazy about using const.

#83 lore raw

PATCH v2 1/5 ethdev: add firmware version get

In reply to Qiming Yang

This patch adds a new API 'rte_eth_dev_fw_version_get' for fetching firmware version by a given device.

---
 doc/guides/nics/features/default.ini   |  1 +
 doc/guides/rel_notes/deprecation.rst   |  4 ----
 doc/guides/rel_notes/release_17_02.rst |  3 +++
 lib/librte_ether/rte_ethdev.c          | 12 ++++++++++++
 lib/librte_ether/rte_ethdev.h          | 25 +++++++++++++++++++++++++
 lib/librte_ether/rte_ether_version.map |  1 +
 6 files changed, 42 insertions(+), 4 deletions(-)
doc/guides/nics/features/default.ini +1 -0
index f1bf9bf..ae40d57 100644
@@ -50,6 +50,7 @@ Timesync             =
 Basic stats          =
 Extended stats       =
 Stats per queue      =
+FW version           =
 EEPROM dump          =
 Registers dump       =
 Multiprocess aware   =
doc/guides/rel_notes/deprecation.rst +0 -4
index 1438c77..291e03d 100644
@@ -30,10 +30,6 @@ Deprecation Notices
   ``nb_seg_max`` and ``nb_mtu_seg_max`` providing information about number of
   segments limit to be transmitted by device for TSO/non-TSO packets.
 
-* 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.
-
 * ethdev: an API change is planned for 17.02 for the function
   ``_rte_eth_dev_callback_process``. In 17.02 the function will return an ``int``
   instead of ``void`` and a fourth parameter ``void *ret_param`` will be added.
doc/guides/rel_notes/release_17_02.rst +3 -0
index 180af82..260033d 100644
@@ -52,6 +52,9 @@ New Features
   See the :ref:`Generic flow API <Generic_flow_API>` documentation for more
   information.
 
+* **Added firmware version get API.**
+ Added a new function ``rte_eth_dev_fw_version_get()`` to fetch firmware
+ version by a given device.
 
 Resolved Issues
 ---------------
lib/librte_ether/rte_ethdev.c +12 -0
index 9dea1f1..49ca42d 100644
@@ -1588,6 +1588,18 @@ rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id,
 			STAT_QMAP_RX);
 }
 
+int
+rte_eth_dev_fw_version_get(uint8_t port_id, char *fw_version, size_t fw_size)
+{
+	struct rte_eth_dev *dev;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	dev = &rte_eth_devices[port_id];
+
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fw_version_get, -ENOTSUP);
+	return (*dev->dev_ops->fw_version_get)(dev, fw_version, fw_size);
+}
+
 void
 rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)
 {
lib/librte_ether/rte_ethdev.h +25 -0
index 1c356c1..357612d 100644
@@ -1177,6 +1177,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 int (*eth_fw_version_get_t)(struct rte_eth_dev *dev,
+				     char *fw_version, size_t fw_size);
+/**< @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);
 
@@ -1487,6 +1491,7 @@ struct eth_dev_ops {
 	eth_dev_infos_get_t        dev_infos_get; /**< Get device info. */
 	eth_rxq_info_get_t         rxq_info_get; /**< retrieve RX queue information. */
 	eth_txq_info_get_t         txq_info_get; /**< retrieve TX queue information. */
+	eth_fw_version_get_t       fw_version_get; /**< Get firmware version. */
 	eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
 	/**< Get packet types supported and identified by device. */
 
@@ -2430,6 +2435,26 @@ 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_size
+ *   The size of the array pointed by fw_version, which should be
+ *   large enough to store firmware version of the device.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if operation is not supported.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - (-EINVAL) if *fw_size* is not enough to store firmware version.
+ */
+int rte_eth_dev_fw_version_get(uint8_t port_id,
+			       char *fw_version, size_t fw_size);
+
+/**
  * Retrieve the supported packet types of an Ethernet device.
  *
  * When a packet type is announced as supported, it *must* be recognized by
lib/librte_ether/rte_ether_version.map +1 -0
index a021781..0cf94ed 100644
@@ -151,6 +151,7 @@ DPDK_17.02 {
 	global:
 
 	_rte_eth_dev_reset;
+	rte_eth_dev_fw_version_get;
 	rte_flow_create;
 	rte_flow_destroy;
 	rte_flow_flush;
Signature · 1 line
2.7.4
#84 lore raw

PATCH v2 2/5 net/e1000: add firmware version get

This patch adds a new function eth_igb_fw_version_get.

---
 doc/guides/nics/features/igb.ini |  1 +
 drivers/net/e1000/igb_ethdev.c   | 54 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)
doc/guides/nics/features/igb.ini +1 -0
index 9fafe72..26ae008 100644
@@ -35,6 +35,7 @@ Packet type parsing  = Y
 Timesync             = Y
 Basic stats          = Y
 Extended stats       = Y
+FW version           = Y
 EEPROM dump          = Y
 Registers dump       = Y
 BSD nic_uio          = Y
drivers/net/e1000/igb_ethdev.c +54 -0

72 lines not on this page · raw message

Signature · 1 line
2.7.4
#85 lore raw

PATCH v2 3/5 net/ixgbe: add firmware version get

In reply to Qiming Yang

This patch adds a new function ixgbe_fw_version_get.

---
 doc/guides/nics/features/ixgbe.ini |  1 +
 drivers/net/ixgbe/ixgbe_ethdev.c   | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+)
doc/guides/nics/features/ixgbe.ini +1 -0
index 4a5667f..e7104c2 100644
@@ -43,6 +43,7 @@ Timesync             = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
+FW version           = Y
 EEPROM dump          = Y
 Registers dump       = Y
 Multiprocess aware   = Y
drivers/net/ixgbe/ixgbe_ethdev.c +25 -0
index 060772d..a638936 100644
@@ -193,6 +193,8 @@ static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 					     uint16_t queue_id,
 					     uint8_t stat_idx,
 					     uint8_t is_rx);
+static int ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
+				 size_t fw_size);
 static void ixgbe_dev_info_get(struct rte_eth_dev *dev,
 			       struct rte_eth_dev_info *dev_info);
 static const uint32_t *ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev);
@@ -540,6 +542,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
 	.xstats_reset         = ixgbe_dev_xstats_reset,
 	.xstats_get_names     = ixgbe_dev_xstats_get_names,
 	.queue_stats_mapping_set = ixgbe_dev_queue_stats_mapping_set,
+	.fw_version_get       = ixgbe_fw_version_get,
 	.dev_infos_get        = ixgbe_dev_info_get,
 	.dev_supported_ptypes_get = ixgbe_dev_supported_ptypes_get,
 	.mtu_set              = ixgbe_dev_mtu_set,
@@ -3034,6 +3037,28 @@ ixgbevf_dev_stats_reset(struct rte_eth_dev *dev)
 	hw_stats->vfgotc = 0;
 }
 
+static int
+ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u16 eeprom_verh, eeprom_verl;
+	u32 etrack_id;
+
+	if (fw_size < 11) {
+		PMD_DRV_LOG(WARNING, "Insufficient fw version buffer size");
+		return -EINVAL;
+	}
+
+	ixgbe_read_eeprom(hw, 0x2e, &eeprom_verh);
+	ixgbe_read_eeprom(hw, 0x2d, &eeprom_verl);
+
+	etrack_id = (eeprom_verh << 16) | eeprom_verl;
+	snprintf(fw_version, fw_size,
+		 "0x%08x", etrack_id);
+
+	return 0;
+}
+
 static void
 ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
Signature · 1 line
2.7.4
#86 lore raw

v6 cover new API 'rte_eth_dev_fw_version_get'

In reply to Qiming Yang

v6: - renamed fw_length -> fw_size
- added return value for insufficient fw_size
- fixed the indentation problem in e1000
- added ver.build.patch in i40e, keep the same with Linux kernel driver

v5: - modified the API rte_eth_dev_fw_version_get(uint8_t port_id,
char *fw_version, int fw_length).

v4: - removed deprecation notice
- renamed API as rte_eth_dev_fw_version_get
- splited bus info print from this patch set

v3: - changed API, use rte_eth_dev_fw_info_get(uint8_t port_id,

      uint32_t *fw_major, uint32_t *fw_minor, uint32_t *fw_patch,
      uint32_t *etrack_id)
    - added statusment in /doc/guides/nics/features/default.ini and
      release_17_02.rst

v2: - fixed commit log

Now, the example ethtool can only show the driver information. From customers' point of view, it should be better if we can have the same way that the Linux kernel ethtool does to show firmware version.

These five patches added a new function ``rte_eth_dev_fw_version_get()`` to fetch firmware version related information and implement the display in example ethtool.

Qiming Yang (5):
ethdev: add firmware version get
net/e1000: add firmware version get
net/ixgbe: add firmware version get
net/i40e: add firmware version get
ethtool: display firmware version

 doc/guides/nics/features/default.ini   |  1 +
 doc/guides/nics/features/i40e.ini      |  1 +
 doc/guides/nics/features/igb.ini       |  1 +
 doc/guides/nics/features/ixgbe.ini     |  1 +
 doc/guides/rel_notes/deprecation.rst   |  4 ---
 doc/guides/rel_notes/release_17_02.rst |  3 ++
 drivers/net/e1000/igb_ethdev.c         | 54 ++++++++++++++++++++++++++++++++++
 drivers/net/i40e/i40e_ethdev.c         | 31 +++++++++++++++++++
 drivers/net/ixgbe/ixgbe_ethdev.c       | 25 ++++++++++++++++
 examples/ethtool/ethtool-app/ethapp.c  |  1 +
 examples/ethtool/lib/rte_ethtool.c     |  6 ++++
 lib/librte_ether/rte_ethdev.c          | 12 ++++++++
 lib/librte_ether/rte_ethdev.h          | 25 ++++++++++++++++
 lib/librte_ether/rte_ether_version.map |  1 +
 14 files changed, 162 insertions(+), 4 deletions(-)
Signature · 1 line
2.7.4
#87 lore raw

PATCH v6 1/5 ethdev: add firmware version get

This patch adds a new API 'rte_eth_dev_fw_version_get' for fetching firmware version by a given device.

---
 doc/guides/nics/features/default.ini   |  1 +
 doc/guides/rel_notes/deprecation.rst   |  4 ----
 doc/guides/rel_notes/release_17_02.rst |  3 +++
 lib/librte_ether/rte_ethdev.c          | 12 ++++++++++++
 lib/librte_ether/rte_ethdev.h          | 25 +++++++++++++++++++++++++
 lib/librte_ether/rte_ether_version.map |  1 +
 6 files changed, 42 insertions(+), 4 deletions(-)
doc/guides/nics/features/default.ini +1 -0
index f1bf9bf..ae40d57 100644
@@ -50,6 +50,7 @@ Timesync             =
 Basic stats          =
 Extended stats       =
 Stats per queue      =
+FW version           =
 EEPROM dump          =
 Registers dump       =
 Multiprocess aware   =
doc/guides/rel_notes/deprecation.rst +0 -4
index 1438c77..291e03d 100644
@@ -30,10 +30,6 @@ Deprecation Notices
   ``nb_seg_max`` and ``nb_mtu_seg_max`` providing information about number of
   segments limit to be transmitted by device for TSO/non-TSO packets.
 
-* 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.
-
 * ethdev: an API change is planned for 17.02 for the function
   ``_rte_eth_dev_callback_process``. In 17.02 the function will return an ``int``
   instead of ``void`` and a fourth parameter ``void *ret_param`` will be added.
doc/guides/rel_notes/release_17_02.rst +3 -0
index 180af82..260033d 100644
@@ -52,6 +52,9 @@ New Features
   See the :ref:`Generic flow API <Generic_flow_API>` documentation for more
   information.
 
+* **Added firmware version get API.**
+ Added a new function ``rte_eth_dev_fw_version_get()`` to fetch firmware
+ version by a given device.
 
 Resolved Issues
 ---------------
lib/librte_ether/rte_ethdev.c +12 -0
index 9dea1f1..49ca42d 100644
@@ -1588,6 +1588,18 @@ rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id,
 			STAT_QMAP_RX);
 }
 
+int
+rte_eth_dev_fw_version_get(uint8_t port_id, char *fw_version, size_t fw_size)
+{
+	struct rte_eth_dev *dev;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	dev = &rte_eth_devices[port_id];
+
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fw_version_get, -ENOTSUP);
+	return (*dev->dev_ops->fw_version_get)(dev, fw_version, fw_size);
+}
+
 void
 rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)
 {
lib/librte_ether/rte_ethdev.h +25 -0
index 1c356c1..357612d 100644
@@ -1177,6 +1177,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 int (*eth_fw_version_get_t)(struct rte_eth_dev *dev,
+				     char *fw_version, size_t fw_size);
+/**< @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);
 
@@ -1487,6 +1491,7 @@ struct eth_dev_ops {
 	eth_dev_infos_get_t        dev_infos_get; /**< Get device info. */
 	eth_rxq_info_get_t         rxq_info_get; /**< retrieve RX queue information. */
 	eth_txq_info_get_t         txq_info_get; /**< retrieve TX queue information. */
+	eth_fw_version_get_t       fw_version_get; /**< Get firmware version. */
 	eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
 	/**< Get packet types supported and identified by device. */
 
@@ -2430,6 +2435,26 @@ 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_size
+ *   The size of the array pointed by fw_version, which should be
+ *   large enough to store firmware version of the device.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if operation is not supported.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - (-EINVAL) if *fw_size* is not enough to store firmware version.
+ */
+int rte_eth_dev_fw_version_get(uint8_t port_id,
+			       char *fw_version, size_t fw_size);
+
+/**
  * Retrieve the supported packet types of an Ethernet device.
  *
  * When a packet type is announced as supported, it *must* be recognized by
lib/librte_ether/rte_ether_version.map +1 -0
index a021781..0cf94ed 100644
@@ -151,6 +151,7 @@ DPDK_17.02 {
 	global:
 
 	_rte_eth_dev_reset;
+	rte_eth_dev_fw_version_get;
 	rte_flow_create;
 	rte_flow_destroy;
 	rte_flow_flush;
Signature · 1 line
2.7.4
#118 lore raw

PATCH v6 2/5 net/e1000: add firmware version get

In reply to Qiming Yang

This patch adds a new function eth_igb_fw_version_get.

---
 doc/guides/nics/features/igb.ini |  1 +
 drivers/net/e1000/igb_ethdev.c   | 54 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)
doc/guides/nics/features/igb.ini +1 -0
index 9fafe72..26ae008 100644
@@ -35,6 +35,7 @@ Packet type parsing  = Y
 Timesync             = Y
 Basic stats          = Y
 Extended stats       = Y
+FW version           = Y
 EEPROM dump          = Y
 Registers dump       = Y
 BSD nic_uio          = Y
drivers/net/e1000/igb_ethdev.c +54 -0

72 lines not on this page · raw message

Signature · 1 line
2.7.4
#119 lore raw

PATCH v6 3/5 net/ixgbe: add firmware version get

In reply to Qiming Yang

This patch adds a new function ixgbe_fw_version_get.

---
 doc/guides/nics/features/ixgbe.ini |  1 +
 drivers/net/ixgbe/ixgbe_ethdev.c   | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+)
doc/guides/nics/features/ixgbe.ini +1 -0
index 4a5667f..e7104c2 100644
@@ -43,6 +43,7 @@ Timesync             = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
+FW version           = Y
 EEPROM dump          = Y
 Registers dump       = Y
 Multiprocess aware   = Y
drivers/net/ixgbe/ixgbe_ethdev.c +25 -0
index 060772d..a638936 100644
@@ -193,6 +193,8 @@ static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 					     uint16_t queue_id,
 					     uint8_t stat_idx,
 					     uint8_t is_rx);
+static int ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
+				 size_t fw_size);
 static void ixgbe_dev_info_get(struct rte_eth_dev *dev,
 			       struct rte_eth_dev_info *dev_info);
 static const uint32_t *ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev);
@@ -540,6 +542,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
 	.xstats_reset         = ixgbe_dev_xstats_reset,
 	.xstats_get_names     = ixgbe_dev_xstats_get_names,
 	.queue_stats_mapping_set = ixgbe_dev_queue_stats_mapping_set,
+	.fw_version_get       = ixgbe_fw_version_get,
 	.dev_infos_get        = ixgbe_dev_info_get,
 	.dev_supported_ptypes_get = ixgbe_dev_supported_ptypes_get,
 	.mtu_set              = ixgbe_dev_mtu_set,
@@ -3034,6 +3037,28 @@ ixgbevf_dev_stats_reset(struct rte_eth_dev *dev)
 	hw_stats->vfgotc = 0;
 }
 
+static int
+ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u16 eeprom_verh, eeprom_verl;
+	u32 etrack_id;
+
+	if (fw_size < 11) {
+		PMD_DRV_LOG(WARNING, "Insufficient fw version buffer size");
+		return -EINVAL;
+	}
+
+	ixgbe_read_eeprom(hw, 0x2e, &eeprom_verh);
+	ixgbe_read_eeprom(hw, 0x2d, &eeprom_verl);
+
+	etrack_id = (eeprom_verh << 16) | eeprom_verl;
+	snprintf(fw_version, fw_size,
+		 "0x%08x", etrack_id);
+
+	return 0;
+}
+
 static void
 ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
Signature · 1 line
2.7.4
#120 lore raw

PATCH v6 4/5 net/i40e: add firmware version get

In reply to Qiming Yang

This patch add a new function i40e_fw_version_get.

---
 doc/guides/nics/features/i40e.ini |  1 +
 drivers/net/i40e/i40e_ethdev.c    | 31 +++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)
doc/guides/nics/features/i40e.ini +1 -0
index 0d143bc..0dbc3c3 100644
@@ -39,6 +39,7 @@ Packet type parsing  = Y
 Timesync             = Y
 Basic stats          = Y
 Extended stats       = Y
+FW version           = Y
 Multiprocess aware   = Y
 BSD nic_uio          = Y
 Linux UIO            = Y
drivers/net/i40e/i40e_ethdev.c +31 -0
index 0eb4c99..3bf92d1 100644
@@ -324,6 +324,8 @@ static int i40e_dev_queue_stats_mapping_set(struct rte_eth_dev *dev,
 					    uint16_t queue_id,
 					    uint8_t stat_idx,
 					    uint8_t is_rx);
+static int i40e_fw_version_get(struct rte_eth_dev *dev,
+				char *fw_version, size_t fw_size);
 static void i40e_dev_info_get(struct rte_eth_dev *dev,
 			      struct rte_eth_dev_info *dev_info);
 static int i40e_vlan_filter_set(struct rte_eth_dev *dev,
@@ -503,6 +505,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
 	.stats_reset                  = i40e_dev_stats_reset,
 	.xstats_reset                 = i40e_dev_stats_reset,
 	.queue_stats_mapping_set      = i40e_dev_queue_stats_mapping_set,
+	.fw_version_get               = i40e_fw_version_get,
 	.dev_infos_get                = i40e_dev_info_get,
 	.dev_supported_ptypes_get     = i40e_dev_supported_ptypes_get,
 	.vlan_filter_set              = i40e_vlan_filter_set,
@@ -2594,6 +2597,34 @@ i40e_dev_queue_stats_mapping_set(__rte_unused struct rte_eth_dev *dev,
 	return -ENOSYS;
 }
 
+static int
+i40e_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
+{
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u32 full_ver;
+	u8 ver, patch;
+	u16 build;
+
+	if (fw_size < 16) {
+		PMD_DRV_LOG(WARNING, "Insufficient fw version buffer size");
+		return -EINVAL;
+	}
+
+	full_ver = hw->nvm.oem_ver;
+	ver = (u8)(full_ver >> 24);
+	build = (u16)((full_ver >> 8) & 0xffff);
+	patch = (u8)(full_ver & 0xff);
+
+	snprintf(fw_version, fw_size,
+		 "%d.%d%d 0x%08x %d.%d.%d",
+		 ((hw->nvm.version >> 12) & 0xf),
+		 ((hw->nvm.version >> 4) & 0xff),
+		 (hw->nvm.version & 0xf), hw->nvm.eetrack,
+		 ver, build, patch);
+
+	return 0;
+}
+
 static void
 i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
Signature · 1 line
2.7.4
#121 lore raw

PATCH v6 5/5 ethtool: display firmware version

In reply to Qiming Yang

This patch enhances the ethtool example to support to show firmware version, in the same way that the Linux kernel ethtool does.

---
 examples/ethtool/ethtool-app/ethapp.c | 1 +
 examples/ethtool/lib/rte_ethtool.c    | 6 ++++++
 2 files changed, 7 insertions(+)
examples/ethtool/ethtool-app/ethapp.c +1 -0
index 6aeaa06..85c31ac 100644
@@ -185,6 +185,7 @@ pcmd_drvinfo_callback(__rte_unused void *ptr_params,
 		printf("Port %i driver: %s (ver: %s)\n",
 			id_port, info.driver, info.version
 		      );
+		printf("firmware-version: %s\n", info.fw_version);
 	}
 }
 
examples/ethtool/lib/rte_ethtool.c +6 -0
index 6f0ce84..ec7a143 100644
@@ -48,12 +48,18 @@ rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo)
 	struct rte_eth_dev_info dev_info;
 	struct rte_dev_reg_info reg_info;
 	int n;
+	int ret;
 
 	if (drvinfo == NULL)
 		return -EINVAL;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
+	ret = rte_eth_dev_fw_version_get(port_id, drvinfo->fw_version,
+			      sizeof(drvinfo->fw_version));
+	if (ret != 0)
+		printf("firmware version get error: (%s)\n", strerror(-ret));
+
 	memset(&dev_info, 0, sizeof(dev_info));
 	rte_eth_dev_info_get(port_id, &dev_info);
 
Signature · 1 line
2.7.4
#88 lore raw

v7 cover new API 'rte_eth_dev_fw_version_get'

In reply to Qiming Yang

v7: - rebased

v6: - renamed fw_length -> fw_size
- added return value for insufficient fw_size
- fixed the indentation problem in e1000
- added ver.build.patch in i40e, keep the same with Linux kernel driver

v5: - modified the API rte_eth_dev_fw_version_get(uint8_t port_id,
char *fw_version, int fw_length).

v4: - removed deprecation notice
- renamed API as rte_eth_dev_fw_version_get
- splited bus info print from this patch set

v3: - changed API, use rte_eth_dev_fw_info_get(uint8_t port_id,

      uint32_t *fw_major, uint32_t *fw_minor, uint32_t *fw_patch,
      uint32_t *etrack_id)
    - added statusment in /doc/guides/nics/features/default.ini and
      release_17_02.rst

v2: - fixed commit log

Now, the example ethtool can only show the driver information. From customers' point of view, it should be better if we can have the same way that the Linux kernel ethtool does to show firmware version.

These five patches added a new function ``rte_eth_dev_fw_version_get()`` to fetch firmware version related information and implement the display in example ethtool.

Qiming Yang (5):
ethdev: add firmware version get
net/e1000: add firmware version get
net/ixgbe: add firmware version get
net/i40e: add firmware version get
ethtool: display firmware version

 doc/guides/nics/features/default.ini   |  1 +
 doc/guides/nics/features/i40e.ini      |  1 +
 doc/guides/nics/features/igb.ini       |  1 +
 doc/guides/nics/features/ixgbe.ini     |  1 +
 doc/guides/rel_notes/deprecation.rst   |  4 ---
 doc/guides/rel_notes/release_17_02.rst |  5 ++++
 drivers/net/e1000/igb_ethdev.c         | 54 ++++++++++++++++++++++++++++++++++
 drivers/net/i40e/i40e_ethdev.c         | 31 +++++++++++++++++++
 drivers/net/ixgbe/ixgbe_ethdev.c       | 25 ++++++++++++++++
 examples/ethtool/ethtool-app/ethapp.c  |  1 +
 examples/ethtool/lib/rte_ethtool.c     |  6 ++++
 lib/librte_ether/rte_ethdev.c          | 12 ++++++++
 lib/librte_ether/rte_ethdev.h          | 25 ++++++++++++++++
 lib/librte_ether/rte_ether_version.map |  1 +
 14 files changed, 164 insertions(+), 4 deletions(-)
Signature · 1 line
2.7.4
#89 lore raw

PATCH v7 1/5 ethdev: add firmware version get

This patch adds a new API 'rte_eth_dev_fw_version_get' for fetching firmware version by a given device.

---
 doc/guides/nics/features/default.ini   |  1 +
 doc/guides/rel_notes/deprecation.rst   |  4 ----
 doc/guides/rel_notes/release_17_02.rst |  5 +++++
 lib/librte_ether/rte_ethdev.c          | 12 ++++++++++++
 lib/librte_ether/rte_ethdev.h          | 25 +++++++++++++++++++++++++
 lib/librte_ether/rte_ether_version.map |  1 +
 6 files changed, 44 insertions(+), 4 deletions(-)
doc/guides/nics/features/default.ini +1 -0
index f1bf9bf..ae40d57 100644
@@ -50,6 +50,7 @@ Timesync             =
 Basic stats          =
 Extended stats       =
 Stats per queue      =
+FW version           =
 EEPROM dump          =
 Registers dump       =
 Multiprocess aware   =
doc/guides/rel_notes/deprecation.rst +0 -4
index 054e2e7..755dc65 100644
@@ -30,10 +30,6 @@ Deprecation Notices
   ``nb_seg_max`` and ``nb_mtu_seg_max`` providing information about number of
   segments limit to be transmitted by device for TSO/non-TSO packets.
 
-* 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.
-
 * ethdev: an API change is planned for 17.02 for the function
   ``_rte_eth_dev_callback_process``. In 17.02 the function will return an ``int``
   instead of ``void`` and a fourth parameter ``void *ret_param`` will be added.
doc/guides/rel_notes/release_17_02.rst +5 -0
index 5762d3f..f9134bb 100644
@@ -66,6 +66,11 @@ New Features
   Support for Mellanox ConnectX-5 family of 10/25/40/50/100 Gbps adapters
   has been added to the existing mlx5 PMD.
 
+* **Added firmware version get API.**
+
+  Added a new function ``rte_eth_dev_fw_version_get()`` to fetch firmware
+  version by a given device.
+
 Resolved Issues
 ---------------
 
lib/librte_ether/rte_ethdev.c +12 -0
index 917557a..89cffcf 100644
@@ -1588,6 +1588,18 @@ rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id,
 			STAT_QMAP_RX);
 }
 
+int
+rte_eth_dev_fw_version_get(uint8_t port_id, char *fw_version, size_t fw_size)
+{
+	struct rte_eth_dev *dev;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	dev = &rte_eth_devices[port_id];
+
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fw_version_get, -ENOTSUP);
+	return (*dev->dev_ops->fw_version_get)(dev, fw_version, fw_size);
+}
+
 void
 rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)
 {
lib/librte_ether/rte_ethdev.h +25 -0
index ded43d7..a9b3686 100644
@@ -1177,6 +1177,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 int (*eth_fw_version_get_t)(struct rte_eth_dev *dev,
+				     char *fw_version, size_t fw_size);
+/**< @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);
 
@@ -1459,6 +1463,7 @@ struct eth_dev_ops {
 	eth_dev_infos_get_t        dev_infos_get; /**< Get device info. */
 	eth_rxq_info_get_t         rxq_info_get; /**< retrieve RX queue information. */
 	eth_txq_info_get_t         txq_info_get; /**< retrieve TX queue information. */
+	eth_fw_version_get_t       fw_version_get; /**< Get firmware version. */
 	eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
 	/**< Get packet types supported and identified by device. */
 
@@ -2396,6 +2401,26 @@ 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_size
+ *   The size of the array pointed by fw_version, which should be
+ *   large enough to store firmware version of the device.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if operation is not supported.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - (-EINVAL) if *fw_size* is not enough to store firmware version.
+ */
+int rte_eth_dev_fw_version_get(uint8_t port_id,
+			       char *fw_version, size_t fw_size);
+
+/**
  * Retrieve the supported packet types of an Ethernet device.
  *
  * When a packet type is announced as supported, it *must* be recognized by
lib/librte_ether/rte_ether_version.map +1 -0
index 0c2859e..c6c9d0d 100644
@@ -146,6 +146,7 @@ DPDK_17.02 {
 	global:
 
 	_rte_eth_dev_reset;
+	rte_eth_dev_fw_version_get;
 	rte_flow_create;
 	rte_flow_destroy;
 	rte_flow_flush;
Signature · 1 line
2.7.4
#90 lore raw

PATCH v7 2/5 net/e1000: add firmware version get

In reply to Qiming Yang

This patch adds a new function eth_igb_fw_version_get.

---
 doc/guides/nics/features/igb.ini |  1 +
 drivers/net/e1000/igb_ethdev.c   | 54 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)
doc/guides/nics/features/igb.ini +1 -0
index 9fafe72..26ae008 100644
@@ -35,6 +35,7 @@ Packet type parsing  = Y
 Timesync             = Y
 Basic stats          = Y
 Extended stats       = Y
+FW version           = Y
 EEPROM dump          = Y
 Registers dump       = Y
 BSD nic_uio          = Y
drivers/net/e1000/igb_ethdev.c +54 -0

72 lines not on this page · raw message

Signature · 1 line
2.7.4
#93 lore raw

PATCH v7 3/5 net/ixgbe: add firmware version get

In reply to Qiming Yang

This patch adds a new function ixgbe_fw_version_get.

---
 doc/guides/nics/features/ixgbe.ini |  1 +
 drivers/net/ixgbe/ixgbe_ethdev.c   | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+)
doc/guides/nics/features/ixgbe.ini +1 -0
index 4a5667f..e7104c2 100644
@@ -43,6 +43,7 @@ Timesync             = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
+FW version           = Y
 EEPROM dump          = Y
 Registers dump       = Y
 Multiprocess aware   = Y
drivers/net/ixgbe/ixgbe_ethdev.c +25 -0
index b7ddd4f..a09db78 100644
@@ -193,6 +193,8 @@ static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 					     uint16_t queue_id,
 					     uint8_t stat_idx,
 					     uint8_t is_rx);
+static int ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
+				 size_t fw_size);
 static void ixgbe_dev_info_get(struct rte_eth_dev *dev,
 			       struct rte_eth_dev_info *dev_info);
 static const uint32_t *ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev);
@@ -532,6 +534,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
 	.xstats_reset         = ixgbe_dev_xstats_reset,
 	.xstats_get_names     = ixgbe_dev_xstats_get_names,
 	.queue_stats_mapping_set = ixgbe_dev_queue_stats_mapping_set,
+	.fw_version_get       = ixgbe_fw_version_get,
 	.dev_infos_get        = ixgbe_dev_info_get,
 	.dev_supported_ptypes_get = ixgbe_dev_supported_ptypes_get,
 	.mtu_set              = ixgbe_dev_mtu_set,
@@ -3022,6 +3025,28 @@ ixgbevf_dev_stats_reset(struct rte_eth_dev *dev)
 	hw_stats->vfgotc = 0;
 }
 
+static int
+ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u16 eeprom_verh, eeprom_verl;
+	u32 etrack_id;
+
+	if (fw_size < 11) {
+		PMD_DRV_LOG(WARNING, "Insufficient fw version buffer size");
+		return -EINVAL;
+	}
+
+	ixgbe_read_eeprom(hw, 0x2e, &eeprom_verh);
+	ixgbe_read_eeprom(hw, 0x2d, &eeprom_verl);
+
+	etrack_id = (eeprom_verh << 16) | eeprom_verl;
+	snprintf(fw_version, fw_size,
+		 "0x%08x", etrack_id);
+
+	return 0;
+}
+
 static void
 ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
Signature · 1 line
2.7.4
#94 lore raw

PATCH v7 4/5 net/i40e: add firmware version get

In reply to Qiming Yang

This patch add a new function i40e_fw_version_get.

---
 doc/guides/nics/features/i40e.ini |  1 +
 drivers/net/i40e/i40e_ethdev.c    | 31 +++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)
doc/guides/nics/features/i40e.ini +1 -0
index 0d143bc..0dbc3c3 100644
@@ -39,6 +39,7 @@ Packet type parsing  = Y
 Timesync             = Y
 Basic stats          = Y
 Extended stats       = Y
+FW version           = Y
 Multiprocess aware   = Y
 BSD nic_uio          = Y
 Linux UIO            = Y
drivers/net/i40e/i40e_ethdev.c +31 -0
index 46def56..713f653 100644
@@ -266,6 +266,8 @@ static int i40e_dev_queue_stats_mapping_set(struct rte_eth_dev *dev,
 					    uint16_t queue_id,
 					    uint8_t stat_idx,
 					    uint8_t is_rx);
+static int i40e_fw_version_get(struct rte_eth_dev *dev,
+				char *fw_version, size_t fw_size);
 static void i40e_dev_info_get(struct rte_eth_dev *dev,
 			      struct rte_eth_dev_info *dev_info);
 static int i40e_vlan_filter_set(struct rte_eth_dev *dev,
@@ -458,6 +460,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
 	.stats_reset                  = i40e_dev_stats_reset,
 	.xstats_reset                 = i40e_dev_stats_reset,
 	.queue_stats_mapping_set      = i40e_dev_queue_stats_mapping_set,
+	.fw_version_get               = i40e_fw_version_get,
 	.dev_infos_get                = i40e_dev_info_get,
 	.dev_supported_ptypes_get     = i40e_dev_supported_ptypes_get,
 	.vlan_filter_set              = i40e_vlan_filter_set,
@@ -2770,6 +2773,34 @@ i40e_dev_queue_stats_mapping_set(__rte_unused struct rte_eth_dev *dev,
 	return -ENOSYS;
 }
 
+static int
+i40e_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
+{
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u32 full_ver;
+	u8 ver, patch;
+	u16 build;
+
+	if (fw_size < 16) {
+		PMD_DRV_LOG(WARNING, "Insufficient fw version buffer size");
+		return -EINVAL;
+	}
+
+	full_ver = hw->nvm.oem_ver;
+	ver = (u8)(full_ver >> 24);
+	build = (u16)((full_ver >> 8) & 0xffff);
+	patch = (u8)(full_ver & 0xff);
+
+	snprintf(fw_version, fw_size,
+		 "%d.%d%d 0x%08x %d.%d.%d",
+		 ((hw->nvm.version >> 12) & 0xf),
+		 ((hw->nvm.version >> 4) & 0xff),
+		 (hw->nvm.version & 0xf), hw->nvm.eetrack,
+		 ver, build, patch);
+
+	return 0;
+}
+
 static void
 i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
Signature · 1 line
2.7.4
#95 lore raw

PATCH v7 5/5 ethtool: display firmware version

In reply to Qiming Yang

This patch enhances the ethtool example to support to show firmware version, in the same way that the Linux kernel ethtool does.

---
 examples/ethtool/ethtool-app/ethapp.c | 1 +
 examples/ethtool/lib/rte_ethtool.c    | 6 ++++++
 2 files changed, 7 insertions(+)
examples/ethtool/ethtool-app/ethapp.c +1 -0
index 6aeaa06..85c31ac 100644
@@ -185,6 +185,7 @@ pcmd_drvinfo_callback(__rte_unused void *ptr_params,
 		printf("Port %i driver: %s (ver: %s)\n",
 			id_port, info.driver, info.version
 		      );
+		printf("firmware-version: %s\n", info.fw_version);
 	}
 }
 
examples/ethtool/lib/rte_ethtool.c +6 -0
index b1f159e..33d38a7 100644
@@ -51,12 +51,18 @@ rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo)
 	struct rte_eth_dev_info dev_info;
 	struct rte_dev_reg_info reg_info;
 	int n;
+	int ret;
 
 	if (drvinfo == NULL)
 		return -EINVAL;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
+	ret = rte_eth_dev_fw_version_get(port_id, drvinfo->fw_version,
+			      sizeof(drvinfo->fw_version));
+	if (ret != 0)
+		printf("firmware version get error: (%s)\n", strerror(-ret));
+
 	memset(&dev_info, 0, sizeof(dev_info));
 	rte_eth_dev_info_get(port_id, &dev_info);
 
Signature · 1 line
2.7.4
#91 lore raw

Re: [PATCH v7 2/5] net/e1000: add firmware version get

In reply to Qiming Yang
Quoted 3 lines · Qiming Yang

This patch adds a new function eth_igb_fw_version_get.

[..]

drivers/net/e1000/igb_ethdev.c eth_igbvf_stats_reset(struct rte_eth_dev *dev) · line 1997

Quoted 8 lines
drivers/net/e1000/igb_ethdev.c +8 -0
+static int
+eth_igb_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
+		       size_t fw_size)
+{
+	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct e1000_fw_version fw;
+
+	if (fw_size < 16) {

Magic number. Ought to be #define value (or at least a comment explaining the choice of size)..

Otherwise looking good.. :)

..Remy

#92 lore raw

Re: [PATCH v7 2/5] net/e1000: add firmware version get

-----Original Message-----
From: Horton, Remy
Sent: Wednesday, January 11, 2017 11:45 PM
To: Yang, Qiming <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>
Subject: Re: [PATCH v7 2/5] net/e1000: add firmware version get

Quoted 3 lines · Qiming Yang

This patch adds a new function eth_igb_fw_version_get.

[..]

drivers/net/e1000/igb_ethdev.c eth_igbvf_stats_reset(struct rte_eth_dev *dev) · line 1997

Quoted 8 lines
drivers/net/e1000/igb_ethdev.c +8 -0
+static int
+eth_igb_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
+		       size_t fw_size)
+{
+	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct e1000_fw_version fw;
+
+	if (fw_size < 16) {

Magic number. Ought to be #define value (or at least a comment explaining the choice of size)..

Otherwise looking good.. :)

..Remy

Ok, I'll use a macro to define this number. Thanks~ Qiming

#96 lore raw

v8 cover new API 'rte_eth_dev_fw_version_get'

In reply to Qiming Yang

v8: - defined the minimum fw version size as a macro.

v7: - rebased

v6: - renamed fw_length -> fw_size
- added return value for insufficient fw_size
- fixed the indentation problem in e1000
- added ver.build.patch in i40e, keep the same with Linux kernel driver

v5: - modified the API rte_eth_dev_fw_version_get(uint8_t port_id,
char *fw_version, int fw_length).

v4: - removed deprecation notice
- renamed API as rte_eth_dev_fw_version_get
- splited bus info print from this patch set

v3: - changed API, use rte_eth_dev_fw_info_get(uint8_t port_id,

      uint32_t *fw_major, uint32_t *fw_minor, uint32_t *fw_patch,
      uint32_t *etrack_id)
    - added statusment in /doc/guides/nics/features/default.ini and
      release_17_02.rst

v2: - fixed commit log

Now, the example ethtool can only show the driver information. From customers' point of view, it should be better if we can have the same way that the Linux kernel ethtool does to show firmware version.

These five patches added a new function ``rte_eth_dev_fw_version_get()`` to fetch firmware version related information and implement the display in example ethtool.

Qiming Yang (5):
ethdev: add firmware version get
net/e1000: add firmware version get
net/ixgbe: add firmware version get
net/i40e: add firmware version get
ethtool: display firmware version

 doc/guides/nics/features/default.ini   |  1 +
 doc/guides/nics/features/i40e.ini      |  1 +
 doc/guides/nics/features/igb.ini       |  1 +
 doc/guides/nics/features/ixgbe.ini     |  1 +
 doc/guides/rel_notes/deprecation.rst   |  4 ---
 doc/guides/rel_notes/release_17_02.rst |  5 +++
 drivers/net/e1000/igb_ethdev.c         | 56 ++++++++++++++++++++++++++++++++++
 drivers/net/i40e/i40e_ethdev.c         | 33 ++++++++++++++++++++
 drivers/net/ixgbe/ixgbe_ethdev.c       | 26 ++++++++++++++++
 examples/ethtool/ethtool-app/ethapp.c  |  1 +
 examples/ethtool/lib/rte_ethtool.c     |  6 ++++
 lib/librte_ether/rte_ethdev.c          | 12 ++++++++
 lib/librte_ether/rte_ethdev.h          | 25 +++++++++++++++
 lib/librte_ether/rte_ether_version.map |  1 +
 14 files changed, 169 insertions(+), 4 deletions(-)
Signature · 1 line
2.7.4
#97 lore raw

PATCH v8 1/5 ethdev: add firmware version get

This patch adds a new API 'rte_eth_dev_fw_version_get' for fetching firmware version by a given device.

---
 doc/guides/nics/features/default.ini   |  1 +
 doc/guides/rel_notes/deprecation.rst   |  4 ----
 doc/guides/rel_notes/release_17_02.rst |  5 +++++
 lib/librte_ether/rte_ethdev.c          | 12 ++++++++++++
 lib/librte_ether/rte_ethdev.h          | 25 +++++++++++++++++++++++++
 lib/librte_ether/rte_ether_version.map |  1 +
 6 files changed, 44 insertions(+), 4 deletions(-)
doc/guides/nics/features/default.ini +1 -0
index f1bf9bf..ae40d57 100644
@@ -50,6 +50,7 @@ Timesync             =
 Basic stats          =
 Extended stats       =
 Stats per queue      =
+FW version           =
 EEPROM dump          =
 Registers dump       =
 Multiprocess aware   =
doc/guides/rel_notes/deprecation.rst +0 -4
index 054e2e7..755dc65 100644
@@ -30,10 +30,6 @@ Deprecation Notices
   ``nb_seg_max`` and ``nb_mtu_seg_max`` providing information about number of
   segments limit to be transmitted by device for TSO/non-TSO packets.
 
-* 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.
-
 * ethdev: an API change is planned for 17.02 for the function
   ``_rte_eth_dev_callback_process``. In 17.02 the function will return an ``int``
   instead of ``void`` and a fourth parameter ``void *ret_param`` will be added.
doc/guides/rel_notes/release_17_02.rst +5 -0
index 5762d3f..f9134bb 100644
@@ -66,6 +66,11 @@ New Features
   Support for Mellanox ConnectX-5 family of 10/25/40/50/100 Gbps adapters
   has been added to the existing mlx5 PMD.
 
+* **Added firmware version get API.**
+
+  Added a new function ``rte_eth_dev_fw_version_get()`` to fetch firmware
+  version by a given device.
+
 Resolved Issues
 ---------------
 
lib/librte_ether/rte_ethdev.c +12 -0
index 917557a..89cffcf 100644
@@ -1588,6 +1588,18 @@ rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id,
 			STAT_QMAP_RX);
 }
 
+int
+rte_eth_dev_fw_version_get(uint8_t port_id, char *fw_version, size_t fw_size)
+{
+	struct rte_eth_dev *dev;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	dev = &rte_eth_devices[port_id];
+
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fw_version_get, -ENOTSUP);
+	return (*dev->dev_ops->fw_version_get)(dev, fw_version, fw_size);
+}
+
 void
 rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)
 {
lib/librte_ether/rte_ethdev.h +25 -0
index ded43d7..a9b3686 100644
@@ -1177,6 +1177,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 int (*eth_fw_version_get_t)(struct rte_eth_dev *dev,
+				     char *fw_version, size_t fw_size);
+/**< @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);
 
@@ -1459,6 +1463,7 @@ struct eth_dev_ops {
 	eth_dev_infos_get_t        dev_infos_get; /**< Get device info. */
 	eth_rxq_info_get_t         rxq_info_get; /**< retrieve RX queue information. */
 	eth_txq_info_get_t         txq_info_get; /**< retrieve TX queue information. */
+	eth_fw_version_get_t       fw_version_get; /**< Get firmware version. */
 	eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
 	/**< Get packet types supported and identified by device. */
 
@@ -2396,6 +2401,26 @@ 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_size
+ *   The size of the array pointed by fw_version, which should be
+ *   large enough to store firmware version of the device.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if operation is not supported.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - (-EINVAL) if *fw_size* is not enough to store firmware version.
+ */
+int rte_eth_dev_fw_version_get(uint8_t port_id,
+			       char *fw_version, size_t fw_size);
+
+/**
  * Retrieve the supported packet types of an Ethernet device.
  *
  * When a packet type is announced as supported, it *must* be recognized by
lib/librte_ether/rte_ether_version.map +1 -0
index 0c2859e..c6c9d0d 100644
@@ -146,6 +146,7 @@ DPDK_17.02 {
 	global:
 
 	_rte_eth_dev_reset;
+	rte_eth_dev_fw_version_get;
 	rte_flow_create;
 	rte_flow_destroy;
 	rte_flow_flush;
Signature · 1 line
2.7.4
#114 lore raw

PATCH v8 2/5 net/e1000: add firmware version get

In reply to Qiming Yang

This patch adds a new function eth_igb_fw_version_get.

---
 doc/guides/nics/features/igb.ini |  1 +
 drivers/net/e1000/igb_ethdev.c   | 56 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+)
doc/guides/nics/features/igb.ini +1 -0
index 9fafe72..26ae008 100644
@@ -35,6 +35,7 @@ Packet type parsing  = Y
 Timesync             = Y
 Basic stats          = Y
 Extended stats       = Y
+FW version           = Y
 EEPROM dump          = Y
 Registers dump       = Y
 BSD nic_uio          = Y
drivers/net/e1000/igb_ethdev.c +56 -0

80 lines not on this page · raw message

Signature · 1 line
2.7.4
#115 lore raw

PATCH v8 3/5 net/ixgbe: add firmware version get

In reply to Qiming Yang

This patch adds a new function ixgbe_fw_version_get.

---
 doc/guides/nics/features/ixgbe.ini |  1 +
 drivers/net/ixgbe/ixgbe_ethdev.c   | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+)
doc/guides/nics/features/ixgbe.ini +1 -0
index 4a5667f..e7104c2 100644
@@ -43,6 +43,7 @@ Timesync             = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
+FW version           = Y
 EEPROM dump          = Y
 Registers dump       = Y
 Multiprocess aware   = Y
drivers/net/ixgbe/ixgbe_ethdev.c +26 -0
index b7ddd4f..2363eb4 100644
@@ -163,6 +163,7 @@ enum ixgbevf_xcast_modes {
 #define IXGBE_EXVET_VET_EXT_SHIFT              16
 #define IXGBE_DMATXCTL_VT_MASK                 0xFFFF0000
 
+#define IXGBE_MIN_FW_VERSION_SIZE              11
 static int eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev);
 static int eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev);
 static int  ixgbe_dev_configure(struct rte_eth_dev *dev);
@@ -193,6 +194,8 @@ static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 					     uint16_t queue_id,
 					     uint8_t stat_idx,
 					     uint8_t is_rx);
+static int ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
+				 size_t fw_size);
 static void ixgbe_dev_info_get(struct rte_eth_dev *dev,
 			       struct rte_eth_dev_info *dev_info);
 static const uint32_t *ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev);
@@ -532,6 +535,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
 	.xstats_reset         = ixgbe_dev_xstats_reset,
 	.xstats_get_names     = ixgbe_dev_xstats_get_names,
 	.queue_stats_mapping_set = ixgbe_dev_queue_stats_mapping_set,
+	.fw_version_get       = ixgbe_fw_version_get,
 	.dev_infos_get        = ixgbe_dev_info_get,
 	.dev_supported_ptypes_get = ixgbe_dev_supported_ptypes_get,
 	.mtu_set              = ixgbe_dev_mtu_set,
@@ -3022,6 +3026,28 @@ ixgbevf_dev_stats_reset(struct rte_eth_dev *dev)
 	hw_stats->vfgotc = 0;
 }
 
+static int
+ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u16 eeprom_verh, eeprom_verl;
+	u32 etrack_id;
+
+	if (fw_size < IXGBE_MIN_FW_VERSION_SIZE) {
+		PMD_DRV_LOG(WARNING, "Insufficient fw version buffer size");
+		return -EINVAL;
+	}
+
+	ixgbe_read_eeprom(hw, 0x2e, &eeprom_verh);
+	ixgbe_read_eeprom(hw, 0x2d, &eeprom_verl);
+
+	etrack_id = (eeprom_verh << 16) | eeprom_verl;
+	snprintf(fw_version, fw_size,
+		 "0x%08x", etrack_id);
+
+	return 0;
+}
+
 static void
 ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
Signature · 1 line
2.7.4
#116 lore raw

PATCH v8 4/5 net/i40e: add firmware version get

In reply to Qiming Yang

This patch add a new function i40e_fw_version_get.

---
 doc/guides/nics/features/i40e.ini |  1 +
 drivers/net/i40e/i40e_ethdev.c    | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)
doc/guides/nics/features/i40e.ini +1 -0
index 0d143bc..0dbc3c3 100644
@@ -39,6 +39,7 @@ Packet type parsing  = Y
 Timesync             = Y
 Basic stats          = Y
 Extended stats       = Y
+FW version           = Y
 Multiprocess aware   = Y
 BSD nic_uio          = Y
 Linux UIO            = Y
drivers/net/i40e/i40e_ethdev.c +33 -0
index 46def56..81a9f1d 100644
@@ -231,6 +231,8 @@
 #define I40E_INSET_IPV6_HOP_LIMIT_MASK  0x000CFF00UL
 #define I40E_INSET_IPV6_NEXT_HDR_MASK   0x000C00FFUL
 
+#define I40E_MIN_FW_VERSION_SIZE        16
+
 /* PCI offset for querying capability */
 #define PCI_DEV_CAP_REG            0xA4
 /* PCI offset for enabling/disabling Extended Tag */
@@ -266,6 +268,8 @@ static int i40e_dev_queue_stats_mapping_set(struct rte_eth_dev *dev,
 					    uint16_t queue_id,
 					    uint8_t stat_idx,
 					    uint8_t is_rx);
+static int i40e_fw_version_get(struct rte_eth_dev *dev,
+				char *fw_version, size_t fw_size);
 static void i40e_dev_info_get(struct rte_eth_dev *dev,
 			      struct rte_eth_dev_info *dev_info);
 static int i40e_vlan_filter_set(struct rte_eth_dev *dev,
@@ -458,6 +462,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
 	.stats_reset                  = i40e_dev_stats_reset,
 	.xstats_reset                 = i40e_dev_stats_reset,
 	.queue_stats_mapping_set      = i40e_dev_queue_stats_mapping_set,
+	.fw_version_get               = i40e_fw_version_get,
 	.dev_infos_get                = i40e_dev_info_get,
 	.dev_supported_ptypes_get     = i40e_dev_supported_ptypes_get,
 	.vlan_filter_set              = i40e_vlan_filter_set,
@@ -2770,6 +2775,34 @@ i40e_dev_queue_stats_mapping_set(__rte_unused struct rte_eth_dev *dev,
 	return -ENOSYS;
 }
 
+static int
+i40e_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
+{
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u32 full_ver;
+	u8 ver, patch;
+	u16 build;
+
+	if (fw_size < I40E_MIN_FW_VERSION_SIZE) {
+		PMD_DRV_LOG(WARNING, "Insufficient fw version buffer size");
+		return -EINVAL;
+	}
+
+	full_ver = hw->nvm.oem_ver;
+	ver = (u8)(full_ver >> 24);
+	build = (u16)((full_ver >> 8) & 0xffff);
+	patch = (u8)(full_ver & 0xff);
+
+	snprintf(fw_version, fw_size,
+		 "%d.%d%d 0x%08x %d.%d.%d",
+		 ((hw->nvm.version >> 12) & 0xf),
+		 ((hw->nvm.version >> 4) & 0xff),
+		 (hw->nvm.version & 0xf), hw->nvm.eetrack,
+		 ver, build, patch);
+
+	return 0;
+}
+
 static void
 i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
Signature · 1 line
2.7.4
#117 lore raw

PATCH v8 5/5 ethtool: display firmware version

In reply to Qiming Yang

This patch enhances the ethtool example to support to show firmware version, in the same way that the Linux kernel ethtool does.

---
 examples/ethtool/ethtool-app/ethapp.c | 1 +
 examples/ethtool/lib/rte_ethtool.c    | 6 ++++++
 2 files changed, 7 insertions(+)
examples/ethtool/ethtool-app/ethapp.c +1 -0
index 6aeaa06..85c31ac 100644
@@ -185,6 +185,7 @@ pcmd_drvinfo_callback(__rte_unused void *ptr_params,
 		printf("Port %i driver: %s (ver: %s)\n",
 			id_port, info.driver, info.version
 		      );
+		printf("firmware-version: %s\n", info.fw_version);
 	}
 }
 
examples/ethtool/lib/rte_ethtool.c +6 -0
index b1f159e..33d38a7 100644
@@ -51,12 +51,18 @@ rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo)
 	struct rte_eth_dev_info dev_info;
 	struct rte_dev_reg_info reg_info;
 	int n;
+	int ret;
 
 	if (drvinfo == NULL)
 		return -EINVAL;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
+	ret = rte_eth_dev_fw_version_get(port_id, drvinfo->fw_version,
+			      sizeof(drvinfo->fw_version));
+	if (ret != 0)
+		printf("firmware version get error: (%s)\n", strerror(-ret));
+
 	memset(&dev_info, 0, sizeof(dev_info));
 	rte_eth_dev_info_get(port_id, &dev_info);
 
Signature · 1 line
2.7.4
#98 lore raw

Re: [PATCH v8 1/5] ethdev: add firmware version get

In reply to Qiming Yang

2017-01-12 14:31, Qiming Yang:

lib/librte_ether/rte_ethdev.h void rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr); · line 2422

Quoted 12 lines

+ * @param fw_size
+ * The size of the array pointed by fw_version, which should be
+ * large enough to store firmware version of the device.
+ * @return

+ *   - (0) if successful.
+ *   - (-ENOTSUP) if operation is not supported.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - (-EINVAL) if *fw_size* is not enough to store firmware version.

+ */

lib/librte_ether/rte_ethdev.h +3 -0
+int rte_eth_dev_fw_version_get(uint8_t port_id,
+                              char *fw_version, size_t fw_size);
+

How to know the required size?
You should return the size of the non truncated string as snprintf does.
Note: Andrew Rybchenko already commented on it and you didn't reply.

#99 lore raw

v9 cover new API 'rte_eth_dev_fw_version_get'

In reply to Qiming Yang

v9: - when fw_size is insufficient, return the size of the non truncated
string as snprintf does.

v8: - defined the minimum fw version size as a macro.

v7: - rebased

v6: - renamed fw_length -> fw_size
- added return value for insufficient fw_size
- fixed the indentation problem in e1000
- added ver.build.patch in i40e, keep the same with Linux kernel driver

v5: - modified the API rte_eth_dev_fw_version_get(uint8_t port_id,
char *fw_version, int fw_length).

v4: - removed deprecation notice
- renamed API as rte_eth_dev_fw_version_get
- splited bus info print from this patch set

v3: - changed API, use rte_eth_dev_fw_info_get(uint8_t port_id,

      uint32_t *fw_major, uint32_t *fw_minor, uint32_t *fw_patch,
      uint32_t *etrack_id)
    - added statusment in /doc/guides/nics/features/default.ini and
      release_17_02.rst

v2: - fixed commit log

Now, the example ethtool can only show the driver information. From customers' point of view, it should be better if we can have the same way that the Linux kernel ethtool does to show firmware version.

These five patches added a new function ``rte_eth_dev_fw_version_get()`` to fetch firmware version related information and implement the display in example ethtool.

Qiming Yang (5):
ethdev: add firmware version get
net/e1000: add firmware version get
net/ixgbe: add firmware version get
net/i40e: add firmware version get
ethtool: display firmware version

 doc/guides/nics/features/default.ini   |  1 +
 doc/guides/nics/features/i40e.ini      |  1 +
 doc/guides/nics/features/igb.ini       |  1 +
 doc/guides/nics/features/ixgbe.ini     |  1 +
 doc/guides/rel_notes/deprecation.rst   |  4 ---
 doc/guides/rel_notes/release_17_02.rst |  5 +++
 drivers/net/e1000/igb_ethdev.c         | 56 ++++++++++++++++++++++++++++++++++
 drivers/net/i40e/i40e_ethdev.c         | 32 +++++++++++++++++++
 drivers/net/ixgbe/ixgbe_ethdev.c       | 25 +++++++++++++++
 examples/ethtool/ethtool-app/ethapp.c  |  1 +
 examples/ethtool/lib/rte_ethtool.c     |  9 ++++++
 lib/librte_ether/rte_ethdev.c          | 12 ++++++++
 lib/librte_ether/rte_ethdev.h          | 26 ++++++++++++++++
 lib/librte_ether/rte_ether_version.map |  1 +
 14 files changed, 171 insertions(+), 4 deletions(-)
Signature · 1 line
2.7.4
#100 lore raw

PATCH v9 1/5 ethdev: add firmware version get

This patch adds a new API 'rte_eth_dev_fw_version_get' for fetching firmware version by a given device.

---
 doc/guides/nics/features/default.ini   |  1 +
 doc/guides/rel_notes/deprecation.rst   |  4 ----
 doc/guides/rel_notes/release_17_02.rst |  5 +++++
 lib/librte_ether/rte_ethdev.c          | 12 ++++++++++++
 lib/librte_ether/rte_ethdev.h          | 26 ++++++++++++++++++++++++++
 lib/librte_ether/rte_ether_version.map |  1 +
 6 files changed, 45 insertions(+), 4 deletions(-)
doc/guides/nics/features/default.ini +1 -0
index f1bf9bf..ae40d57 100644
@@ -50,6 +50,7 @@ Timesync             =
 Basic stats          =
 Extended stats       =
 Stats per queue      =
+FW version           =
 EEPROM dump          =
 Registers dump       =
 Multiprocess aware   =
doc/guides/rel_notes/deprecation.rst +0 -4
index 054e2e7..755dc65 100644
@@ -30,10 +30,6 @@ Deprecation Notices
   ``nb_seg_max`` and ``nb_mtu_seg_max`` providing information about number of
   segments limit to be transmitted by device for TSO/non-TSO packets.
 
-* 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.
-
 * ethdev: an API change is planned for 17.02 for the function
   ``_rte_eth_dev_callback_process``. In 17.02 the function will return an ``int``
   instead of ``void`` and a fourth parameter ``void *ret_param`` will be added.
doc/guides/rel_notes/release_17_02.rst +5 -0
index 5762d3f..f9134bb 100644
@@ -66,6 +66,11 @@ New Features
   Support for Mellanox ConnectX-5 family of 10/25/40/50/100 Gbps adapters
   has been added to the existing mlx5 PMD.
 
+* **Added firmware version get API.**
+
+  Added a new function ``rte_eth_dev_fw_version_get()`` to fetch firmware
+  version by a given device.
+
 Resolved Issues
 ---------------
 
lib/librte_ether/rte_ethdev.c +12 -0
index 917557a..89cffcf 100644
@@ -1588,6 +1588,18 @@ rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id,
 			STAT_QMAP_RX);
 }
 
+int
+rte_eth_dev_fw_version_get(uint8_t port_id, char *fw_version, size_t fw_size)
+{
+	struct rte_eth_dev *dev;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	dev = &rte_eth_devices[port_id];
+
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fw_version_get, -ENOTSUP);
+	return (*dev->dev_ops->fw_version_get)(dev, fw_version, fw_size);
+}
+
 void
 rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)
 {
lib/librte_ether/rte_ethdev.h +26 -0
index ded43d7..37a55ef 100644
@@ -1177,6 +1177,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 int (*eth_fw_version_get_t)(struct rte_eth_dev *dev,
+				     char *fw_version, size_t fw_size);
+/**< @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);
 
@@ -1459,6 +1463,7 @@ struct eth_dev_ops {
 	eth_dev_infos_get_t        dev_infos_get; /**< Get device info. */
 	eth_rxq_info_get_t         rxq_info_get; /**< retrieve RX queue information. */
 	eth_txq_info_get_t         txq_info_get; /**< retrieve TX queue information. */
+	eth_fw_version_get_t       fw_version_get; /**< Get firmware version. */
 	eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
 	/**< Get packet types supported and identified by device. */
 
@@ -2396,6 +2401,27 @@ 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_size
+ *   The size of the array pointed by fw_version, which should be
+ *   large enough to store firmware version of the device.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if operation is not supported.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - (>0) if *fw_size* is not enough to store firmware version, return
+ *          the size of the non truncated string.
+ */
+int rte_eth_dev_fw_version_get(uint8_t port_id,
+			       char *fw_version, size_t fw_size);
+
+/**
  * Retrieve the supported packet types of an Ethernet device.
  *
  * When a packet type is announced as supported, it *must* be recognized by
lib/librte_ether/rte_ether_version.map +1 -0
index 0c2859e..c6c9d0d 100644
@@ -146,6 +146,7 @@ DPDK_17.02 {
 	global:
 
 	_rte_eth_dev_reset;
+	rte_eth_dev_fw_version_get;
 	rte_flow_create;
 	rte_flow_destroy;
 	rte_flow_flush;
Signature · 1 line
2.7.4
#103 lore raw

PATCH v9 2/5 net/e1000: add firmware version get

In reply to Qiming Yang

This patch adds a new function eth_igb_fw_version_get.

---
 doc/guides/nics/features/igb.ini |  1 +
 drivers/net/e1000/igb_ethdev.c   | 56 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+)
doc/guides/nics/features/igb.ini +1 -0
index 9fafe72..26ae008 100644
@@ -35,6 +35,7 @@ Packet type parsing  = Y
 Timesync             = Y
 Basic stats          = Y
 Extended stats       = Y
+FW version           = Y
 EEPROM dump          = Y
 Registers dump       = Y
 BSD nic_uio          = Y
drivers/net/e1000/igb_ethdev.c +56 -0

74 lines not on this page · raw message

Signature · 1 line
2.7.4
#104 lore raw

PATCH v9 3/5 net/ixgbe: add firmware version get

In reply to Qiming Yang

This patch adds a new function ixgbe_fw_version_get.

---
 doc/guides/nics/features/ixgbe.ini |  1 +
 drivers/net/ixgbe/ixgbe_ethdev.c   | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+)
doc/guides/nics/features/ixgbe.ini +1 -0
index 4a5667f..e7104c2 100644
@@ -43,6 +43,7 @@ Timesync             = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
+FW version           = Y
 EEPROM dump          = Y
 Registers dump       = Y
 Multiprocess aware   = Y
drivers/net/ixgbe/ixgbe_ethdev.c +25 -0
index b7ddd4f..fa8ae68 100644
@@ -193,6 +193,8 @@ static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 					     uint16_t queue_id,
 					     uint8_t stat_idx,
 					     uint8_t is_rx);
+static int ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
+				 size_t fw_size);
 static void ixgbe_dev_info_get(struct rte_eth_dev *dev,
 			       struct rte_eth_dev_info *dev_info);
 static const uint32_t *ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev);
@@ -532,6 +534,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
 	.xstats_reset         = ixgbe_dev_xstats_reset,
 	.xstats_get_names     = ixgbe_dev_xstats_get_names,
 	.queue_stats_mapping_set = ixgbe_dev_queue_stats_mapping_set,
+	.fw_version_get       = ixgbe_fw_version_get,
 	.dev_infos_get        = ixgbe_dev_info_get,
 	.dev_supported_ptypes_get = ixgbe_dev_supported_ptypes_get,
 	.mtu_set              = ixgbe_dev_mtu_set,
@@ -3022,6 +3025,28 @@ ixgbevf_dev_stats_reset(struct rte_eth_dev *dev)
 	hw_stats->vfgotc = 0;
 }
 
+static int
+ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u16 eeprom_verh, eeprom_verl;
+	u32 etrack_id;
+	int ret;
+
+	ixgbe_read_eeprom(hw, 0x2e, &eeprom_verh);
+	ixgbe_read_eeprom(hw, 0x2d, &eeprom_verl);
+
+	etrack_id = (eeprom_verh << 16) | eeprom_verl;
+	ret = snprintf(fw_version, fw_size, "0x%08x", etrack_id);
+
+	ret += 1; /* add the size of '\0' */
+	if (fw_size < (u32)ret) {
+		PMD_DRV_LOG(WARNING, "Insufficient fw version buffer size");
+		return ret;
+	} else
+		return 0;
+}
+
 static void
 ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
Signature · 1 line
2.7.4
#105 lore raw

PATCH v9 4/5 net/i40e: add firmware version get

In reply to Qiming Yang

This patch add a new function i40e_fw_version_get.

---
 doc/guides/nics/features/i40e.ini |  1 +
 drivers/net/i40e/i40e_ethdev.c    | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)
doc/guides/nics/features/i40e.ini +1 -0
index 0d143bc..0dbc3c3 100644
@@ -39,6 +39,7 @@ Packet type parsing  = Y
 Timesync             = Y
 Basic stats          = Y
 Extended stats       = Y
+FW version           = Y
 Multiprocess aware   = Y
 BSD nic_uio          = Y
 Linux UIO            = Y
drivers/net/i40e/i40e_ethdev.c +32 -0
index 46def56..d55d9d0 100644
@@ -266,6 +266,8 @@ static int i40e_dev_queue_stats_mapping_set(struct rte_eth_dev *dev,
 					    uint16_t queue_id,
 					    uint8_t stat_idx,
 					    uint8_t is_rx);
+static int i40e_fw_version_get(struct rte_eth_dev *dev,
+				char *fw_version, size_t fw_size);
 static void i40e_dev_info_get(struct rte_eth_dev *dev,
 			      struct rte_eth_dev_info *dev_info);
 static int i40e_vlan_filter_set(struct rte_eth_dev *dev,
@@ -458,6 +460,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
 	.stats_reset                  = i40e_dev_stats_reset,
 	.xstats_reset                 = i40e_dev_stats_reset,
 	.queue_stats_mapping_set      = i40e_dev_queue_stats_mapping_set,
+	.fw_version_get               = i40e_fw_version_get,
 	.dev_infos_get                = i40e_dev_info_get,
 	.dev_supported_ptypes_get     = i40e_dev_supported_ptypes_get,
 	.vlan_filter_set              = i40e_vlan_filter_set,
@@ -2770,6 +2773,35 @@ i40e_dev_queue_stats_mapping_set(__rte_unused struct rte_eth_dev *dev,
 	return -ENOSYS;
 }
 
+static int
+i40e_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
+{
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u32 full_ver;
+	u8 ver, patch;
+	u16 build;
+	int ret;
+
+	full_ver = hw->nvm.oem_ver;
+	ver = (u8)(full_ver >> 24);
+	build = (u16)((full_ver >> 8) & 0xffff);
+	patch = (u8)(full_ver & 0xff);
+
+	ret = snprintf(fw_version, fw_size,
+		 "%d.%d%d 0x%08x %d.%d.%d",
+		 ((hw->nvm.version >> 12) & 0xf),
+		 ((hw->nvm.version >> 4) & 0xff),
+		 (hw->nvm.version & 0xf), hw->nvm.eetrack,
+		 ver, build, patch);
+
+	ret += 1; /* add the size of '\0' */
+	if (fw_size < (u32)ret) {
+		PMD_DRV_LOG(WARNING, "Insufficient fw version buffer size");
+		return ret;
+	} else
+		return 0;
+}
+
 static void
 i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
Signature · 1 line
2.7.4
#106 lore raw

PATCH v9 5/5 ethtool: display firmware version

In reply to Qiming Yang

This patch enhances the ethtool example to support to show firmware version, in the same way that the Linux kernel ethtool does.

---
 examples/ethtool/ethtool-app/ethapp.c | 1 +
 examples/ethtool/lib/rte_ethtool.c    | 9 +++++++++
 2 files changed, 10 insertions(+)
examples/ethtool/ethtool-app/ethapp.c +1 -0
index 6aeaa06..85c31ac 100644
@@ -185,6 +185,7 @@ pcmd_drvinfo_callback(__rte_unused void *ptr_params,
 		printf("Port %i driver: %s (ver: %s)\n",
 			id_port, info.driver, info.version
 		      );
+		printf("firmware-version: %s\n", info.fw_version);
 	}
 }
 
examples/ethtool/lib/rte_ethtool.c +9 -0
index b1f159e..cd2f277 100644
@@ -51,12 +51,21 @@ rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo)
 	struct rte_eth_dev_info dev_info;
 	struct rte_dev_reg_info reg_info;
 	int n;
+	int ret;
 
 	if (drvinfo == NULL)
 		return -EINVAL;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
+	ret = rte_eth_dev_fw_version_get(port_id, drvinfo->fw_version,
+			      sizeof(drvinfo->fw_version));
+	if (ret < 0)
+		printf("firmware version get error: (%s)\n", strerror(-ret));
+	else if (ret > 0)
+		printf("Insufficient fw version buffer size, the minimun size"
+		       "should be %d\n", ret);
+
 	memset(&dev_info, 0, sizeof(dev_info));
 	rte_eth_dev_info_get(port_id, &dev_info);
 
Signature · 1 line
2.7.4
#101 lore raw

Re: [PATCH v9 1/5] ethdev: add firmware version get

In reply to Qiming Yang
Quoted 65 lines · Qiming Yang

This patch adds a new API 'rte_eth_dev_fw_version_get' for fetching firmware version by a given device.

---
  doc/guides/nics/features/default.ini   |  1 +
  doc/guides/rel_notes/deprecation.rst   |  4 ----
  doc/guides/rel_notes/release_17_02.rst |  5 +++++
  lib/librte_ether/rte_ethdev.c          | 12 ++++++++++++
  lib/librte_ether/rte_ethdev.h          | 26 ++++++++++++++++++++++++++
  lib/librte_ether/rte_ether_version.map |  1 +
  6 files changed, 45 insertions(+), 4 deletions(-)
doc/guides/nics/features/default.ini +1 -0
index f1bf9bf..ae40d57 100644
@@ -50,6 +50,7 @@ Timesync             =
  Basic stats          =
  Extended stats       =
  Stats per queue      =
+FW version           =
  EEPROM dump          =
  Registers dump       =
  Multiprocess aware   =
doc/guides/rel_notes/deprecation.rst +0 -4
index 054e2e7..755dc65 100644
@@ -30,10 +30,6 @@ Deprecation Notices
    ``nb_seg_max`` and ``nb_mtu_seg_max`` providing information about number of
    segments limit to be transmitted by device for TSO/non-TSO packets.
 
-* 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.
-
  * ethdev: an API change is planned for 17.02 for the function
    ``_rte_eth_dev_callback_process``. In 17.02 the function will return an ``int``
    instead of ``void`` and a fourth parameter ``void *ret_param`` will be added.
doc/guides/rel_notes/release_17_02.rst +5 -0
index 5762d3f..f9134bb 100644
@@ -66,6 +66,11 @@ New Features
    Support for Mellanox ConnectX-5 family of 10/25/40/50/100 Gbps adapters
    has been added to the existing mlx5 PMD.
 
+* **Added firmware version get API.**
+
+  Added a new function ``rte_eth_dev_fw_version_get()`` to fetch firmware
+  version by a given device.
+
  Resolved Issues
  ---------------
 
lib/librte_ether/rte_ethdev.c +0 -0
index 917557a..89cffcf 100644
@@ -1588,6 +1588,18 @@ rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id,
  			STAT_QMAP_RX);
  }
 

lib/librte_ether/rte_ethdev.c rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id, · line 1600

Quoted 10 lines
lib/librte_ether/rte_ethdev.c +10 -0
+int
+rte_eth_dev_fw_version_get(uint8_t port_id, char *fw_version, size_t fw_size)
+{
+	struct rte_eth_dev *dev;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	dev = &rte_eth_devices[port_id];
+
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fw_version_get, -ENOTSUP);
+	return (*dev->dev_ops->fw_version_get)(dev, fw_version, fw_size);

I think it would be good to handle difference from snprintf() behaviour here and specify that fw_version_get callback has exactly snprintf()-like return value. It would allow to avoid duplicated code in all drivers (adding 1 for terminating null, conversion of success value to 0). Also I think warning about insufficient space is not required. It could be intentional to call the first time with 0 (or some small) space to get required space to be (re)allocated. May be debug level message would be useful.

Quoted 10 lines
lib/librte_ether/rte_ethdev.c +2 -0
+}
+
  void
  rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)
  {
lib/librte_ether/rte_ethdev.h +0 -0
index ded43d7..37a55ef 100644

lib/librte_ether/rte_ethdev.h typedef uint32_t (*eth_rx_queue_count_t)(struct rte_eth_dev *dev, · line 1183

Quoted 7 lines
lib/librte_ether/rte_ethdev.h +4 -0
@@ -1177,6 +1177,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 int (*eth_fw_version_get_t)(struct rte_eth_dev *dev,
+				     char *fw_version, size_t fw_size);
+/**< @internal Get firmware information of an Ethernet device. */
+

If we finally have different return value for rte_eth_dev_fw_version_get() and here, it would be useful to highlight it here.

Quoted 21 lines
lib/librte_ether/rte_ethdev.h +7 -0
  typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,
  	uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo);
 
@@ -1459,6 +1463,7 @@ struct eth_dev_ops {
  	eth_dev_infos_get_t        dev_infos_get; /**< Get device info. */
  	eth_rxq_info_get_t         rxq_info_get; /**< retrieve RX queue information. */
  	eth_txq_info_get_t         txq_info_get; /**< retrieve TX queue information. */
+	eth_fw_version_get_t       fw_version_get; /**< Get firmware version. */
  	eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
  	/**< Get packet types supported and identified by device. */
 
@@ -2396,6 +2401,27 @@ 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,

lib/librte_ether/rte_ethdev.h void rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr); · line 2419

Quoted 10 lines
lib/librte_ether/rte_ethdev.h +10 -0
+ *   allocated by caller.
+ * @param fw_size
+ *   The size of the array pointed by fw_version, which should be
+ *   large enough to store firmware version of the device.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if operation is not supported.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - (>0) if *fw_size* is not enough to store firmware version, return
+ *          the size of the non truncated string.

It is OK for me to keep 0 for success here and it is right in this case to include terminating null iin the return value if size is insufficient (to cover corner case with empty FW version). Please, highlight that terminating null is included here. It is the difference from snprintf() and it should be 100% clear.

Quoted 20 lines
lib/librte_ether/rte_ethdev.h +5 -0
+ */
+int rte_eth_dev_fw_version_get(uint8_t port_id,
+			       char *fw_version, size_t fw_size);
+
+/**
   * Retrieve the supported packet types of an Ethernet device.
   *
   * When a packet type is announced as supported, it *must* be recognized by
lib/librte_ether/rte_ether_version.map +1 -0
index 0c2859e..c6c9d0d 100644
@@ -146,6 +146,7 @@ DPDK_17.02 {
  	global:
 
  	_rte_eth_dev_reset;
+	rte_eth_dev_fw_version_get;
  	rte_flow_create;
  	rte_flow_destroy;
  	rte_flow_flush;
#102 lore raw

Re: [PATCH v9 1/5] ethdev: add firmware version get

Hi, Andrew

Quoted 20 lines

lib/librte_ether/rte_ethdev.c

Quoted 5 lines
(quoted diff) +0 -0

b/lib/librte_ether/rte_ethdev.c index 917557a..89cffcf 100644

lib/librte_ether/rte_ethdev.c +0 -0
@@ -1588,6 +1588,18 @@

rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id,

lib/librte_ether/rte_ethdev.c rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id,

Quoted 12 lines
lib/librte_ether/rte_ethdev.c +9 -0
  			STAT_QMAP_RX);
  }
 
+int
+rte_eth_dev_fw_version_get(uint8_t port_id, char *fw_version, size_t
+fw_size) {
+	struct rte_eth_dev *dev;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	dev = &rte_eth_devices[port_id];
+
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fw_version_get, -

ENOTSUP);

Quoted 8 lines

lib/librte_ether/rte_ethdev.c rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id, · line 1600

Quoted 1 line
lib/librte_ether/rte_ethdev.c +1 -0
+	return (*dev->dev_ops->fw_version_get)(dev, fw_version, fw_size);

I think it would be good to handle difference from snprintf() behaviour here and specify that fw_version_get callback has exactly snprintf()-like return value.
It would allow to avoid
duplicated code in all drivers (adding 1 for terminating null, conversion of success value to 0).

But I think it would be better to just keep the way it is. If I handle snpritf() behavior here, may the function rte_eth_dev_fw_version_get and ops fw_version_get will have different definition of return value.

Quoted 4 lines

Also I think warning about insufficient space is not required. It could be intentional to call the first time with 0 (or some small) space to get required space to be (re)allocated.
May be debug level message would be useful.

Good advice, when call this function with 0, this function will become a API to get firmware version size. I think we can remove the warning message here.

Quoted 19 lines

lib/librte_ether/rte_ethdev.c rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id,

Quoted 5 lines
lib/librte_ether/rte_ethdev.c +2 -0
+}
+
  void
  rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info

*dev_info)

lib/librte_ether/rte_ethdev.h typedef uint32_t

Quoted 6 lines
lib/librte_ether/rte_ethdev.c +0 -0
  {
(quoted diff) +0 -0

b/lib/librte_ether/rte_ethdev.h index ded43d7..37a55ef 100644

lib/librte_ether/rte_ethdev.h +0 -0
@@ -1177,6 +1177,10 @@ typedef uint32_t

(*eth_rx_queue_count_t)(struct rte_eth_dev *dev,

lib/librte_ether/rte_ethdev.h typedef uint32_t (*eth_rx_queue_count_t)(struct rte_eth_dev *dev,

Quoted 5 lines
lib/librte_ether/rte_ethdev.h +2 -0
  typedef int (*eth_rx_descriptor_done_t)(void *rxq, uint16_t offset);
  /**< @internal Check DD bit of specific RX descriptor */
 
+typedef int (*eth_fw_version_get_t)(struct rte_eth_dev *dev,
+				     char *fw_version, size_t fw_size); /**<

@internal Get

Quoted 6 lines

lib/librte_ether/rte_ethdev.h typedef uint32_t · line 1183

Quoted 2 lines
lib/librte_ether/rte_ethdev.h +2 -0
+firmware information of an Ethernet device. */
+

If we finally have different return value for
rte_eth_dev_fw_version_get() and here,
it would be useful to highlight it here.

If I keep the handle of snprintf() return value in drivers, they will not have different return here, so the highlight is not necessary.

Quoted 37 lines

lib/librte_ether/rte_ethdev.h struct eth_dev_ops { · line 1464

Quoted 6 lines
lib/librte_ether/rte_ethdev.h +0 -0
  typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,
  	uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo);
 
@@ -1459,6 +1463,7 @@ struct eth_dev_ops {
  	eth_dev_infos_get_t        dev_infos_get; /**< Get device info. */
  	eth_rxq_info_get_t         rxq_info_get; /**< retrieve RX queue

information. */

lib/librte_ether/rte_ethdev.h struct eth_dev_ops { · line 1465

Quoted 1 line
lib/librte_ether/rte_ethdev.h +0 -0
  	eth_txq_info_get_t         txq_info_get; /**< retrieve TX queue

information. */

lib/librte_ether/rte_ethdev.h struct eth_dev_ops { · line 1466

Quoted 1 line
lib/librte_ether/rte_ethdev.h +1 -0
+	eth_fw_version_get_t       fw_version_get; /**< Get firmware

version. */

lib/librte_ether/rte_ethdev.h void rte_eth_macaddr_get(uint8_t port_id,

Quoted 4 lines
lib/librte_ether/rte_ethdev.h +0 -0
  	eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
  	/**< Get packet types supported and identified by device. */
 
@@ -2396,6 +2401,27 @@ void rte_eth_macaddr_get(uint8_t port_id,

struct ether_addr *mac_addr);

Quoted 10 lines
lib/librte_ether/rte_ethdev.h +6 -0
  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,

lib/librte_ether/rte_ethdev.h void rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr); · line 2419

Quoted 10 lines
lib/librte_ether/rte_ethdev.h +10 -0
+ *   allocated by caller.
+ * @param fw_size
+ *   The size of the array pointed by fw_version, which should be
+ *   large enough to store firmware version of the device.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if operation is not supported.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - (>0) if *fw_size* is not enough to store firmware version, return
+ *          the size of the non truncated string.
Quoted 6 lines

It is OK for me to keep 0 for success here and it is right in this case to include terminating null iin the return value if size is insufficient (to cover corner case with empty FW version).
Please, highlight that terminating null is included here. It is the difference from snprintf() and it should be 100% clear.

You are right, I'll highlight that the firmware version stored here is include '\0'.

Quoted 22 lines
Quoted 21 lines
lib/librte_ether/rte_ethdev.h +5 -0
+ */
+int rte_eth_dev_fw_version_get(uint8_t port_id,
+			       char *fw_version, size_t fw_size);
+
+/**
   * 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 0c2859e..c6c9d0d 100644

lib/librte_ether/rte_ether_version.map +1 -0
@@ -146,6 +146,7 @@ DPDK_17.02 {
  	global:
 
  	_rte_eth_dev_reset;
+	rte_eth_dev_fw_version_get;
  	rte_flow_create;
  	rte_flow_destroy;
  	rte_flow_flush;
#107 lore raw

v10 cover new API 'rte_eth_dev_fw_version_get'

In reply to Qiming Yang

v10:- highlighted that terminating null is included in the output string array.
removed the warning message in drivers.

v9: - when fw_size is insufficient, return the size of the non truncated
string as snprintf does.

v8: - defined the minimum fw version size as a macro.

v7: - rebased

v6: - renamed fw_length -> fw_size
- added return value for insufficient fw_size
- fixed the indentation problem in e1000
- added ver.build.patch in i40e, keep the same with Linux kernel driver

v5: - modified the API rte_eth_dev_fw_version_get(uint8_t port_id,
char *fw_version, int fw_length).

v4: - removed deprecation notice
- renamed API as rte_eth_dev_fw_version_get
- splited bus info print from this patch set

v3: - changed API, use rte_eth_dev_fw_info_get(uint8_t port_id,

      uint32_t *fw_major, uint32_t *fw_minor, uint32_t *fw_patch,
      uint32_t *etrack_id)
    - added statusment in /doc/guides/nics/features/default.ini and
      release_17_02.rst

v2: - fixed commit log

Now, the example ethtool can only show the driver information. From customers' point of view, it should be better if we can have the same way that the Linux kernel ethtool does to show firmware version.

These five patches added a new function ``rte_eth_dev_fw_version_get()`` to fetch firmware version related information and implement the display in example ethtool.

Qiming Yang (5):
ethdev: add firmware version get
net/e1000: add firmware version get
net/ixgbe: add firmware version get
net/i40e: add firmware version get
ethtool: display firmware version

 doc/guides/nics/features/default.ini   |  1 +
 doc/guides/nics/features/i40e.ini      |  1 +
 doc/guides/nics/features/igb.ini       |  1 +
 doc/guides/nics/features/ixgbe.ini     |  1 +
 doc/guides/rel_notes/deprecation.rst   |  4 ---
 doc/guides/rel_notes/release_17_02.rst |  5 ++++
 drivers/net/e1000/igb_ethdev.c         | 55 ++++++++++++++++++++++++++++++++++
 drivers/net/i40e/i40e_ethdev.c         | 31 +++++++++++++++++++
 drivers/net/ixgbe/ixgbe_ethdev.c       | 24 +++++++++++++++
 examples/ethtool/ethtool-app/ethapp.c  |  1 +
 examples/ethtool/lib/rte_ethtool.c     |  9 ++++++
 lib/librte_ether/rte_ethdev.c          | 12 ++++++++
 lib/librte_ether/rte_ethdev.h          | 26 ++++++++++++++++
 lib/librte_ether/rte_ether_version.map |  1 +
 14 files changed, 168 insertions(+), 4 deletions(-)
Signature · 1 line
2.7.4
#108 lore raw

PATCH v10 1/5 ethdev: add firmware version get

This patch adds a new API 'rte_eth_dev_fw_version_get' for fetching firmware version by a given device.

---
 doc/guides/nics/features/default.ini   |  1 +
 doc/guides/rel_notes/deprecation.rst   |  4 ----
 doc/guides/rel_notes/release_17_02.rst |  5 +++++
 lib/librte_ether/rte_ethdev.c          | 12 ++++++++++++
 lib/librte_ether/rte_ethdev.h          | 26 ++++++++++++++++++++++++++
 lib/librte_ether/rte_ether_version.map |  1 +
 6 files changed, 45 insertions(+), 4 deletions(-)
doc/guides/nics/features/default.ini +1 -0
index f1bf9bf..ae40d57 100644
@@ -50,6 +50,7 @@ Timesync             =
 Basic stats          =
 Extended stats       =
 Stats per queue      =
+FW version           =
 EEPROM dump          =
 Registers dump       =
 Multiprocess aware   =
doc/guides/rel_notes/deprecation.rst +0 -4
index 054e2e7..755dc65 100644
@@ -30,10 +30,6 @@ Deprecation Notices
   ``nb_seg_max`` and ``nb_mtu_seg_max`` providing information about number of
   segments limit to be transmitted by device for TSO/non-TSO packets.
 
-* 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.
-
 * ethdev: an API change is planned for 17.02 for the function
   ``_rte_eth_dev_callback_process``. In 17.02 the function will return an ``int``
   instead of ``void`` and a fourth parameter ``void *ret_param`` will be added.
doc/guides/rel_notes/release_17_02.rst +5 -0
index 5762d3f..f9134bb 100644
@@ -66,6 +66,11 @@ New Features
   Support for Mellanox ConnectX-5 family of 10/25/40/50/100 Gbps adapters
   has been added to the existing mlx5 PMD.
 
+* **Added firmware version get API.**
+
+  Added a new function ``rte_eth_dev_fw_version_get()`` to fetch firmware
+  version by a given device.
+
 Resolved Issues
 ---------------
 
lib/librte_ether/rte_ethdev.c +12 -0
index 917557a..89cffcf 100644
@@ -1588,6 +1588,18 @@ rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id,
 			STAT_QMAP_RX);
 }
 
+int
+rte_eth_dev_fw_version_get(uint8_t port_id, char *fw_version, size_t fw_size)
+{
+	struct rte_eth_dev *dev;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	dev = &rte_eth_devices[port_id];
+
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fw_version_get, -ENOTSUP);
+	return (*dev->dev_ops->fw_version_get)(dev, fw_version, fw_size);
+}
+
 void
 rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)
 {
lib/librte_ether/rte_ethdev.h +26 -0
index ded43d7..768ca04 100644
@@ -1177,6 +1177,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 int (*eth_fw_version_get_t)(struct rte_eth_dev *dev,
+				     char *fw_version, size_t fw_size);
+/**< @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);
 
@@ -1459,6 +1463,7 @@ struct eth_dev_ops {
 	eth_dev_infos_get_t        dev_infos_get; /**< Get device info. */
 	eth_rxq_info_get_t         rxq_info_get; /**< retrieve RX queue information. */
 	eth_txq_info_get_t         txq_info_get; /**< retrieve TX queue information. */
+	eth_fw_version_get_t       fw_version_get; /**< Get firmware version. */
 	eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
 	/**< Get packet types supported and identified by device. */
 
@@ -2396,6 +2401,27 @@ 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 pointer to a string array storing the firmware version of a device,
+ *   the string includes terminating null. This pointer is allocated by caller.
+ * @param fw_size
+ *   The size of the string array pointed by fw_version, which should be
+ *   large enough to store firmware version of the device.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if operation is not supported.
+ *   - (-ENODEV) if *port_id* invalid.
+ *   - (>0) if *fw_size* is not enough to store firmware version, return
+ *          the size of the non truncated string.
+ */
+int rte_eth_dev_fw_version_get(uint8_t port_id,
+			       char *fw_version, size_t fw_size);
+
+/**
  * Retrieve the supported packet types of an Ethernet device.
  *
  * When a packet type is announced as supported, it *must* be recognized by
lib/librte_ether/rte_ether_version.map +1 -0
index 0c2859e..c6c9d0d 100644
@@ -146,6 +146,7 @@ DPDK_17.02 {
 	global:
 
 	_rte_eth_dev_reset;
+	rte_eth_dev_fw_version_get;
 	rte_flow_create;
 	rte_flow_destroy;
 	rte_flow_flush;
Signature · 1 line
2.7.4
#109 lore raw

PATCH v10 2/5 net/e1000: add firmware version get

In reply to Qiming Yang

This patch adds a new function eth_igb_fw_version_get.

---
 doc/guides/nics/features/igb.ini |  1 +
 drivers/net/e1000/igb_ethdev.c   | 55 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+)
doc/guides/nics/features/igb.ini +1 -0
index 9fafe72..26ae008 100644
@@ -35,6 +35,7 @@ Packet type parsing  = Y
 Timesync             = Y
 Basic stats          = Y
 Extended stats       = Y
+FW version           = Y
 EEPROM dump          = Y
 Registers dump       = Y
 BSD nic_uio          = Y
drivers/net/e1000/igb_ethdev.c +55 -0

73 lines not on this page · raw message

Signature · 1 line
2.7.4
#110 lore raw

PATCH v10 3/5 net/ixgbe: add firmware version get

In reply to Qiming Yang

This patch adds a new function ixgbe_fw_version_get.

---
 doc/guides/nics/features/ixgbe.ini |  1 +
 drivers/net/ixgbe/ixgbe_ethdev.c   | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+)
doc/guides/nics/features/ixgbe.ini +1 -0
index 4a5667f..e7104c2 100644
@@ -43,6 +43,7 @@ Timesync             = Y
 Basic stats          = Y
 Extended stats       = Y
 Stats per queue      = Y
+FW version           = Y
 EEPROM dump          = Y
 Registers dump       = Y
 Multiprocess aware   = Y
drivers/net/ixgbe/ixgbe_ethdev.c +24 -0
index b7ddd4f..034504c 100644
@@ -193,6 +193,8 @@ static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 					     uint16_t queue_id,
 					     uint8_t stat_idx,
 					     uint8_t is_rx);
+static int ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
+				 size_t fw_size);
 static void ixgbe_dev_info_get(struct rte_eth_dev *dev,
 			       struct rte_eth_dev_info *dev_info);
 static const uint32_t *ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev);
@@ -532,6 +534,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
 	.xstats_reset         = ixgbe_dev_xstats_reset,
 	.xstats_get_names     = ixgbe_dev_xstats_get_names,
 	.queue_stats_mapping_set = ixgbe_dev_queue_stats_mapping_set,
+	.fw_version_get       = ixgbe_fw_version_get,
 	.dev_infos_get        = ixgbe_dev_info_get,
 	.dev_supported_ptypes_get = ixgbe_dev_supported_ptypes_get,
 	.mtu_set              = ixgbe_dev_mtu_set,
@@ -3022,6 +3025,27 @@ ixgbevf_dev_stats_reset(struct rte_eth_dev *dev)
 	hw_stats->vfgotc = 0;
 }
 
+static int
+ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
+{
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u16 eeprom_verh, eeprom_verl;
+	u32 etrack_id;
+	int ret;
+
+	ixgbe_read_eeprom(hw, 0x2e, &eeprom_verh);
+	ixgbe_read_eeprom(hw, 0x2d, &eeprom_verl);
+
+	etrack_id = (eeprom_verh << 16) | eeprom_verl;
+	ret = snprintf(fw_version, fw_size, "0x%08x", etrack_id);
+
+	ret += 1; /* add the size of '\0' */
+	if (fw_size < (u32)ret)
+		return ret;
+	else
+		return 0;
+}
+
 static void
 ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
Signature · 1 line
2.7.4
#111 lore raw

PATCH v10 4/5 net/i40e: add firmware version get

In reply to Qiming Yang

This patch add a new function i40e_fw_version_get.

---
 doc/guides/nics/features/i40e.ini |  1 +
 drivers/net/i40e/i40e_ethdev.c    | 31 +++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)
doc/guides/nics/features/i40e.ini +1 -0
index 0d143bc..0dbc3c3 100644
@@ -39,6 +39,7 @@ Packet type parsing  = Y
 Timesync             = Y
 Basic stats          = Y
 Extended stats       = Y
+FW version           = Y
 Multiprocess aware   = Y
 BSD nic_uio          = Y
 Linux UIO            = Y
drivers/net/i40e/i40e_ethdev.c +31 -0
index 46def56..22442f8 100644
@@ -266,6 +266,8 @@ static int i40e_dev_queue_stats_mapping_set(struct rte_eth_dev *dev,
 					    uint16_t queue_id,
 					    uint8_t stat_idx,
 					    uint8_t is_rx);
+static int i40e_fw_version_get(struct rte_eth_dev *dev,
+				char *fw_version, size_t fw_size);
 static void i40e_dev_info_get(struct rte_eth_dev *dev,
 			      struct rte_eth_dev_info *dev_info);
 static int i40e_vlan_filter_set(struct rte_eth_dev *dev,
@@ -458,6 +460,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
 	.stats_reset                  = i40e_dev_stats_reset,
 	.xstats_reset                 = i40e_dev_stats_reset,
 	.queue_stats_mapping_set      = i40e_dev_queue_stats_mapping_set,
+	.fw_version_get               = i40e_fw_version_get,
 	.dev_infos_get                = i40e_dev_info_get,
 	.dev_supported_ptypes_get     = i40e_dev_supported_ptypes_get,
 	.vlan_filter_set              = i40e_vlan_filter_set,
@@ -2770,6 +2773,34 @@ i40e_dev_queue_stats_mapping_set(__rte_unused struct rte_eth_dev *dev,
 	return -ENOSYS;
 }
 
+static int
+i40e_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
+{
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u32 full_ver;
+	u8 ver, patch;
+	u16 build;
+	int ret;
+
+	full_ver = hw->nvm.oem_ver;
+	ver = (u8)(full_ver >> 24);
+	build = (u16)((full_ver >> 8) & 0xffff);
+	patch = (u8)(full_ver & 0xff);
+
+	ret = snprintf(fw_version, fw_size,
+		 "%d.%d%d 0x%08x %d.%d.%d",
+		 ((hw->nvm.version >> 12) & 0xf),
+		 ((hw->nvm.version >> 4) & 0xff),
+		 (hw->nvm.version & 0xf), hw->nvm.eetrack,
+		 ver, build, patch);
+
+	ret += 1; /* add the size of '\0' */
+	if (fw_size < (u32)ret)
+		return ret;
+	else
+		return 0;
+}
+
 static void
 i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
Signature · 1 line
2.7.4
#112 lore raw

PATCH v10 5/5 ethtool: display firmware version

In reply to Qiming Yang

This patch enhances the ethtool example to support to show firmware version, in the same way that the Linux kernel ethtool does.

---
 examples/ethtool/ethtool-app/ethapp.c | 1 +
 examples/ethtool/lib/rte_ethtool.c    | 9 +++++++++
 2 files changed, 10 insertions(+)
examples/ethtool/ethtool-app/ethapp.c +1 -0
index 6aeaa06..85c31ac 100644
@@ -185,6 +185,7 @@ pcmd_drvinfo_callback(__rte_unused void *ptr_params,
 		printf("Port %i driver: %s (ver: %s)\n",
 			id_port, info.driver, info.version
 		      );
+		printf("firmware-version: %s\n", info.fw_version);
 	}
 }
 
examples/ethtool/lib/rte_ethtool.c +9 -0
index b1f159e..cd2f277 100644
@@ -51,12 +51,21 @@ rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo)
 	struct rte_eth_dev_info dev_info;
 	struct rte_dev_reg_info reg_info;
 	int n;
+	int ret;
 
 	if (drvinfo == NULL)
 		return -EINVAL;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
+	ret = rte_eth_dev_fw_version_get(port_id, drvinfo->fw_version,
+			      sizeof(drvinfo->fw_version));
+	if (ret < 0)
+		printf("firmware version get error: (%s)\n", strerror(-ret));
+	else if (ret > 0)
+		printf("Insufficient fw version buffer size, the minimun size"
+		       "should be %d\n", ret);
+
 	memset(&dev_info, 0, sizeof(dev_info));
 	rte_eth_dev_info_get(port_id, &dev_info);
 
Signature · 1 line
2.7.4
#113 lore raw

Re: [PATCH v10 0/5] new API 'rte_eth_dev_fw_version_get'

In reply to Qiming Yang
Quoted 6 lines

Qiming Yang (5):
ethdev: add firmware version get
net/e1000: add firmware version get
net/ixgbe: add firmware version get
net/i40e: add firmware version get
ethtool: display firmware version

Applied, thanks