From patchwork Mon Jan 20 15:08:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Britstein X-Patchwork-Id: 1226025 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.136; helo=silver.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 silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 481ZpL0MxXz9sS9 for ; Tue, 21 Jan 2020 02:09:46 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 8F05622EE7; Mon, 20 Jan 2020 15:09:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HSOBMqcWYUXO; Mon, 20 Jan 2020 15:09:36 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 45DE6204BA; Mon, 20 Jan 2020 15:09:05 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 241B1C1D8A; Mon, 20 Jan 2020 15:09:05 +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 D00A6C1D88 for ; Mon, 20 Jan 2020 15:08:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id BEA5C857B0 for ; Mon, 20 Jan 2020 15:08:56 +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 VsCipI5YgutV for ; Mon, 20 Jan 2020 15:08:50 +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 13AC385775 for ; Mon, 20 Jan 2020 15:08:49 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from elibr@mellanox.com) with ESMTPS (AES256-SHA encrypted); 20 Jan 2020 17:08:45 +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 00KF8hV9013116; Mon, 20 Jan 2020 17:08:45 +0200 From: Eli Britstein To: dev@openvswitch.org, Ilya Maximets Date: Mon, 20 Jan 2020 15:08:24 +0000 Message-Id: <20200120150830.16262-20-elibr@mellanox.com> X-Mailer: git-send-email 2.14.5 In-Reply-To: <20200120150830.16262-1-elibr@mellanox.com> References: <20200120150830.16262-1-elibr@mellanox.com> Cc: Simon Horman , Eli Britstein , Ameer Mahagneh Subject: [ovs-dev] [PATCH 19/25] netdev-dpdk: Introduce an API to query if a dpdk port is an uplink port 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" From: Ophir Munk When a vport is offloaded it has no explicit matching physical port so rte_flows are created on each of the uplink ports. Add an API to query if a DPDK port is an uplink port, as a pre-step towards applying vport flows on the uplink ports. Co-authored-by: Eli Britstein Signed-off-by: Ophir Munk Reviewed-by: Roni Bar Yanai Signed-off-by: Eli Britstein --- lib/netdev-dpdk.c | 21 +++++++++++++++++++++ lib/netdev-dpdk.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index b108cbd6b..52a3bc153 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -460,6 +460,7 @@ struct netdev_dpdk { }; struct dpdk_tx_queue *tx_q; struct rte_eth_link link; + bool is_uplink_port; /* True=uplink port, false=representor port. */ ); PADDED_MEMBERS_CACHELINE_MARKER(CACHE_LINE_SIZE, cacheline1, @@ -1139,6 +1140,8 @@ dpdk_eth_dev_init(struct netdev_dpdk *dev) VLOG_WARN("Tx TSO offload is not supported on %s port " DPDK_PORT_ID_FMT, netdev_get_name(&dev->up), dev->port_id); } + dev->is_uplink_port = !(*info.dev_flags & RTE_ETH_DEV_REPRESENTOR) && + info.switch_info.domain_id != RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID; n_rxq = MIN(info.max_rx_queues, dev->up.n_rxq); n_txq = MIN(info.max_tx_queues, dev->up.n_txq); @@ -5295,6 +5298,24 @@ out: return ret; } +bool +netdev_dpdk_is_uplink_port(struct netdev *netdev) +{ + struct netdev_dpdk *dev; + bool ret = false; + + if (!is_dpdk_class(netdev->netdev_class)) { + goto out; + } + + dev = netdev_dpdk_cast(netdev); + ovs_mutex_lock(&dev->mutex); + ret = dev->is_uplink_port; + 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 848346cb4..abda4a865 100644 --- a/lib/netdev-dpdk.h +++ b/lib/netdev-dpdk.h @@ -55,6 +55,8 @@ netdev_dpdk_rte_flow_query_count(struct netdev *netdev, struct rte_flow_error *error); int netdev_dpdk_get_port_id(struct netdev *netdev); +bool +netdev_dpdk_is_uplink_port(struct netdev *netdev); #else