From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id A01E62A66 for ; Tue, 6 Dec 2016 08:21:17 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP; 05 Dec 2016 23:21:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,751,1477983600"; d="scan'208";a="1068469744" Received: from unknown (HELO dpdk7.bj.intel.com) ([172.16.182.76]) by orsmga001.jf.intel.com with ESMTP; 05 Dec 2016 23:21:15 -0800 From: Qiming Yang To: dev@dpdk.org Cc: Qiming Yang Date: Tue, 6 Dec 2016 15:16:18 +0800 Message-Id: <1481008582-69416-2-git-send-email-qiming.yang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481008582-69416-1-git-send-email-qiming.yang@intel.com> References: <1479375779-46629-2-git-send-email-qiming.yang@intel.com> <1481008582-69416-1-git-send-email-qiming.yang@intel.com> Subject: [dpdk-dev] [PATCH v2 1/5] ethdev: add firmware version get X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2016 07:21:18 -0000 This patch adds a new API 'rte_eth_dev_fwver_get' for fetching firmware version by a given device. Signed-off-by: Qiming Yang --- 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(+) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index fde8112..793e50f 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1538,6 +1538,18 @@ rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id, } void +rte_eth_dev_fwver_get(uint8_t port_id, char *fw_version, int fw_length) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_RET(port_id); + dev = &rte_eth_devices[port_id]; + + RTE_FUNC_PTR_OR_RET(*dev->dev_ops->fw_version_get); + (*dev->dev_ops->fw_version_get)(dev, fw_version, fw_length); +} + +void rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info) { struct rte_eth_dev *dev; diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 9678179..2c05df4 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1150,6 +1150,10 @@ typedef uint32_t (*eth_rx_queue_count_t)(struct rte_eth_dev *dev, typedef int (*eth_rx_descriptor_done_t)(void *rxq, uint16_t offset); /**< @internal Check DD bit of specific RX descriptor */ +typedef void (*eth_fw_version_get_t)(struct rte_eth_dev *dev, + char *fw_version, int fw_length); +/**< @internal Get firmware information of an Ethernet device. */ + typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev, uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo); @@ -1444,6 +1448,7 @@ struct eth_dev_ops { /**< Get names of extended statistics. */ eth_queue_stats_mapping_set_t queue_stats_mapping_set; /**< Configure per queue stat counter mapping. */ + eth_fw_version_get_t fw_version_get; /**< Get firmware version. */ eth_dev_infos_get_t dev_infos_get; /**< Get device info. */ eth_dev_supported_ptypes_get_t dev_supported_ptypes_get; /**< Get packet types supported and identified by device*/ @@ -2385,6 +2390,19 @@ void rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr); void rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info); /** + * Retrieve the firmware version of a device. + * + * @param port_id + * The port identifier of the device. + * @param fw_version + * A array pointer to store the firmware version of a device, + * allocated by caller. + * @param fw_length + * The size of the array pointed by fw_version. + */ +void rte_eth_dev_fwver_get(uint8_t port_id, char *fw_version, int fw_length); + +/** * Retrieve the supported packet types of an Ethernet device. * * When a packet type is announced as supported, it *must* be recognized by diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map index 72be66d..5e6387f 100644 --- a/lib/librte_ether/rte_ether_version.map +++ b/lib/librte_ether/rte_ether_version.map @@ -147,3 +147,10 @@ DPDK_16.11 { rte_eth_dev_pci_remove; } DPDK_16.07; + +DPDK_17.02 { + global: + + rte_eth_dev_fwver_get; + +} DPDK_16.11; -- 2.7.4