From patchwork Mon Jan 20 15:08:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Britstein X-Patchwork-Id: 1226032 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 481Zpz4mPgz9sS9 for ; Tue, 21 Jan 2020 02:10:19 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 01B0C2263E; Mon, 20 Jan 2020 15:10:18 +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 bG5rplWVg8sa; Mon, 20 Jan 2020 15:10:11 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id D4A3E22650; Mon, 20 Jan 2020 15:09:11 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id BDC10C1D8D; Mon, 20 Jan 2020 15:09:11 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 44AF4C0176 for ; Mon, 20 Jan 2020 15:08:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 309798750A for ; Mon, 20 Jan 2020 15:08:58 +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 76JH0EfKDoOR 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 hemlock.osuosl.org (Postfix) with ESMTP id 1714C873BC 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:44 +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 00KF8hV3013116; Mon, 20 Jan 2020 17:08:44 +0200 From: Eli Britstein To: dev@openvswitch.org, Ilya Maximets Date: Mon, 20 Jan 2020 15:08:18 +0000 Message-Id: <20200120150830.16262-14-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 13/25] netdev-offload: Add HW miss packet state recover 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" From: Oz Shlomo When the HW offload involves multiple flows, like in tunnel decap path, it is possible that not all flows in the path are offloaded, resulting in partial processing in HW. In order to proceed the rest of the processing in SW, the packet has to be recovered to its state as if it was processed in SW from the beginning of the path. Add API for that. Co-authored-by: Ophir Munk Co-authored-by: Eli Britstein Signed-off-by: Oz Shlomo Reviewed-by: Roni Bar Yanai Signed-off-by: Eli Britstein --- lib/netdev-offload-provider.h | 6 ++++++ lib/netdev-offload.c | 14 ++++++++++++++ lib/netdev-offload.h | 3 +++ 3 files changed, 23 insertions(+) diff --git a/lib/netdev-offload-provider.h b/lib/netdev-offload-provider.h index 5a809c0cd..22de2247e 100644 --- a/lib/netdev-offload-provider.h +++ b/lib/netdev-offload-provider.h @@ -82,6 +82,12 @@ struct netdev_flow_api { int (*flow_del)(struct netdev *, const ovs_u128 *ufid, struct dpif_flow_stats *); + /* Recover the packet state (contents and data) for continued processing + * in software. + * Return 0 if successful, otherwise returns a positive errno value. */ + int (*hw_miss_packet_recover)(struct netdev *, uint32_t flow_miss_ctx_id, + struct dp_packet *); + /* Initializies the netdev flow api. * Return 0 if successful, otherwise returns a positive errno value. */ int (*init_flow_api)(struct netdev *); diff --git a/lib/netdev-offload.c b/lib/netdev-offload.c index 3469b71c6..7c24ecb75 100644 --- a/lib/netdev-offload.c +++ b/lib/netdev-offload.c @@ -255,6 +255,20 @@ netdev_flow_put(struct netdev *netdev, struct match *match, : EOPNOTSUPP; } +int +netdev_hw_miss_packet_recover(struct netdev *netdev, + uint32_t flow_miss_ctx_id, + struct dp_packet *packet) +{ + const struct netdev_flow_api *flow_api = + ovsrcu_get(const struct netdev_flow_api *, &netdev->flow_api); + + return (flow_api && flow_api->hw_miss_packet_recover) + ? flow_api->hw_miss_packet_recover(netdev, flow_miss_ctx_id, + packet) + : EOPNOTSUPP; +} + int netdev_flow_get(struct netdev *netdev, struct match *match, struct nlattr **actions, const ovs_u128 *ufid, diff --git a/lib/netdev-offload.h b/lib/netdev-offload.h index 25ff308df..3b5e636f0 100644 --- a/lib/netdev-offload.h +++ b/lib/netdev-offload.h @@ -87,6 +87,9 @@ bool netdev_flow_dump_next(struct netdev_flow_dump *, struct match *, int netdev_flow_put(struct netdev *, struct match *, struct nlattr *actions, size_t actions_len, const ovs_u128 *, struct offload_info *, struct dpif_flow_stats *); +int netdev_hw_miss_packet_recover(struct netdev *netdev, + uint32_t flow_miss_ctx_id, + struct dp_packet *packet); int netdev_flow_get(struct netdev *, struct match *, struct nlattr **actions, const ovs_u128 *, struct dpif_flow_stats *, struct dpif_flow_attrs *, struct ofpbuf *wbuffer);