From patchwork Thu Jan 27 13:34:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eelco Chaudron X-Patchwork-Id: 1585047 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=dT5QcABq; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Jl1n36rYsz9t6h for ; Fri, 28 Jan 2022 00:35:35 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 8EAB340BE5; Thu, 27 Jan 2022 13:35:33 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wiEmfiUrQOb8; Thu, 27 Jan 2022 13:35:32 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id 076EB40BD3; Thu, 27 Jan 2022 13:35:30 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id CBF8DC0021; Thu, 27 Jan 2022 13:35:30 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0F253C000B for ; Thu, 27 Jan 2022 13:35:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C0A38610EE for ; Thu, 27 Jan 2022 13:35:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com 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 PhiC3QuRqzLx for ; Thu, 27 Jan 2022 13:35:02 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 1C944610D7 for ; Thu, 27 Jan 2022 13:35:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643290501; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R5bXvJRksEUNPtMx42TwjDHkuf3ZZUSUl3W+T86iGAs=; b=dT5QcABq+1dlvvXH2n3+J/jUNbxCqlZUTkpRTB25Z3MQIOEJx0UnsDtC3WQHOYEFy6xmf0 z9+/HtTmnFRKX8DskANSj3+T3LL2NllzepLGt9YJhPAqHRTwqIK//ND3NR/rit+rOXQHB9 ue8nezNlAFXZvx0ZuwmpNcdnH+KV9L8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-127-xfIgJ0h_PX-rFpVqcymXeQ-1; Thu, 27 Jan 2022 08:34:59 -0500 X-MC-Unique: xfIgJ0h_PX-rFpVqcymXeQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2C3A810B744E for ; Thu, 27 Jan 2022 13:34:58 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.194.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id A89E77DE26 for ; Thu, 27 Jan 2022 13:34:57 +0000 (UTC) From: Eelco Chaudron To: dev@openvswitch.org Date: Thu, 27 Jan 2022 14:34:46 +0100 Message-Id: <164329048673.2583748.5352493729960470353.stgit@ebuild> In-Reply-To: <164329034474.2583748.797764334065223944.stgit@ebuild> References: <164329034474.2583748.797764334065223944.stgit@ebuild> User-Agent: StGit/1.1 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=echaudro@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH 08/10] netdev-offload-tc: Check for none offloadable ct_state flag combination 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 patch checks for none offloadable ct_state match flag combinations. If they exist tell the user about it once, and ignore the offload. Signed-off-by: Eelco Chaudron --- lib/netdev-offload-tc.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c index 8135441c6..f3d1d3e61 100644 --- a/lib/netdev-offload-tc.c +++ b/lib/netdev-offload-tc.c @@ -1478,14 +1478,14 @@ flower_match_to_tun_opt(struct tc_flower *flower, const struct flow_tnl *tnl, flower->mask.tunnel.metadata.present.len = tnl->metadata.present.len; } -static void +static int parse_match_ct_state_to_flower(struct tc_flower *flower, struct match *match) { const struct flow *key = &match->flow; struct flow *mask = &match->wc.masks; if (!ct_state_support) { - return; + return 0; } if ((ct_state_support & mask->ct_state) == mask->ct_state) { @@ -1541,6 +1541,13 @@ parse_match_ct_state_to_flower(struct tc_flower *flower, struct match *match) flower->key.ct_state &= ~(TCA_FLOWER_KEY_CT_FLAGS_NEW); flower->mask.ct_state &= ~(TCA_FLOWER_KEY_CT_FLAGS_NEW); } + + if (flower->key.ct_state && + !(flower->key.ct_state & TCA_FLOWER_KEY_CT_FLAGS_TRACKED)) { + VLOG_INFO_ONCE("For ct_state match offload to work, you must " + "include +trk with any other flags set!"); + return EOPNOTSUPP; + } } if (mask->ct_zone) { @@ -1560,6 +1567,8 @@ parse_match_ct_state_to_flower(struct tc_flower *flower, struct match *match) flower->mask.ct_label = mask->ct_label; mask->ct_label = OVS_U128_ZERO; } + + return 0; } static int @@ -1814,7 +1823,10 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match, } } - parse_match_ct_state_to_flower(&flower, match); + err = parse_match_ct_state_to_flower(&flower, match); + if (err) { + return err; + } /* ignore exact match on skb_mark of 0. */ if (mask->pkt_mark == UINT32_MAX && !key->pkt_mark) {