From patchwork Mon Jan 20 15:08:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Britstein X-Patchwork-Id: 1226012 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.138; helo=whitealder.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 whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 481ZnV1SBRz9sRk for ; Tue, 21 Jan 2020 02:08:59 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id E9290826D3; Mon, 20 Jan 2020 15:08:57 +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 rljBqCY010jJ; Mon, 20 Jan 2020 15:08:53 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 82E28853F8; Mon, 20 Jan 2020 15:08:53 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 579D2C0176; Mon, 20 Jan 2020 15:08:53 +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 89328C0174 for ; Mon, 20 Jan 2020 15:08:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 6FBDA8140D for ; Mon, 20 Jan 2020 15:08:52 +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 GfpmgA7SpqV3 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 whitealder.osuosl.org (Postfix) with ESMTP id 13C188583C 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 00KF8hV4013116; Mon, 20 Jan 2020 17:08:44 +0200 From: Eli Britstein To: dev@openvswitch.org, Ilya Maximets Date: Mon, 20 Jan 2020 15:08:19 +0000 Message-Id: <20200120150830.16262-15-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 14/25] netdev-offload-dpdk: Implement HW miss packet recover for vport 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" A miss in virtual port offloads means the flow with tnl_pop was offloaded, but not the following one. Recover the state and continue with SW processing. Co-authored-by: Eli Britstein Signed-off-by: Ophir Munk Reviewed-by: Roni Bar Yanai Signed-off-by: Eli Britstein --- lib/netdev-offload-dpdk.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c index fc890b915..c4d77c115 100644 --- a/lib/netdev-offload-dpdk.c +++ b/lib/netdev-offload-dpdk.c @@ -385,7 +385,6 @@ put_flow_miss_ctx_id(uint32_t flow_ctx_id) put_context_data_by_id(&flow_miss_ctx_md, flow_ctx_id); } -OVS_UNUSED static int find_flow_miss_ctx(int flow_ctx_id, struct flow_miss_ctx *ctx) { @@ -1769,10 +1768,43 @@ out: return ret; } +static int +netdev_offload_dpdk_hw_miss_packet_recover(struct netdev *netdev, + uint32_t flow_miss_ctx_id, + struct dp_packet *packet) +{ + struct flow_miss_ctx flow_miss_ctx; + struct netdev *vport_netdev; + + if (find_flow_miss_ctx(flow_miss_ctx_id, &flow_miss_ctx)) { + return -1; + } + + if (flow_miss_ctx.vport != ODPP_NONE) { + vport_netdev = netdev_ports_get(flow_miss_ctx.vport, + netdev->dpif_type); + if (vport_netdev) { + pkt_metadata_init(&packet->md, flow_miss_ctx.vport); + if (vport_netdev->netdev_class->pop_header) { + vport_netdev->netdev_class->pop_header(packet); + dp_packet_reset_offload(packet); + packet->md.in_port.odp_port = flow_miss_ctx.vport; + } else { + VLOG_ERR("vport nedtdev=%s with no pop_header method", + netdev_get_name(vport_netdev)); + } + netdev_close(vport_netdev); + } + } + + return 0; +} + const struct netdev_flow_api netdev_offload_dpdk = { .type = "dpdk_flow_api", .flow_put = netdev_offload_dpdk_flow_put, .flow_del = netdev_offload_dpdk_flow_del, .init_flow_api = netdev_offload_dpdk_init_flow_api, .flow_get = netdev_offload_dpdk_flow_get, + .hw_miss_packet_recover = netdev_offload_dpdk_hw_miss_packet_recover, };