From patchwork Sun Aug 14 14:45:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 1666192 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=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M5Kws0RJqz9s1l for ; Mon, 15 Aug 2022 00:46:19 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 066D04136B; Sun, 14 Aug 2022 14:46:17 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 066D04136B X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8Lu5CcTMkv13; Sun, 14 Aug 2022 14:46:15 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id BDF5341484; Sun, 14 Aug 2022 14:46:14 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org BDF5341484 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 94085C0033; Sun, 14 Aug 2022 14:46:14 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id ADCD7C002D for ; Sun, 14 Aug 2022 14:46:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 85DE441484 for ; Sun, 14 Aug 2022 14:46:13 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 85DE441484 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1zH8bEFK0NS4 for ; Sun, 14 Aug 2022 14:46:12 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 1B56B4136B Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by smtp4.osuosl.org (Postfix) with ESMTPS id 1B56B4136B for ; Sun, 14 Aug 2022 14:46:11 +0000 (UTC) Received: (Authenticated sender: i.maximets@ovn.org) by mail.gandi.net (Postfix) with ESMTPSA id 8B123E0002; Sun, 14 Aug 2022 14:46:07 +0000 (UTC) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Sun, 14 Aug 2022 16:45:58 +0200 Message-Id: <20220814144603.2058894-1-i.maximets@ovn.org> X-Mailer: git-send-email 2.34.3 MIME-Version: 1.0 Cc: Paul Blakey , Ilya Maximets Subject: [ovs-dev] [PATCH v3 0/5] tc: Fixes for tunnel offloading. 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" This is started from the issue with broken ERSPAN tunnel reported by Eelco, but turned out a much wider problem with ignoring different tunnel keys and flags while constructing TC flower. Some of that can be fixed, some can't be fixed due to lack of support from kernel. Strictly speaking, we should have prohibit silent ignoring of everything including DONT_FRAGMENT and CSUM tunnel flags, but that will break the tunnel offloading entirely. So, partially keeping incorrect behaviour for now, fixing the most broken bits. To have a more or less viable solution, TC in kernel should add support for TUNNEL_DONT_FRAGMENT in set tunnel key action (also, TUNNEL_OAM support would be nice). And we also need support to match on them, i.e. support for: TCA_FLOWER_KEY_ENC_DONT_FRAGMENT TCA_FLOWER_KEY_ENC_NO_CSUM TCA_FLOWER_KEY_ENC_OAM And corresponding _MASK keys as well. Maybe TCA_FLOWER_KEY_ENC_TUN_FLAGS instead? With that OVS will have to probe the kernel for support and use them or fail the offload. I didn't test these patches with real HW. Only checked system tests from check-offloads and normal check-kernel hacked with offlaods enabled. Version 3: - Added 'Reviewed-by' from Roi on patches 2, 3 and 5. - Fixed incorect read from the OVS_TUNNEL_KEY_ATTR_CSUM flag attribute. [Paul] - Re-worked setting/clearing FLOW_TNL_F_UDPIF flag along with the metadata.present.len, because flower always has an exact match on the length and the metadata is always in UDPIF format. [Roi] Version 2: - Added clear of tunnel masks on 'else' condition, since some bits can still be there even if the tunnel matching is not needed. - Instead of adding support for masked match on tp_dst, it just handled explicitly with exact match to avoid inability of offload on mlx5 NICs. - Added patch to fix mask of the tunnel metadata length. - 'Masks vs keys' fix stripped into a separate patch. - New patch added to handle tp_src that was kind of consumed by tc_flower structure but was never actually passed to/from TC. Ilya Maximets (5): netdev-offload-tc: Fix the mask for tunnel metadata length. netdev-offload-tc: Explicitly handle mask for the tunnel destination port. netdev-offload-tc: Use masks instead of keys while parsing tunnel attributes. netdev-offload-tc: Fix ignoring unknown tunnel keys. netdev-offload-tc: Add missing handling of the tunnel source port. lib/dpif-netlink.c | 14 +--- lib/netdev-offload-tc.c | 139 +++++++++++++++++++++++++++++++++------- lib/netdev-offload.h | 3 - lib/tc.c | 43 +++++++++++-- 4 files changed, 153 insertions(+), 46 deletions(-)