From patchwork Thu Jan 9 07:46:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Britstein X-Patchwork-Id: 1220204 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 47tdXK01MGz9s1x for ; Thu, 9 Jan 2020 18:48:32 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 3F19A86A1D; Thu, 9 Jan 2020 07:48:31 +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 e7S4sdSHNzje; Thu, 9 Jan 2020 07:48:28 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 3CD6686AB2; Thu, 9 Jan 2020 07:47:37 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 30CFBC1D8E; Thu, 9 Jan 2020 07:47:37 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9A736C1D8B for ; Thu, 9 Jan 2020 07:47:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 8005586B55 for ; Thu, 9 Jan 2020 07:47:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yIBR805pk3ep for ; Thu, 9 Jan 2020 07:47:21 +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 whitealder.osuosl.org (Postfix) with ESMTP id 0648186969 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:13 +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 0097lCHO014600; Thu, 9 Jan 2020 09:47:13 +0200 From: Eli Britstein To: dev@openvswitch.org, Ilya Maximets Date: Thu, 9 Jan 2020 07:46:50 +0000 Message-Id: <20200109074655.1104-14-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 13/18] netdev-offload: Introduce a function to validate same flow api handle 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" Signed-off-by: Eli Britstein --- lib/netdev-offload-provider.h | 1 + lib/netdev-offload.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/lib/netdev-offload-provider.h b/lib/netdev-offload-provider.h index 4e1c4251d..5a809c0cd 100644 --- a/lib/netdev-offload-provider.h +++ b/lib/netdev-offload-provider.h @@ -89,6 +89,7 @@ struct netdev_flow_api { int netdev_register_flow_api_provider(const struct netdev_flow_api *); int netdev_unregister_flow_api_provider(const char *type); +bool netdev_flow_api_equals(const struct netdev *, const struct netdev *); #ifdef __linux__ extern const struct netdev_flow_api netdev_offload_tc; diff --git a/lib/netdev-offload.c b/lib/netdev-offload.c index ae01acda6..32eab5910 100644 --- a/lib/netdev-offload.c +++ b/lib/netdev-offload.c @@ -156,6 +156,18 @@ netdev_unregister_flow_api_provider(const char *type) return error; } +bool +netdev_flow_api_equals(const struct netdev *netdev1, + const struct netdev *netdev2) +{ + const struct netdev_flow_api *netdev_flow_api1 = + ovsrcu_get(const struct netdev_flow_api *, &netdev1->flow_api); + const struct netdev_flow_api *netdev_flow_api2 = + ovsrcu_get(const struct netdev_flow_api *, &netdev2->flow_api); + + return netdev_flow_api1 == netdev_flow_api2; +} + static int netdev_assign_flow_api(struct netdev *netdev) {