From patchwork Thu Dec 19 11:54:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Britstein X-Patchwork-Id: 1213253 X-Patchwork-Delegate: i.maximets@samsung.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=mellanox.com Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47dr0l5mdcz9sPh for ; Thu, 19 Dec 2019 22:55:19 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 5FD06887C7; Thu, 19 Dec 2019 11:55:17 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZCXPD5tF1Rc6; Thu, 19 Dec 2019 11:55:15 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id CCEAE8872A; Thu, 19 Dec 2019 11:55:00 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id A6910C1D81; Thu, 19 Dec 2019 11:55:00 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id EAB0FC1D88 for ; Thu, 19 Dec 2019 11:54:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id D5A3E86D7B for ; Thu, 19 Dec 2019 11:54:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tzSHIvultJP6 for ; Thu, 19 Dec 2019 11:54:48 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5F76F86DAA for ; Thu, 19 Dec 2019 11:54:47 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from elibr@mellanox.com) with ESMTPS (AES256-SHA encrypted); 19 Dec 2019 13:54:41 +0200 Received: from dev-r-vrt-215.mtr.labs.mlnx. (dev-r-vrt-215.mtr.labs.mlnx [10.212.215.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id xBJBserU014710; Thu, 19 Dec 2019 13:54:41 +0200 From: Eli Britstein To: dev@openvswitch.org, Ilya Maximets Date: Thu, 19 Dec 2019 11:54:30 +0000 Message-Id: <20191219115436.10354-13-elibr@mellanox.com> X-Mailer: git-send-email 2.14.5 In-Reply-To: <20191219115436.10354-1-elibr@mellanox.com> References: <20191219115436.10354-1-elibr@mellanox.com> Cc: Oz Shlomo , Simon Horman , Majd Dibbiny , Eli Britstein , Ameer Mahagneh Subject: [ovs-dev] [PATCH V6 12/18] netdev-dpdk: Getter function for dpdk port id API X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Add a getter function for using the dpdk port id outside the scope of netdev-dpdk.c to be used for HW offload. Signed-off-by: Eli Britstein Reviewed-by: Oz Shlomo --- lib/netdev-dpdk.c | 18 ++++++++++++++++++ lib/netdev-dpdk.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 74fc9a99c..149561149 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -4476,6 +4476,24 @@ unlock: return err; } +int +netdev_dpdk_get_port_id(struct netdev *netdev) +{ + struct netdev_dpdk *dev; + int ret = -1; + + if (!is_dpdk_class(netdev->netdev_class)) { + goto out; + } + + dev = netdev_dpdk_cast(netdev); + ovs_mutex_lock(&dev->mutex); + ret = dev->port_id; + ovs_mutex_unlock(&dev->mutex); +out: + return ret; +} + bool netdev_dpdk_flow_api_supported(struct netdev *netdev) { diff --git a/lib/netdev-dpdk.h b/lib/netdev-dpdk.h index 59919a89a..848346cb4 100644 --- a/lib/netdev-dpdk.h +++ b/lib/netdev-dpdk.h @@ -53,6 +53,8 @@ netdev_dpdk_rte_flow_query_count(struct netdev *netdev, struct rte_flow *rte_flow, struct rte_flow_query_count *query, struct rte_flow_error *error); +int +netdev_dpdk_get_port_id(struct netdev *netdev); #else