From patchwork Tue Dec 8 17:27:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Van Haaren, Harry" X-Patchwork-Id: 1412801 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=intel.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 4Cr6cp11Ywz9sW9 for ; Wed, 9 Dec 2020 04:29:46 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 69A162E2CF; Tue, 8 Dec 2020 17:29: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 Gh-7fm6m8oU9; Tue, 8 Dec 2020 17:29:37 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 594EA2E2D0; Tue, 8 Dec 2020 17:28:40 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0086BC163C; Tue, 8 Dec 2020 17:28:39 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id A5BA7C1D9F for ; Tue, 8 Dec 2020 17:28:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 7D80E2E2CA for ; Tue, 8 Dec 2020 17:28:38 +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 LgW6nGOs3rA8 for ; Tue, 8 Dec 2020 17:28:30 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by silver.osuosl.org (Postfix) with ESMTPS id 4733520455 for ; Tue, 8 Dec 2020 17:28:20 +0000 (UTC) IronPort-SDR: f5qNu0sRmSw5bX01pZKHR8ugL3WjkPXHmQKeAa7fRakdEFH+U3Q/1WFSplCw09eUvTm8ERHd8f o2tFwW8AyvFQ== X-IronPort-AV: E=McAfee;i="6000,8403,9829"; a="238039046" X-IronPort-AV: E=Sophos;i="5.78,403,1599548400"; d="scan'208";a="238039046" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2020 09:28:18 -0800 IronPort-SDR: Bx2dyyZIP0K7iV6HdtoMH+7WePbp3trpQna5jeaP+jFrJjL4F5PtF4SjYPn1ukqwJHownzhUw9 S5FNRBmOdkBg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,403,1599548400"; d="scan'208";a="407699800" Received: from silpixa00400633.ir.intel.com ([10.237.213.44]) by orsmga001.jf.intel.com with ESMTP; 08 Dec 2020 09:28:16 -0800 From: Harry van Haaren To: ovs-dev@openvswitch.org Date: Tue, 8 Dec 2020 17:27:44 +0000 Message-Id: <20201208172753.349273-7-harry.van.haaren@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201208172753.349273-1-harry.van.haaren@intel.com> References: <20201203193747.807120-2-harry.van.haaren@intel.com> <20201208172753.349273-1-harry.van.haaren@intel.com> MIME-Version: 1.0 Cc: i.maximets@ovn.org Subject: [ovs-dev] [PATCH v6 06/15] dpif-avx512: Add HWOL support to avx512 dpif 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: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Partial hardware offload is implemented in a very similar way to the scalar dpif. Signed-off-by: Harry van Haaren --- lib/dpif-netdev-avx512.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/lib/dpif-netdev-avx512.c b/lib/dpif-netdev-avx512.c index b2d437b2b..e0803136e 100644 --- a/lib/dpif-netdev-avx512.c +++ b/lib/dpif-netdev-avx512.c @@ -27,6 +27,7 @@ #include "dpif-netdev-private-dpcls.h" #include "dpif-netdev-private-flow.h" #include "dpif-netdev-private-thread.h" +#include "dpif-netdev-private-hwol.h" #include "dp-packet.h" #include "netdev.h" @@ -98,9 +99,32 @@ dp_netdev_input_outer_avx512(struct dp_netdev_pmd_thread *pmd, uint32_t i = __builtin_ctz(iter); iter = _blsr_u64(iter); - /* Initialize packet md and do miniflow extract */ + /* Get packet pointer from bitmask and packet md */ struct dp_packet *packet = packets->packets[i]; pkt_metadata_init(&packet->md, in_port); + + struct dp_netdev_flow *f = NULL; + + /* Check for partial hardware offload mark */ + uint32_t mark; + if (dp_packet_has_flow_mark(packet, &mark)) { + f = mark_to_flow_find(pmd, mark); + if (f) { + rules[i] = &f->cr; + + /* This is nasty - instead of using the HWOL provided flow, + * parse the packet data anyway to find the location of the TCP + * header to extract the TCP flags for the rule. + */ + pkt_meta[i].tcp_flags = parse_tcp_flags(packet); + + pkt_meta[i].bytes = dp_packet_size(packet); + hwol_emc_smc_hitmask |= (1 << i); + continue; + } + } + + /* Do miniflow extract into keys */ struct netdev_flow_key *key = &keys[i]; miniflow_extract(packet, &key->mf); @@ -111,8 +135,6 @@ dp_netdev_input_outer_avx512(struct dp_netdev_pmd_thread *pmd, key->len = netdev_flow_key_size(miniflow_n_values(&key->mf)); key->hash = dpif_netdev_packet_get_rss_hash_orig_pkt(packet, &key->mf); - struct dp_netdev_flow *f = NULL; - if (emc_enabled) { f = emc_lookup(&cache->emc_cache, key);