From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 779D02BAE for ; Fri, 10 Jun 2016 18:18:59 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 10 Jun 2016 09:18:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,450,1459839600"; d="scan'208";a="717063202" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by FMSMGA003.fm.intel.com with ESMTP; 10 Jun 2016 09:18:56 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id u5AGIuxN030933; Fri, 10 Jun 2016 17:18:56 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id u5AGItZl023687; Fri, 10 Jun 2016 17:18:55 +0100 Received: (from reshmapa@localhost) by sivswdev02.ir.intel.com with id u5AGItQH023683; Fri, 10 Jun 2016 17:18:55 +0100 From: Reshma Pattan To: dev@dpdk.org Cc: Reshma Pattan Date: Fri, 10 Jun 2016 17:18:50 +0100 Message-Id: <1465575534-23605-5-git-send-email-reshma.pattan@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1465575534-23605-1-git-send-email-reshma.pattan@intel.com> References: <1465487895-5870-1-git-send-email-reshma.pattan@intel.com> <1465575534-23605-1-git-send-email-reshma.pattan@intel.com> Subject: [dpdk-dev] [PATCH v8 4/8] librte_ether: make rte_eth_dev_get_port_by_name rte_eth_dev_get_name_by_port public X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jun 2016 16:19:00 -0000 Converted rte_eth_dev_get_port_by_name to a public API. Converted rte_eth_dev_get_name_by_port to a public API. Signed-off-by: Reshma Pattan --- lib/librte_ether/rte_ethdev.c | 4 ++-- lib/librte_ether/rte_ethdev.h | 29 +++++++++++++++++++++++++++++ lib/librte_ether/rte_ether_version.map | 2 ++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 1f634c9..0b19569 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -406,7 +406,7 @@ rte_eth_dev_get_addr_by_port(uint8_t port_id, struct rte_pci_addr *addr) return 0; } -static int +int rte_eth_dev_get_name_by_port(uint8_t port_id, char *name) { char *tmp; @@ -425,7 +425,7 @@ rte_eth_dev_get_name_by_port(uint8_t port_id, char *name) return 0; } -static int +int rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id) { int i; diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 8ad7c01..fab281e 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -4284,6 +4284,35 @@ rte_eth_dev_l2_tunnel_offload_set(uint8_t port_id, uint32_t mask, uint8_t en); +/** +* Get the port id from pci adrress or device name +* Ex: 0000:2:00.0 or vdev name eth_pcap0 +* +* @param name +* pci address or name of the device +* @param port_id +* pointer to port identifier of the device +* @return +* - (0) if successful. +* - (-ENODEV or -EINVAL) on failure. +*/ +int +rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id); + +/** +* Get the device name from port id +* +* @param port_id +* pointer to port identifier of the device +* @param name +* pci address or name of the device +* @return +* - (0) if successful. +* - (-EINVAL) on failure. +*/ +int +rte_eth_dev_get_name_by_port(uint8_t port_id, char *name); + #ifdef __cplusplus } #endif diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map index d06d648..73e730d 100644 --- a/lib/librte_ether/rte_ether_version.map +++ b/lib/librte_ether/rte_ether_version.map @@ -137,5 +137,7 @@ DPDK_16.07 { global: rte_eth_add_first_rx_callback; + rte_eth_dev_get_name_by_port; + rte_eth_dev_get_port_by_name; rte_eth_dev_info_get; } DPDK_16.04; -- 2.5.0