From patchwork Mon May 23 21:38:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pattan, Reshma" X-Patchwork-Id: 12948 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id DDFE65A34; Mon, 23 May 2016 23:41:21 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 759F05A08 for ; Mon, 23 May 2016 23:41:20 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP; 23 May 2016 14:41:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,357,1459839600"; d="scan'208";a="960762371" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga001.jf.intel.com with ESMTP; 23 May 2016 14:41:18 -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 u4NLca7T007457; Mon, 23 May 2016 22:38:36 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id u4NLcaOO002909; Mon, 23 May 2016 22:38:36 +0100 Received: (from reshmapa@localhost) by sivswdev02.ir.intel.com with id u4NLcaVi002905; Mon, 23 May 2016 22:38:36 +0100 From: Reshma Pattan To: dev@dpdk.org Cc: Reshma Pattan Date: Mon, 23 May 2016 22:38:27 +0100 Message-Id: <1464039512-2683-5-git-send-email-reshma.pattan@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1464039512-2683-1-git-send-email-reshma.pattan@intel.com> References: <1463503030-10318-1-git-send-email-reshma.pattan@intel.com> <1464039512-2683-1-git-send-email-reshma.pattan@intel.com> Subject: [dpdk-dev] [PATCH v4 4/9] librte_ether: make rte_eth_dev_get_port_by_name api 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Converted rte_eth_dev_get_port_by_name to public API. Signed-off-by: Reshma Pattan --- lib/librte_ether/rte_ethdev.c | 2 +- lib/librte_ether/rte_ethdev.h | 15 +++++++++++++++ lib/librte_ether/rte_ether_version.map | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 3ee5b9f..a50bb1e 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -427,7 +427,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 106318f..b20f5cd 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -4283,6 +4283,21 @@ 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) on failure. +*/ +int +rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id); + #ifdef __cplusplus } #endif diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map index d06d648..512f38f 100644 --- a/lib/librte_ether/rte_ether_version.map +++ b/lib/librte_ether/rte_ether_version.map @@ -137,5 +137,6 @@ DPDK_16.07 { global: rte_eth_add_first_rx_callback; + rte_eth_dev_get_port_by_name; rte_eth_dev_info_get; } DPDK_16.04;