From patchwork Tue Jun 11 23:53:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= X-Patchwork-Id: 13694296 X-Patchwork-Delegate: kuba@kernel.org Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F9B0156C7B; Tue, 11 Jun 2024 23:54:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718150069; cv=none; b=DU19Ajeyrq6+AMlJcUqngAT/izESzg5FUnMxAP6yXXBwSzpHuy/H+zjAyUBBBknHQAhndhCH13NcwN9c3zCm8ud9CVsuUjYXYMm409LOvPemEHPn3pP4rX6OYnPB2hWB/PRtpjejP84dPY+LRD/zSYoEqjsHd4scvhd3cSRBkxc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718150069; c=relaxed/simple; bh=18R9DZ9Qtk5UItDyEfDP4dTxRsB0nI9DrG9sBUtKLCQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ukzjBnUAShb7ofllt2wr562g9Z9bV21qCdXpsRFBCSHOaumjuL2LEWkf52p13mAClx68a0gISNf/5dCZ4k/edRbblsBdG0fYZax8akEkfoPsbv7TQUdLf2Gx09W0weQJl6HQ1pDaRaKYVJKu3wiZm9BuCL9KH2qhRTJAI3RO6AI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=naAs/BEb; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="naAs/BEb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1718150060; bh=18R9DZ9Qtk5UItDyEfDP4dTxRsB0nI9DrG9sBUtKLCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=naAs/BEb1VzBfR9c6dqqLneOPn1PgHf+O4+JG6fuzJOpY30iAlF4tBQA49sN3k7iv 5O71nULH+0G5AWKwTsDqwp6v5oiic0uSzem9pCTxLzRgTlj4Wb04tbZhyLR9iaj1bN dipUasOTa9rOCKu16Q3EzGfiHcbC7DeIhC3eeIjLJ6QzEY2kIWvo24pHkDNMOoaixY jtWw3EnZtCdsvvAzbeKVsQfeZd41R9VWOxajn+WDrq4lwHySLs0i6KcfuhXmIJ+gJc QkdAASQomV3FsJLPGf5QEl7c+hT5OBqY3uroxICqHDx41XyT89ExnYlhhCCK6qhYyB Dl94sfReVOcMQ== Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 4A3F060099; Tue, 11 Jun 2024 23:54:17 +0000 (UTC) Received: by x201s (Postfix, from userid 1000) id 5BF8E201ACA; Tue, 11 Jun 2024 23:54:00 +0000 (UTC) From: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= To: Davide Caratti , Ilya Maximets , Jamal Hadi Salim , Cong Wang , Jiri Pirko Cc: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Ahern , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next 1/9] net/sched: flower: define new tunnel flags Date: Tue, 11 Jun 2024 23:53:34 +0000 Message-ID: <20240611235355.177667-2-ast@fiberby.net> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240611235355.177667-1-ast@fiberby.net> References: <20240611235355.177667-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Define new TCA_FLOWER_KEY_FLAGS_* flags for use in struct flow_dissector_key_control, covering the same flags as currently exposed through TCA_FLOWER_KEY_ENC_FLAGS, but assign them new bit positions in so that they don't conflict with existing TCA_FLOWER_KEY_FLAGS_* flags. Synchronize FLOW_DIS_* flags, but put the new flags under FLOW_DIS_F_*. The idea is that we can later, move the existing flags under FLOW_DIS_F_* as well. Signed-off-by: Asbjørn Sloth Tønnesen --- include/net/flow_dissector.h | 17 +++++++++++++---- include/uapi/linux/pkt_cls.h | 5 +++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h index 99626475c3f4a..1f0fddb29a0d8 100644 --- a/include/net/flow_dissector.h +++ b/include/net/flow_dissector.h @@ -16,7 +16,8 @@ struct sk_buff; * struct flow_dissector_key_control: * @thoff: Transport header offset * @addr_type: Type of key. One of FLOW_DISSECTOR_KEY_* - * @flags: Key flags. Any of FLOW_DIS_(IS_FRAGMENT|FIRST_FRAGENCAPSULATION) + * @flags: Key flags. + * Any of FLOW_DIS_(IS_FRAGMENT|FIRST_FRAGENCAPSULATION|F_*) */ struct flow_dissector_key_control { u16 thoff; @@ -24,9 +25,17 @@ struct flow_dissector_key_control { u32 flags; }; -#define FLOW_DIS_IS_FRAGMENT BIT(0) -#define FLOW_DIS_FIRST_FRAG BIT(1) -#define FLOW_DIS_ENCAPSULATION BIT(2) +/* Please keep these flags in sync with TCA_FLOWER_KEY_FLAGS_* + * in include/uapi/linux/pkt_cls.h, as these bit flags are exposed + * to userspace in some error paths, ie. unsupported flags. + */ +#define FLOW_DIS_IS_FRAGMENT BIT(0) +#define FLOW_DIS_FIRST_FRAG BIT(1) +#define FLOW_DIS_ENCAPSULATION BIT(2) +#define FLOW_DIS_F_TUNNEL_CSUM BIT(3) +#define FLOW_DIS_F_TUNNEL_DONT_FRAGMENT BIT(4) +#define FLOW_DIS_F_TUNNEL_OAM BIT(5) +#define FLOW_DIS_F_TUNNEL_CRIT_OPT BIT(6) enum flow_dissect_ret { FLOW_DISSECT_RET_OUT_GOOD, diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h index b6d38f5fd7c05..24795aad76518 100644 --- a/include/uapi/linux/pkt_cls.h +++ b/include/uapi/linux/pkt_cls.h @@ -677,6 +677,11 @@ enum { enum { TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT = (1 << 0), TCA_FLOWER_KEY_FLAGS_FRAG_IS_FIRST = (1 << 1), + /* FLOW_DIS_ENCAPSULATION (1 << 2) is not exposed to userspace */ + TCA_FLOWER_KEY_FLAGS_TUNNEL_CSUM = (1 << 3), + TCA_FLOWER_KEY_FLAGS_TUNNEL_DONT_FRAGMENT = (1 << 4), + TCA_FLOWER_KEY_FLAGS_TUNNEL_OAM = (1 << 5), + TCA_FLOWER_KEY_FLAGS_TUNNEL_CRIT_OPT = (1 << 6), }; enum { From patchwork Tue Jun 11 23:53:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= X-Patchwork-Id: 13694297 X-Patchwork-Delegate: kuba@kernel.org Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E243F156F26; Tue, 11 Jun 2024 23:54:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718150069; cv=none; b=KiiKkedSRGXQexlK093QDBVIbaMEm9ermCR67TEau7QhqAhIAQ0tuSYi3ySwHBSKRibOJ/azs3UOH8d4Gf/rRoPN7rPQ8r1acRp3XcHAgiEA/6cYMXMe/8yVcI3G2DM9EgcmDLoJYgPbrPsBQicTm5kOCg0sjkFvUgOLinu3Ey0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718150069; c=relaxed/simple; bh=zATe/2n/zWdwcgm2mIZEJ9zy1kGHBOn2WYZ49kih8ms=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NLYti073XduFqBViSd2NWUK5EFFb92kChOXpQtikENbu9XpS50QAnCwnutL4gdAwf5KjsA/oW22zkSv/WluqFVSiTJP94AIzclp8OZyspsuKQj0lW64wX9zvb1ESmJeySR4SynmSvAWGClnRm9RqYDJUBlXQVCI3x6npDI41tRc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=cXhXVGdh; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="cXhXVGdh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1718150060; bh=zATe/2n/zWdwcgm2mIZEJ9zy1kGHBOn2WYZ49kih8ms=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cXhXVGdhYaLiGkQqorl0NYe68qgmF+N05ooKZjvjIfQkX6NvHJWjT/tPlH/luVj+Z XZ6RxTYuKNVXnlwZnjntVSt5mEjSa2B4iLmXlQVJCt4jq+b/vdqMzDDtwpdpzvPzMH II+ptZOJ/9iBJReV9gcsNFhxo7ZznwRBcGVk+lb4xZkwb9cNoTEhjPZeFXGSloTupY DkyrE3Czfo1AEkMp6m3bNj05YcsTNIX7pQ5/JP4x60ZC20F9Z/sskLPx4pkMw4Lq47 KGYxWsvMc+7ja63NmIerdf8b9IwHnL7WNj64WhDVruLq20JojswFc1kEfXwyIHlZmt WOqGSldHmd41A== Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 505DE6009C; Tue, 11 Jun 2024 23:54:17 +0000 (UTC) Received: by x201s (Postfix, from userid 1000) id 665A9202C29; Tue, 11 Jun 2024 23:54:00 +0000 (UTC) From: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= To: Davide Caratti , Ilya Maximets , Jamal Hadi Salim , Cong Wang , Jiri Pirko Cc: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Ahern , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next 2/9] net/sched: cls_flower: prepare fl_{set,dump}_key_flags() for ENC_FLAGS Date: Tue, 11 Jun 2024 23:53:35 +0000 Message-ID: <20240611235355.177667-3-ast@fiberby.net> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240611235355.177667-1-ast@fiberby.net> References: <20240611235355.177667-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Prepare fl_set_key_flags/fl_dump_key_flags() for use with TCA_FLOWER_KEY_ENC_FLAGS{,_MASK}. This patch adds an encap argument, similar to fl_set_key_ip/ fl_dump_key_ip(), and determine the flower keys based on the encap argument, and use them in the rest of the two functions. Since these functions are so far, only called with encap set false, then there is no functional change. Signed-off-by: Asbjørn Sloth Tønnesen --- net/sched/cls_flower.c | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index eef570c577ac7..6a5cecfd95619 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c @@ -1166,19 +1166,28 @@ static void fl_set_key_flag(u32 flower_key, u32 flower_mask, } } -static int fl_set_key_flags(struct nlattr **tb, u32 *flags_key, +static int fl_set_key_flags(struct nlattr **tb, bool encap, u32 *flags_key, u32 *flags_mask, struct netlink_ext_ack *extack) { + int fl_key, fl_mask; u32 key, mask; + if (encap) { + fl_key = TCA_FLOWER_KEY_ENC_FLAGS; + fl_mask = TCA_FLOWER_KEY_ENC_FLAGS_MASK; + } else { + fl_key = TCA_FLOWER_KEY_FLAGS; + fl_mask = TCA_FLOWER_KEY_FLAGS_MASK; + } + /* mask is mandatory for flags */ - if (!tb[TCA_FLOWER_KEY_FLAGS_MASK]) { + if (NL_REQ_ATTR_CHECK(extack, NULL, tb, fl_mask)) { NL_SET_ERR_MSG(extack, "Missing flags mask"); return -EINVAL; } - key = be32_to_cpu(nla_get_be32(tb[TCA_FLOWER_KEY_FLAGS])); - mask = be32_to_cpu(nla_get_be32(tb[TCA_FLOWER_KEY_FLAGS_MASK])); + key = be32_to_cpu(nla_get_be32(tb[fl_key])); + mask = be32_to_cpu(nla_get_be32(tb[fl_mask])); *flags_key = 0; *flags_mask = 0; @@ -2086,7 +2095,7 @@ static int fl_set_key(struct net *net, struct nlattr **tb, return ret; if (tb[TCA_FLOWER_KEY_FLAGS]) { - ret = fl_set_key_flags(tb, &key->control.flags, + ret = fl_set_key_flags(tb, false, &key->control.flags, &mask->control.flags, extack); if (ret) return ret; @@ -3084,12 +3093,22 @@ static void fl_get_key_flag(u32 dissector_key, u32 dissector_mask, } } -static int fl_dump_key_flags(struct sk_buff *skb, u32 flags_key, u32 flags_mask) +static int fl_dump_key_flags(struct sk_buff *skb, bool encap, + u32 flags_key, u32 flags_mask) { - u32 key, mask; + int fl_key, fl_mask; __be32 _key, _mask; + u32 key, mask; int err; + if (encap) { + fl_key = TCA_FLOWER_KEY_ENC_FLAGS; + fl_mask = TCA_FLOWER_KEY_ENC_FLAGS_MASK; + } else { + fl_key = TCA_FLOWER_KEY_FLAGS; + fl_mask = TCA_FLOWER_KEY_FLAGS_MASK; + } + if (!memchr_inv(&flags_mask, 0, sizeof(flags_mask))) return 0; @@ -3105,11 +3124,11 @@ static int fl_dump_key_flags(struct sk_buff *skb, u32 flags_key, u32 flags_mask) _key = cpu_to_be32(key); _mask = cpu_to_be32(mask); - err = nla_put(skb, TCA_FLOWER_KEY_FLAGS, 4, &_key); + err = nla_put(skb, fl_key, 4, &_key); if (err) return err; - return nla_put(skb, TCA_FLOWER_KEY_FLAGS_MASK, 4, &_mask); + return nla_put(skb, fl_mask, 4, &_mask); } static int fl_dump_key_geneve_opt(struct sk_buff *skb, @@ -3632,7 +3651,8 @@ static int fl_dump_key(struct sk_buff *skb, struct net *net, if (fl_dump_key_ct(skb, &key->ct, &mask->ct)) goto nla_put_failure; - if (fl_dump_key_flags(skb, key->control.flags, mask->control.flags)) + if (fl_dump_key_flags(skb, false, key->control.flags, + mask->control.flags)) goto nla_put_failure; if (fl_dump_key_val(skb, &key->hash.hash, TCA_FLOWER_KEY_HASH, From patchwork Tue Jun 11 23:53:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= X-Patchwork-Id: 13694300 X-Patchwork-Delegate: kuba@kernel.org Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4EE5156F29; Tue, 11 Jun 2024 23:54:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718150071; cv=none; b=Nj8rC/Xk27VOWPCDAiJ37O1kAlRBfOcDQ8+VSitSzpMPRf2nFE/lwS4Zntxgt5FZgBzlAlkOK1stxKt1EgCv91v3b6SAQT+YLC6AQdz0TE6T9szsg9+q/K+Pw2yQzTEjAU88umXhN9yL5FeS298AMhb1JjYuWRZu59whw1RYuJ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718150071; c=relaxed/simple; bh=VtZWuGrh1ylypaTQdU8aTLu6D7GfyOsmzUhjq6KIDwU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=c7C5PVTLC0+ppJFWlglSWJWDd0qGsyZkc2PP9RwtXPB6ASOavIe3/Aq6bkfGyrH1QYya9Hp/mtZwBlAXeXEAv4YpN5ii4vk9cWS9Im5yKT4x/zpF/swUUx3e5oNvj1jFGTI67r9zotkv/rai2n4uCneBEcFQf72hstVlm8/W4Xs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=tzl3N853; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="tzl3N853" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1718150060; bh=VtZWuGrh1ylypaTQdU8aTLu6D7GfyOsmzUhjq6KIDwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tzl3N853ldx1Vy8RVIE4f7klT3sIGqET1NC5ncXlItYPqG8YniyvJJpZIQZovihdz tsk5ebcSveeKwT1Z+cwKojy9zw4KCqKAd51/fI4QpE6WzqItL/8hSSF9qn7PgNbb6L 3jXVAJ0oPSqM4q16wogLB8YFQZlwDgF7GHED5SGmCHXKV98KiL6DQM6aW0kZw0t4Vo jSvD22gcgSJEUvl50vq5wK9LiVYZXsHnzrS4umf7EbmWOcpQk3wMUhssoV6yBNatsB IrAR7s8odiEwMeh/V9GuQY3Ko1nMY2DTnsn7qX43VWYAcQhz/SkjU2Yqumn+OKQh5x ToZF6MXf+MnIQ== Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 5D2B76009D; Tue, 11 Jun 2024 23:54:17 +0000 (UTC) Received: by x201s (Postfix, from userid 1000) id 6FD3D202E0F; Tue, 11 Jun 2024 23:54:00 +0000 (UTC) From: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= To: Davide Caratti , Ilya Maximets , Jamal Hadi Salim , Cong Wang , Jiri Pirko Cc: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Ahern , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next 3/9] net/sched: cls_flower: add policy for TCA_FLOWER_KEY_FLAGS Date: Tue, 11 Jun 2024 23:53:36 +0000 Message-ID: <20240611235355.177667-4-ast@fiberby.net> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240611235355.177667-1-ast@fiberby.net> References: <20240611235355.177667-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC This policy guards fl_set_key_flags() from seeing flags not used in the context of TCA_FLOWER_KEY_FLAGS. Signed-off-by: Asbjørn Sloth Tønnesen --- net/sched/cls_flower.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index 6a5cecfd95619..6a2afc31f038b 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c @@ -41,6 +41,10 @@ #define TCA_FLOWER_KEY_CT_FLAGS_MASK \ (TCA_FLOWER_KEY_CT_FLAGS_MAX - 1) +#define TCA_FLOWER_KEY_FLAGS_POLICY_MASK \ + (TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT | \ + TCA_FLOWER_KEY_FLAGS_FRAG_IS_FIRST) + #define TUNNEL_FLAGS_PRESENT (\ _BITUL(IP_TUNNEL_CSUM_BIT) | \ _BITUL(IP_TUNNEL_DONT_FRAGMENT_BIT) | \ @@ -676,8 +680,10 @@ static const struct nla_policy fl_policy[TCA_FLOWER_MAX + 1] = { [TCA_FLOWER_KEY_ENC_UDP_SRC_PORT_MASK] = { .type = NLA_U16 }, [TCA_FLOWER_KEY_ENC_UDP_DST_PORT] = { .type = NLA_U16 }, [TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK] = { .type = NLA_U16 }, - [TCA_FLOWER_KEY_FLAGS] = { .type = NLA_U32 }, - [TCA_FLOWER_KEY_FLAGS_MASK] = { .type = NLA_U32 }, + [TCA_FLOWER_KEY_FLAGS] = NLA_POLICY_MASK(NLA_U32, + TCA_FLOWER_KEY_FLAGS_POLICY_MASK), + [TCA_FLOWER_KEY_FLAGS_MASK] = NLA_POLICY_MASK(NLA_U32, + TCA_FLOWER_KEY_FLAGS_POLICY_MASK), [TCA_FLOWER_KEY_ICMPV4_TYPE] = { .type = NLA_U8 }, [TCA_FLOWER_KEY_ICMPV4_TYPE_MASK] = { .type = NLA_U8 }, [TCA_FLOWER_KEY_ICMPV4_CODE] = { .type = NLA_U8 }, From patchwork Tue Jun 11 23:53:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= X-Patchwork-Id: 13694293 X-Patchwork-Delegate: kuba@kernel.org Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F4BC156238; Tue, 11 Jun 2024 23:54:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718150067; cv=none; b=RkJwP1n3PTaVTD79rYk/1ilpQI1ii9NBkc2/a3U2nbRultqaKemguvw3+YTFo9w9RvwSt9CoA89Uv2rr/apPjLjjRN54HmQBBXUW/6JFG26SCMsMQN3o9/hocLdJSsH3wKUwHlp/dVDy4Qs04rlX5NwdK2tOnV8x2iudXvTV9No= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718150067; c=relaxed/simple; bh=hHIlmnwV2uoFflSw91rJfSS30wlcgJ7OWfJvy5pCPkk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RVX4rHZkOrxoiGFxdqwC6OEk+lrru4GG0hUbRGLGJq6xKQRfYt6iP3JlVmKkOTP3bwPvxNdTbxYuGW8EtzpVpTwYmCeMkYbbooUqUSJIT0jt8njZzaryeYRNW8XBXKJfKsEIyfEsmx7stEqKrccrLDOwcSTtcxZO758fybszK6g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=c36arCXm; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="c36arCXm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1718150057; bh=hHIlmnwV2uoFflSw91rJfSS30wlcgJ7OWfJvy5pCPkk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c36arCXman8NFNXDByQYdsfOQzJTTkkymSywHCnkPYLiBLaIeeIi43dKIRqb4lPh4 HHS0Rzx6m07HPoyEV4K/LwHxBL2J3zEfirSL61UuRtoeuAAS0ItqrombGOdftUuoK1 SdcbrupqMgfO2Xnrq1PiDo38SXMSrfWWSns2eM+BmYfLRRyK+TW7gki/5xAKlIk8C6 +ftiQY6sjszY9vHgfUwWVwqQTWZFGD8hShhn1Wv9osx0nKnpzESgQ4UwdqDyyHvnrP 5TdfHw7LP0FF/bEXYct36UbfHbBV9EQ7uHQh5pincXtfAQ8RhImm4nV6l9Zd8LEEKI iqJYDxKcXlb8A== Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 955B36007C; Tue, 11 Jun 2024 23:54:10 +0000 (UTC) Received: by x201s (Postfix, from userid 1000) id 79437202F2C; Tue, 11 Jun 2024 23:54:00 +0000 (UTC) From: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= To: Davide Caratti , Ilya Maximets , Jamal Hadi Salim , Cong Wang , Jiri Pirko Cc: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Ahern , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next 4/9] flow_dissector: prepare for encapsulated control flags Date: Tue, 11 Jun 2024 23:53:37 +0000 Message-ID: <20240611235355.177667-5-ast@fiberby.net> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240611235355.177667-1-ast@fiberby.net> References: <20240611235355.177667-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Rename skb_flow_dissect_set_enc_addr_type() to skb_flow_dissect_set_enc_control(), and make it set both addr_type and flags in FLOW_DISSECTOR_KEY_ENC_CONTROL. Signed-off-by: Asbjørn Sloth Tønnesen --- net/core/flow_dissector.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 59fe46077b3ca..86a11a01445ad 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -299,9 +299,10 @@ void skb_flow_dissect_meta(const struct sk_buff *skb, EXPORT_SYMBOL(skb_flow_dissect_meta); static void -skb_flow_dissect_set_enc_addr_type(enum flow_dissector_key_id type, - struct flow_dissector *flow_dissector, - void *target_container) +skb_flow_dissect_set_enc_control(enum flow_dissector_key_id type, + u32 ctrl_flags, + struct flow_dissector *flow_dissector, + void *target_container) { struct flow_dissector_key_control *ctrl; @@ -312,6 +313,7 @@ skb_flow_dissect_set_enc_addr_type(enum flow_dissector_key_id type, FLOW_DISSECTOR_KEY_ENC_CONTROL, target_container); ctrl->addr_type = type; + ctrl->flags = ctrl_flags; } void @@ -367,6 +369,7 @@ skb_flow_dissect_tunnel_info(const struct sk_buff *skb, { struct ip_tunnel_info *info; struct ip_tunnel_key *key; + u32 ctrl_flags = 0; /* A quick check to see if there might be something to do. */ if (!dissector_uses_key(flow_dissector, @@ -395,9 +398,9 @@ skb_flow_dissect_tunnel_info(const struct sk_buff *skb, switch (ip_tunnel_info_af(info)) { case AF_INET: - skb_flow_dissect_set_enc_addr_type(FLOW_DISSECTOR_KEY_IPV4_ADDRS, - flow_dissector, - target_container); + skb_flow_dissect_set_enc_control(FLOW_DISSECTOR_KEY_IPV4_ADDRS, + ctrl_flags, flow_dissector, + target_container); if (dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_ENC_IPV4_ADDRS)) { struct flow_dissector_key_ipv4_addrs *ipv4; @@ -410,9 +413,9 @@ skb_flow_dissect_tunnel_info(const struct sk_buff *skb, } break; case AF_INET6: - skb_flow_dissect_set_enc_addr_type(FLOW_DISSECTOR_KEY_IPV6_ADDRS, - flow_dissector, - target_container); + skb_flow_dissect_set_enc_control(FLOW_DISSECTOR_KEY_IPV6_ADDRS, + ctrl_flags, flow_dissector, + target_container); if (dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_ENC_IPV6_ADDRS)) { struct flow_dissector_key_ipv6_addrs *ipv6; From patchwork Tue Jun 11 23:53:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= X-Patchwork-Id: 13694295 X-Patchwork-Delegate: kuba@kernel.org Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77E36156883; Tue, 11 Jun 2024 23:54:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718150068; cv=none; b=rrnBzi6fdawfmGEED+iSxQQIYB1+OhtNaMyu6OvTS+NJ/cTNflSY8WE+1VLC8obaM/+OqC8yTLQ14XZAvAinq4adh8ccQZBxtQY/NA/vkeCRqFEO35MPDJWDKrdJETEeca76+zQDnJxlQAM24wyLdAeHchHS7qsO/T4AsaXLnEs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718150068; c=relaxed/simple; bh=uQ3bxVY+0T6qnIHKOOb0Ur6SpvSb5e5xHUZ/3GTatt4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IVeCWynK+Vthfktmit8eMPQw9ToeIE4SPQCqN9ARh2imC+Drz1iV0fpIROiqpCmfnSb0MPFgiE6dJQZeooVZ9bTzBL7w6sSAfK7Hgh+ej1a47jIUHk204ZKzoMY40rHA74zgks+u525gaS6ANAaQpVJMTgH9NdQBtcitFuvUgjg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=ikGFchdz; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="ikGFchdz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1718150057; bh=uQ3bxVY+0T6qnIHKOOb0Ur6SpvSb5e5xHUZ/3GTatt4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ikGFchdz4a38gulfVPIs0gavYDQsF52n6fpopDkeVBG3GnGXy2GzQjmg8MtaPEi3T KVCmVlyyfIVt0py69aDC87oXnrQfZklHEqBB1Xhx1EDKCsgTiNMBslbEFvpFVeuwnW ccXX9vLYRYFz7nKW633s57R7gMuRdbCZbQMwFXIgxMUqhngoKMhoS/sq2uQDpjno6L cV6HLZo8jig+wTLAbTXJk8kRlaJPYdEx7N/YN3um7zDQoiV8k5H2TZVnM1ab5TIXfX vIhW+YG6ojcFLD1cQ7Akh84em4k5O2Pmclm5rH9osMuK1KdabYgVaYl1cOwiPM4dLo Ug8rGlRFC7KDw== Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id AEF5560085; Tue, 11 Jun 2024 23:54:10 +0000 (UTC) Received: by x201s (Postfix, from userid 1000) id 8297A202FA5; Tue, 11 Jun 2024 23:54:00 +0000 (UTC) From: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= To: Davide Caratti , Ilya Maximets , Jamal Hadi Salim , Cong Wang , Jiri Pirko Cc: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Ahern , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next 5/9] flow_dissector: set encapsulated control flags from tun_flags Date: Tue, 11 Jun 2024 23:53:38 +0000 Message-ID: <20240611235355.177667-6-ast@fiberby.net> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240611235355.177667-1-ast@fiberby.net> References: <20240611235355.177667-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Set the new FLOW_DIS_F_TUNNEL_* encapsulated control flags, based on if their counter-part is set in tun_flags. These flags are not userspace visible yet, as the code to dump encapsulated control flags will first be added, and later activated in the following patches. Signed-off-by: Asbjørn Sloth Tønnesen --- net/core/flow_dissector.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 86a11a01445ad..6e9bd4cecab66 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -396,6 +396,15 @@ skb_flow_dissect_tunnel_info(const struct sk_buff *skb, key = &info->key; + if (test_bit(IP_TUNNEL_CSUM_BIT, key->tun_flags)) + ctrl_flags |= FLOW_DIS_F_TUNNEL_CSUM; + if (test_bit(IP_TUNNEL_DONT_FRAGMENT_BIT, key->tun_flags)) + ctrl_flags |= FLOW_DIS_F_TUNNEL_DONT_FRAGMENT; + if (test_bit(IP_TUNNEL_OAM_BIT, key->tun_flags)) + ctrl_flags |= FLOW_DIS_F_TUNNEL_OAM; + if (test_bit(IP_TUNNEL_CRIT_OPT_BIT, key->tun_flags)) + ctrl_flags |= FLOW_DIS_F_TUNNEL_CRIT_OPT; + switch (ip_tunnel_info_af(info)) { case AF_INET: skb_flow_dissect_set_enc_control(FLOW_DISSECTOR_KEY_IPV4_ADDRS, From patchwork Tue Jun 11 23:53:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= X-Patchwork-Id: 13694291 X-Patchwork-Delegate: kuba@kernel.org Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D82C155A5C; Tue, 11 Jun 2024 23:54:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718150066; cv=none; b=nl2FOPjwAtfrvhov2YSmaLQYcqZwfJeA9bvUNzIrVWjk1rkMbrYk43M91AjG7d3xOlm72zjyRJKn4XqHsddQU140SLiDU5i+SSrauNMgpmvik5Epac2+XZT3n4alx1ZSvWJFscnv89RPvgu2Y/rKuD4cojGJJ2RL5RQbWLaejOA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718150066; c=relaxed/simple; bh=+hUPd2L+XW9o1OK0uo9xBYcaeGFFYjWBxApJBDzWEPQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oTz/YFBL/0RuRCcthJbc+1BfMUYQK3J+OPLaeKsbXphAi8t+g3nA+LJ0Q5uwrnDK/QqqJ7ShFjKpBKoHALxsQWHnXOgDJqkuyv1mh6lO00xZGp1CG60ZSK+zC6WRUkU1eZwHdGZGP0iCeZKGh/oJBBj+m4KeWi1jKd6fxS5SCCU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=wDGQzWmj; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="wDGQzWmj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1718150057; bh=+hUPd2L+XW9o1OK0uo9xBYcaeGFFYjWBxApJBDzWEPQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wDGQzWmj+Yj7AXrocGXVArV9XEZglOCxvvj1ga6GT9i9TKmGkmBo6gLmWQwKJz3SP 9ReewMNOLaucH2ohNrbIZdX9/R27K1iJUPMtQ0silY7cqhaxr65ZNE1t/+zQbQZ2W6 mbJ5oR1A3944FS3J5I+kH4E0A5RWP7KI1eyZHiQChTqde+mfWxGYPzGEFUntHiPc2O Wf5r4/Be0HAXaOaJ23xAxluHGHt/16fxr6kI8CrSShQnBADWFADgf64V3UHm3PYoUg zstWI1gHtenkxVke0IHzT/MQhb1a97bnsHjFDQt4ePHroHnlEwAd3oRaLiN2u2PmhW ngUT1AHEodl9w== Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id AEEFE60084; Tue, 11 Jun 2024 23:54:10 +0000 (UTC) Received: by x201s (Postfix, from userid 1000) id 8C9B9202FDB; Tue, 11 Jun 2024 23:54:00 +0000 (UTC) From: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= To: Davide Caratti , Ilya Maximets , Jamal Hadi Salim , Cong Wang , Jiri Pirko Cc: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Ahern , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next 6/9] net/sched: cls_flower: add tunnel flags to fl_{set,dump}_key_flags() Date: Tue, 11 Jun 2024 23:53:39 +0000 Message-ID: <20240611235355.177667-7-ast@fiberby.net> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240611235355.177667-1-ast@fiberby.net> References: <20240611235355.177667-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Prepare to set and dump the tunnel flags. This code won't see any of these flags yet, as these flags aren't allowed by the NLA_POLICY_MASK, and the functions doesn't get called with encap set to true yet. Signed-off-by: Asbjørn Sloth Tønnesen --- net/sched/cls_flower.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index 6a2afc31f038b..61ab336645caa 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c @@ -1204,6 +1204,21 @@ static int fl_set_key_flags(struct nlattr **tb, bool encap, u32 *flags_key, TCA_FLOWER_KEY_FLAGS_FRAG_IS_FIRST, FLOW_DIS_FIRST_FRAG); + fl_set_key_flag(key, mask, flags_key, flags_mask, + TCA_FLOWER_KEY_FLAGS_TUNNEL_CSUM, + FLOW_DIS_F_TUNNEL_CSUM); + + fl_set_key_flag(key, mask, flags_key, flags_mask, + TCA_FLOWER_KEY_FLAGS_TUNNEL_DONT_FRAGMENT, + FLOW_DIS_F_TUNNEL_DONT_FRAGMENT); + + fl_set_key_flag(key, mask, flags_key, flags_mask, + TCA_FLOWER_KEY_FLAGS_TUNNEL_OAM, FLOW_DIS_F_TUNNEL_OAM); + + fl_set_key_flag(key, mask, flags_key, flags_mask, + TCA_FLOWER_KEY_FLAGS_TUNNEL_CRIT_OPT, + FLOW_DIS_F_TUNNEL_CRIT_OPT); + return 0; } @@ -3127,6 +3142,21 @@ static int fl_dump_key_flags(struct sk_buff *skb, bool encap, TCA_FLOWER_KEY_FLAGS_FRAG_IS_FIRST, FLOW_DIS_FIRST_FRAG); + fl_get_key_flag(flags_key, flags_mask, &key, &mask, + TCA_FLOWER_KEY_FLAGS_TUNNEL_CSUM, + FLOW_DIS_F_TUNNEL_CSUM); + + fl_get_key_flag(flags_key, flags_mask, &key, &mask, + TCA_FLOWER_KEY_FLAGS_TUNNEL_DONT_FRAGMENT, + FLOW_DIS_F_TUNNEL_DONT_FRAGMENT); + + fl_get_key_flag(flags_key, flags_mask, &key, &mask, + TCA_FLOWER_KEY_FLAGS_TUNNEL_OAM, FLOW_DIS_F_TUNNEL_OAM); + + fl_get_key_flag(flags_key, flags_mask, &key, &mask, + TCA_FLOWER_KEY_FLAGS_TUNNEL_CRIT_OPT, + FLOW_DIS_F_TUNNEL_CRIT_OPT); + _key = cpu_to_be32(key); _mask = cpu_to_be32(mask); From patchwork Tue Jun 11 23:53:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= X-Patchwork-Id: 13694292 X-Patchwork-Delegate: kuba@kernel.org Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D875156228; Tue, 11 Jun 2024 23:54:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718150066; cv=none; b=inp4eQEjve+Zjc5CDmR3hhq+EJgCn4hbPdTu7iMd0knpoQjZn33kLfTjTMmaCNPqGoOPeS/WadZHOzq4brRwIKNghwjwAYSkt8AgzmOZaguR+ji1M/KDE+9aBZzEL7jz1Dh4LJuyKqEdeXQQlTbd9zlGxk/DQmkl71ikv67pY8A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718150066; c=relaxed/simple; bh=Z/lzuWQnJaJG3WDBsOeckICruBT5qcsCV4WD4LYn6u4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JBzmC5DwoJQJx9/Ury+xmYCZy0D+il8ZECZqH1xWQOpFYiEvLIW9mGzWIEmRMXsHG7gOy0MhKCOypNhGyqIVaInr8gteofljdA2tpNE1dQAjhBRTwdv+OdBrBvfCRGmIOmWHjBlNIFVNubln6TyLMVOcU1kU1LDFiGCWW33VGZE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=tCMHCVp2; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="tCMHCVp2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1718150057; bh=Z/lzuWQnJaJG3WDBsOeckICruBT5qcsCV4WD4LYn6u4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tCMHCVp2//gbDZmNX1c6UIfz9Ulbo8NsmE7hEGh0ib6d7lqxCh1vA0BOZyZkwOnc+ ZaC7OUgpp98z+QHH45DeS72klDBTIc7OSh2JMC9ZPlXPMtof1pVO6t8N4qs89vNdLn llAPDCvLLS7IxNcAYD9rLNy+uETjnZPIC5S2Ly/KqFLvyEZoT3mSS2E4zTeeiSYd/I KqbHc5Lkir0XL6jZj8kLueHR1NPTpzR6c6ySYgtWcwoZTyppFqxezRiLY/kKAJ2oWS zWdVm6M4+2iJGFKmqcGkTNUa1ofSC3c0eWgDyJunpl5l57NIE+6P1J/cJdnilLnhH/ 2QvAtQmyQAaWQ== Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 97F2E6007D; Tue, 11 Jun 2024 23:54:10 +0000 (UTC) Received: by x201s (Postfix, from userid 1000) id 96180203081; Tue, 11 Jun 2024 23:54:00 +0000 (UTC) From: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= To: Davide Caratti , Ilya Maximets , Jamal Hadi Salim , Cong Wang , Jiri Pirko Cc: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Ahern , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next 7/9] net/sched: cls_flower: rework TCA_FLOWER_KEY_ENC_FLAGS usage Date: Tue, 11 Jun 2024 23:53:40 +0000 Message-ID: <20240611235355.177667-8-ast@fiberby.net> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240611235355.177667-1-ast@fiberby.net> References: <20240611235355.177667-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC This patch changes how TCA_FLOWER_KEY_ENC_FLAGS is used, so that it is used with TCA_FLOWER_KEY_FLAGS_* flags, in the same way as TCA_FLOWER_KEY_FLAGS is currently used. Where TCA_FLOWER_KEY_FLAGS uses {key,mask}->control.flags, then TCA_FLOWER_KEY_ENC_FLAGS now uses {key,mask}->enc_control.flags, therefore {key,mask}->enc_flags is now unused. As the generic fl_set_key_flags/fl_dump_key_flags() is used with encap set to true, then fl_{set,dump}_key_enc_flags() is removed. This breaks unreleased userspace API (net-next since 2024-06-04). Signed-off-by: Asbjørn Sloth Tønnesen --- net/sched/cls_flower.c | 52 +++++++++--------------------------------- 1 file changed, 11 insertions(+), 41 deletions(-) diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index 61ab336645caa..80e5467b8eaee 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c @@ -45,11 +45,11 @@ (TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT | \ TCA_FLOWER_KEY_FLAGS_FRAG_IS_FIRST) -#define TUNNEL_FLAGS_PRESENT (\ - _BITUL(IP_TUNNEL_CSUM_BIT) | \ - _BITUL(IP_TUNNEL_DONT_FRAGMENT_BIT) | \ - _BITUL(IP_TUNNEL_OAM_BIT) | \ - _BITUL(IP_TUNNEL_CRIT_OPT_BIT)) +#define TCA_FLOWER_KEY_ENC_FLAGS_POLICY_MASK \ + (TCA_FLOWER_KEY_FLAGS_TUNNEL_CSUM | \ + TCA_FLOWER_KEY_FLAGS_TUNNEL_DONT_FRAGMENT | \ + TCA_FLOWER_KEY_FLAGS_TUNNEL_OAM | \ + TCA_FLOWER_KEY_FLAGS_TUNNEL_CRIT_OPT) struct fl_flow_key { struct flow_dissector_key_meta meta; @@ -746,9 +746,9 @@ static const struct nla_policy fl_policy[TCA_FLOWER_MAX + 1] = { [TCA_FLOWER_L2_MISS] = NLA_POLICY_MAX(NLA_U8, 1), [TCA_FLOWER_KEY_CFM] = { .type = NLA_NESTED }, [TCA_FLOWER_KEY_ENC_FLAGS] = NLA_POLICY_MASK(NLA_U32, - TUNNEL_FLAGS_PRESENT), + TCA_FLOWER_KEY_ENC_FLAGS_POLICY_MASK), [TCA_FLOWER_KEY_ENC_FLAGS_MASK] = NLA_POLICY_MASK(NLA_U32, - TUNNEL_FLAGS_PRESENT), + TCA_FLOWER_KEY_ENC_FLAGS_POLICY_MASK), }; static const struct nla_policy @@ -1866,21 +1866,6 @@ static int fl_set_key_cfm(struct nlattr **tb, return 0; } -static int fl_set_key_enc_flags(struct nlattr **tb, u32 *flags_key, - u32 *flags_mask, struct netlink_ext_ack *extack) -{ - /* mask is mandatory for flags */ - if (NL_REQ_ATTR_CHECK(extack, NULL, tb, TCA_FLOWER_KEY_ENC_FLAGS_MASK)) { - NL_SET_ERR_MSG(extack, "missing enc_flags mask"); - return -EINVAL; - } - - *flags_key = nla_get_u32(tb[TCA_FLOWER_KEY_ENC_FLAGS]); - *flags_mask = nla_get_u32(tb[TCA_FLOWER_KEY_ENC_FLAGS_MASK]); - - return 0; -} - static int fl_set_key(struct net *net, struct nlattr **tb, struct fl_flow_key *key, struct fl_flow_key *mask, struct netlink_ext_ack *extack) @@ -2123,8 +2108,8 @@ static int fl_set_key(struct net *net, struct nlattr **tb, } if (tb[TCA_FLOWER_KEY_ENC_FLAGS]) - ret = fl_set_key_enc_flags(tb, &key->enc_flags.flags, - &mask->enc_flags.flags, extack); + ret = fl_set_key_flags(tb, true, &key->enc_control.flags, + &mask->enc_control.flags, extack); return ret; } @@ -3381,22 +3366,6 @@ static int fl_dump_key_cfm(struct sk_buff *skb, return err; } -static int fl_dump_key_enc_flags(struct sk_buff *skb, - struct flow_dissector_key_enc_flags *key, - struct flow_dissector_key_enc_flags *mask) -{ - if (!memchr_inv(mask, 0, sizeof(*mask))) - return 0; - - if (nla_put_u32(skb, TCA_FLOWER_KEY_ENC_FLAGS, key->flags)) - return -EMSGSIZE; - - if (nla_put_u32(skb, TCA_FLOWER_KEY_ENC_FLAGS_MASK, mask->flags)) - return -EMSGSIZE; - - return 0; -} - static int fl_dump_key_options(struct sk_buff *skb, int enc_opt_type, struct flow_dissector_key_enc_opts *enc_opts) { @@ -3699,7 +3668,8 @@ static int fl_dump_key(struct sk_buff *skb, struct net *net, if (fl_dump_key_cfm(skb, &key->cfm, &mask->cfm)) goto nla_put_failure; - if (fl_dump_key_enc_flags(skb, &key->enc_flags, &mask->enc_flags)) + if (fl_dump_key_flags(skb, true, key->enc_control.flags, + mask->enc_control.flags)) goto nla_put_failure; return 0; From patchwork Tue Jun 11 23:53:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= X-Patchwork-Id: 13694294 X-Patchwork-Delegate: kuba@kernel.org Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A2CC156885; Tue, 11 Jun 2024 23:54:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718150068; cv=none; b=FjPvbDNkmxCsoWcmB7TGLM5wvk8OG714wrHFaGIcZiNQMSr1oYnW0fhPjGwcT1ON8k2zo7F0H3xWfx6nxNMOFeGbiEKLS0Zug4hR4WSBC04X1/ESiG8Myc6Rqes8cts4aoG2Esd7U7JSyWbNWr2ufv120xTCN/1CRCkcF5avOO8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718150068; c=relaxed/simple; bh=XL16U9LwuxFtzlKPJGSc5NxjViV134aXxN0bG9vZ01g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VmDgc6XLa/WmD5VfB26mrpkasc0c/j9j1VImhKfMXbRjkakC2burzCmVjZPjATXd6oXBIKWqC54imjvl5Sz8m6YgixOxBp76t/g6opOjXvW8GME8+WmvfCiQBs1Yuj3TndZyuNKSS4mspVXLg5r+DS3FAhhCSjMvmmluTPL1bRc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=rXVGP64Y; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="rXVGP64Y" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1718150057; bh=XL16U9LwuxFtzlKPJGSc5NxjViV134aXxN0bG9vZ01g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rXVGP64YRcBjM6yL6clQE67D96IsebYaI4wvCuZDgKc3KvJWnMNf3dcw5fVQbHwgt r8NOdnQNPnzRnaIxXP/UyVSyG+jyAzOQBK/F3egy0CHHABbeRRTHrWUdFx+u9MJ9LT tAyrm5m+PkdGELuMxDIZmVGhOqFWBz1Py/S3XBRFTR96hZ3CKQao1B4qKfOGyXxhpJ dbb4Xrkj7AEwaYkkW6o8cAKIRW9CQyuvwGE16BTDT1XjGvGdwyooEa9igSI7iNuLDp VuULM+FA/hty1tbfn+PHeWvVNh2TyNrEh/gYwAs91ZgXCOmbs1cTBO1cRHJL/jR5Hb qZyS4qbCgN52w== Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 99F2B6007E; Tue, 11 Jun 2024 23:54:10 +0000 (UTC) Received: by x201s (Postfix, from userid 1000) id 9F43B20314C; Tue, 11 Jun 2024 23:54:00 +0000 (UTC) From: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= To: Davide Caratti , Ilya Maximets , Jamal Hadi Salim , Cong Wang , Jiri Pirko Cc: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Ahern , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next 8/9] flow_dissector: cleanup FLOW_DISSECTOR_KEY_ENC_FLAGS Date: Tue, 11 Jun 2024 23:53:41 +0000 Message-ID: <20240611235355.177667-9-ast@fiberby.net> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240611235355.177667-1-ast@fiberby.net> References: <20240611235355.177667-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Now that TCA_FLOWER_KEY_ENC_FLAGS is unused, as it's former data is stored behind TCA_FLOWER_KEY_ENC_CONTROL, then remove the last bits of FLOW_DISSECTOR_KEY_ENC_FLAGS. FLOW_DISSECTOR_KEY_ENC_FLAGS is unreleased, and have been in net-next since 2024-06-04. Signed-off-by: Asbjørn Sloth Tønnesen --- include/net/flow_dissector.h | 9 --------- include/net/ip_tunnels.h | 12 ------------ net/core/flow_dissector.c | 16 +--------------- net/sched/cls_flower.c | 3 --- 4 files changed, 1 insertion(+), 39 deletions(-) diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h index 1f0fddb29a0d8..58717bcaf8496 100644 --- a/include/net/flow_dissector.h +++ b/include/net/flow_dissector.h @@ -338,14 +338,6 @@ struct flow_dissector_key_cfm { #define FLOW_DIS_CFM_MDL_MASK GENMASK(7, 5) #define FLOW_DIS_CFM_MDL_MAX 7 -/** - * struct flow_dissector_key_enc_flags: tunnel metadata control flags - * @flags: tunnel control flags - */ -struct flow_dissector_key_enc_flags { - u32 flags; -}; - enum flow_dissector_key_id { FLOW_DISSECTOR_KEY_CONTROL, /* struct flow_dissector_key_control */ FLOW_DISSECTOR_KEY_BASIC, /* struct flow_dissector_key_basic */ @@ -380,7 +372,6 @@ enum flow_dissector_key_id { FLOW_DISSECTOR_KEY_L2TPV3, /* struct flow_dissector_key_l2tpv3 */ FLOW_DISSECTOR_KEY_CFM, /* struct flow_dissector_key_cfm */ FLOW_DISSECTOR_KEY_IPSEC, /* struct flow_dissector_key_ipsec */ - FLOW_DISSECTOR_KEY_ENC_FLAGS, /* struct flow_dissector_key_enc_flags */ FLOW_DISSECTOR_KEY_MAX, }; diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h index 5a530d4fb02c6..9a6a08ec77139 100644 --- a/include/net/ip_tunnels.h +++ b/include/net/ip_tunnels.h @@ -247,18 +247,6 @@ static inline bool ip_tunnel_is_options_present(const unsigned long *flags) return ip_tunnel_flags_intersect(flags, present); } -static inline void ip_tunnel_set_encflags_present(unsigned long *flags) -{ - IP_TUNNEL_DECLARE_FLAGS(present) = { }; - - __set_bit(IP_TUNNEL_CSUM_BIT, present); - __set_bit(IP_TUNNEL_DONT_FRAGMENT_BIT, present); - __set_bit(IP_TUNNEL_OAM_BIT, present); - __set_bit(IP_TUNNEL_CRIT_OPT_BIT, present); - - ip_tunnel_flags_or(flags, flags, present); -} - static inline bool ip_tunnel_flags_is_be16_compat(const unsigned long *flags) { IP_TUNNEL_DECLARE_FLAGS(supp) = { }; diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 6e9bd4cecab66..5fac97dbbd606 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -385,9 +385,7 @@ skb_flow_dissect_tunnel_info(const struct sk_buff *skb, !dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_ENC_IP) && !dissector_uses_key(flow_dissector, - FLOW_DISSECTOR_KEY_ENC_OPTS) && - !dissector_uses_key(flow_dissector, - FLOW_DISSECTOR_KEY_ENC_FLAGS)) + FLOW_DISSECTOR_KEY_ENC_OPTS)) return; info = skb_tunnel_info(skb); @@ -489,18 +487,6 @@ skb_flow_dissect_tunnel_info(const struct sk_buff *skb, IP_TUNNEL_GENEVE_OPT_BIT); enc_opt->dst_opt_type = val < __IP_TUNNEL_FLAG_NUM ? val : 0; } - - if (dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_ENC_FLAGS)) { - struct flow_dissector_key_enc_flags *enc_flags; - IP_TUNNEL_DECLARE_FLAGS(flags) = {}; - - enc_flags = skb_flow_dissector_target(flow_dissector, - FLOW_DISSECTOR_KEY_ENC_FLAGS, - target_container); - ip_tunnel_set_encflags_present(flags); - ip_tunnel_flags_and(flags, flags, info->key.tun_flags); - enc_flags->flags = bitmap_read(flags, IP_TUNNEL_CSUM_BIT, 32); - } } EXPORT_SYMBOL(skb_flow_dissect_tunnel_info); diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index 80e5467b8eaee..4e8ae4240922e 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c @@ -85,7 +85,6 @@ struct fl_flow_key { struct flow_dissector_key_l2tpv3 l2tpv3; struct flow_dissector_key_ipsec ipsec; struct flow_dissector_key_cfm cfm; - struct flow_dissector_key_enc_flags enc_flags; } __aligned(BITS_PER_LONG / 8); /* Ensure that we can do comparisons as longs. */ struct fl_flow_mask_range { @@ -2223,8 +2222,6 @@ static void fl_init_dissector(struct flow_dissector *dissector, FLOW_DISSECTOR_KEY_IPSEC, ipsec); FL_KEY_SET_IF_MASKED(mask, keys, cnt, FLOW_DISSECTOR_KEY_CFM, cfm); - FL_KEY_SET_IF_MASKED(mask, keys, cnt, - FLOW_DISSECTOR_KEY_ENC_FLAGS, enc_flags); skb_flow_dissector_init(dissector, keys, cnt); } From patchwork Tue Jun 11 23:53:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= X-Patchwork-Id: 13694299 X-Patchwork-Delegate: kuba@kernel.org Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC83D157462; Tue, 11 Jun 2024 23:54:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718150070; cv=none; b=QTqFvwShXxIeOAubQqHiGgLNfjp+9K1EQeI4BcHFwND1Sg802UHS6Jlk7BrCFgjrE9HSlNIOzB05feDNSGAhOHRHLj1hiSOR5o1nzd/vEdoO0i6soMJCUouO7yV9pGcfWecb+MkFN6JCHifNrbkN+3AG+eYXOCX600/wsBzVawQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718150070; c=relaxed/simple; bh=imPL47eGO9aBrxJvP1M11oZoTr+RAS2vWYBlCDgWnjw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Gx1cln2K1k9IXHIRIoHD/3EMY01c5CA/hXWGzxzcafHDNFE8mV7CgXLqLoKUQekEmxzG8xRegJimoV60bAhFrzPLA3N7eiunPEPMt6uiD5Ad921VHgOdNo7HXTLh2zhyWB5WjMQFxsUxud4jInAYaYnH83uvIny2JQU5aNMCFVc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=jjXCc/WL; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="jjXCc/WL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1718150060; bh=imPL47eGO9aBrxJvP1M11oZoTr+RAS2vWYBlCDgWnjw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jjXCc/WLG+elWeHEXRqlM9m72b/JT4CjdV5amLLQhvEOLrpe4Vuw3kYHnGeoir+nh RXTrIGbYueRxQ/O0G+GPvEF68tFT5aOyR0ULP25gsdg34HkWSUc+K29zqP/N207uQ4 +1nBVsh+A/YBMaudbCTYyppaAavB7v53Znc//WfHJ7+vR9cbDFp6dd8z/BLPjAWGhM P52o08a6cTVXpX2wrscQf/1Eqd6CE4n4wHNFt/chvD/EWDZpWmv0cfXVksTnBKCLLq BiZCItBkGwLraWCKJDK3XGSvqiYuwsGos5D5tQ+Z8X7BAQ9460/cjdM4zLqk9amnfg PpNVLPA336G2A== Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 7CB87600A5; Tue, 11 Jun 2024 23:54:17 +0000 (UTC) Received: by x201s (Postfix, from userid 1000) id A8D492032F8; Tue, 11 Jun 2024 23:54:00 +0000 (UTC) From: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= To: Davide Caratti , Ilya Maximets , Jamal Hadi Salim , Cong Wang , Jiri Pirko Cc: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Ahern , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH net-next 9/9] flow_dissector: set encapsulation control flags for non-IP Date: Tue, 11 Jun 2024 23:53:42 +0000 Message-ID: <20240611235355.177667-10-ast@fiberby.net> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240611235355.177667-1-ast@fiberby.net> References: <20240611235355.177667-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Make sure to set encapsulated control flags also for non-IP packets, such that it's possible to allow matching on e.g. TUNNEL_OAM on a geneve packet carrying a non-IP packet. Suggested-by: Davide Caratti Signed-off-by: Asbjørn Sloth Tønnesen --- net/core/flow_dissector.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 5fac97dbbd606..41311c8b0b2a4 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -434,6 +434,10 @@ skb_flow_dissect_tunnel_info(const struct sk_buff *skb, ipv6->dst = key->u.ipv6.dst; } break; + default: + skb_flow_dissect_set_enc_control(0, ctrl_flags, flow_dissector, + target_container); + break; } if (dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_ENC_KEYID)) {