From patchwork Thu Jan 9 07:46:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Britstein X-Patchwork-Id: 1220188 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.137; helo=fraxinus.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 fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47tdW471phz9s1x for ; Thu, 9 Jan 2020 18:47:28 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 168C88626C; Thu, 9 Jan 2020 07:47:27 +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 k44yOIunkF8l; Thu, 9 Jan 2020 07:47:24 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 9E5168609D; Thu, 9 Jan 2020 07:47:23 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 85353C1D8D; Thu, 9 Jan 2020 07:47:23 +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 A786BC0881 for ; Thu, 9 Jan 2020 07:47:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 8F93B85FCB for ; Thu, 9 Jan 2020 07:47:21 +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 9_LlVnhl_eGj for ; Thu, 9 Jan 2020 07:47:20 +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 D0FBB85F7C for ; Thu, 9 Jan 2020 07:47:18 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from elibr@mellanox.com) with ESMTPS (AES256-SHA encrypted); 9 Jan 2020 09:47:12 +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 0097lCHG014600; Thu, 9 Jan 2020 09:47:12 +0200 From: Eli Britstein To: dev@openvswitch.org, Ilya Maximets Date: Thu, 9 Jan 2020 07:46:42 +0000 Message-Id: <20200109074655.1104-6-elibr@mellanox.com> X-Mailer: git-send-email 2.14.5 In-Reply-To: <20200109074655.1104-1-elibr@mellanox.com> References: <20200109074655.1104-1-elibr@mellanox.com> Cc: Simon Horman , Eli Britstein , Ameer Mahagneh Subject: [ovs-dev] [PATCH V7 05/18] netdev-dpdk: Introduce rte flow query function 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" Introduce a rte flow query function as a pre-step towards reading HW statistics of fully offloaded flows. Signed-off-by: Eli Britstein Reviewed-by: Oz Shlomo --- lib/netdev-dpdk.c | 30 ++++++++++++++++++++++++++++++ lib/netdev-dpdk.h | 6 ++++++ 2 files changed, 36 insertions(+) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 8198a0b7d..4ff5a70a8 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -4541,6 +4541,36 @@ netdev_dpdk_rte_flow_create(struct netdev *netdev, return flow; } +int +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) +{ + struct rte_flow_action_count count = { .shared = 0, .id = 0 }; + const struct rte_flow_action actions[] = { + { + .type = RTE_FLOW_ACTION_TYPE_COUNT, + .conf = &count, + }, + { + .type = RTE_FLOW_ACTION_TYPE_END, + }, + }; + struct netdev_dpdk *dev; + int ret; + + if (!is_dpdk_class(netdev->netdev_class)) { + return -1; + } + + dev = netdev_dpdk_cast(netdev); + ovs_mutex_lock(&dev->mutex); + ret = rte_flow_query(dev->port_id, rte_flow, actions, query, error); + ovs_mutex_unlock(&dev->mutex); + return ret; +} + #define NETDEV_DPDK_CLASS_COMMON \ .is_pmd = true, \ .alloc = netdev_dpdk_alloc, \ diff --git a/lib/netdev-dpdk.h b/lib/netdev-dpdk.h index 60631c4f0..59919a89a 100644 --- a/lib/netdev-dpdk.h +++ b/lib/netdev-dpdk.h @@ -31,6 +31,7 @@ struct rte_flow_error; struct rte_flow_attr; struct rte_flow_item; struct rte_flow_action; +struct rte_flow_query_count; void netdev_dpdk_register(void); void free_dpdk_buf(struct dp_packet *); @@ -47,6 +48,11 @@ netdev_dpdk_rte_flow_create(struct netdev *netdev, const struct rte_flow_item *items, const struct rte_flow_action *actions, struct rte_flow_error *error); +int +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); #else