From patchwork Fri Feb 12 17:17:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Van Haaren, Harry" X-Patchwork-Id: 1439947 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=) 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 4DcgDk5rVYz9sTD for ; Sat, 13 Feb 2021 04:17:58 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 3CEE987616; Fri, 12 Feb 2021 17:17: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 OMpgZkUkvLUP; Fri, 12 Feb 2021 17:17:50 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id DA17C875EE; Fri, 12 Feb 2021 17:17:50 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C8DD7C1834; Fri, 12 Feb 2021 17:17:50 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id D1EEDC013A for ; Fri, 12 Feb 2021 17:17:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 936E56F8B8 for ; Fri, 12 Feb 2021 17:17:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kd1gHtMb8Qvl for ; Fri, 12 Feb 2021 17:17:48 +0000 (UTC) Received: by smtp3.osuosl.org (Postfix, from userid 1001) id C0AD96F8AB; Fri, 12 Feb 2021 17:17:48 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by smtp3.osuosl.org (Postfix) with ESMTPS id EB6816F79E for ; Fri, 12 Feb 2021 17:17:39 +0000 (UTC) IronPort-SDR: ulExf0wuJp7Q6CJOsj+nfuhHFLOr9ZEQgIjGcDrgJyV6V8S4BdRXevzpxD49neTtUEgMrQ226s ZodynCngfwAw== X-IronPort-AV: E=McAfee;i="6000,8403,9893"; a="201595220" X-IronPort-AV: E=Sophos;i="5.81,174,1610438400"; d="scan'208";a="201595220" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2021 09:17:39 -0800 IronPort-SDR: eh06UsKwn48LeXvI0GKUzieqMC8xxc670DXYgO1VcQYdCeNRE/hyW1/vXhIm/zQsNOAmnMtL2k 5szS+Xz5tCgA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,174,1610438400"; d="scan'208";a="360484943" Received: from silpixa00400633.ir.intel.com ([10.237.213.44]) by orsmga003.jf.intel.com with ESMTP; 12 Feb 2021 09:17:38 -0800 From: Harry van Haaren To: ovs-dev@openvswitch.org Date: Fri, 12 Feb 2021 17:17:07 +0000 Message-Id: <20210212171718.2189798-6-harry.van.haaren@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212171718.2189798-1-harry.van.haaren@intel.com> References: <20210104163653.2218575-1-harry.van.haaren@intel.com> <20210212171718.2189798-1-harry.van.haaren@intel.com> MIME-Version: 1.0 Cc: i.maximets@ovn.org Subject: [ovs-dev] [PATCH v9 05/16] 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 10228aeb0..caba1fa1c 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" @@ -111,9 +112,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); @@ -124,8 +148,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);