From: Qiming Yang Date: Mon, 16 Jan 2017 10:48:27 +0000 (+0800) Subject: ethdev: add firmware version get X-Git-Tag: spdx-start~5131 X-Git-Url: http://git.droids-corp.org/?p=dpdk.git;a=commitdiff_plain;h=21913471202f996d8bba80cb63b22b2489a620f3 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. Signed-off-by: Qiming Yang Acked-by: Remy Horton --- diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini index c412d6f52f..6e4a0436c9 100644 --- a/doc/guides/nics/features/default.ini +++ b/doc/guides/nics/features/default.ini @@ -51,6 +51,7 @@ Timesync = Basic stats = Extended stats = Stats per queue = +FW version = EEPROM dump = Registers dump = Multiprocess aware = diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 1438c777b4..291e03d3ea 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -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. diff --git a/doc/guides/rel_notes/release_17_02.rst b/doc/guides/rel_notes/release_17_02.rst index 73849b5459..4a3b9470e1 100644 --- a/doc/guides/rel_notes/release_17_02.rst +++ b/doc/guides/rel_notes/release_17_02.rst @@ -52,6 +52,11 @@ New Features See the :ref:`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. + * **Added APIs for MACsec offload support to the ixgbe PMD.** Six new APIs have been added to the ixgbe PMD for MACsec offload support. diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 0b039e1757..e67e2508bc 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1641,6 +1641,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) { diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 49c073bee1..9cbd1af43f 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1179,6 +1179,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); @@ -1489,6 +1493,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. */ @@ -2431,6 +2436,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. * diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map index a0217814bd..0cf94ed2fe 100644 --- a/lib/librte_ether/rte_ether_version.map +++ b/lib/librte_ether/rte_ether_version.map @@ -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;