From patchwork Wed Apr 24 12:16:22 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: 13641775 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 6D0D115ADA3; Wed, 24 Apr 2024 12:16:52 +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=1713961015; cv=none; b=lOaSxusZvsKqo2vEjhe5g6GOzroVUuwuV+qUYdyodgWzby5T/7gQTveM/I3aor+vnOe1NApyJzjuWCmdoKUlSsVHpgICwg3q+zGp7eWF3lTr0QNul7fdseOLKywfmKwdFLRLPHtWRWGSm81qHaJA7B9KQsZ4dbsMhDu0UCaNksc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713961015; c=relaxed/simple; bh=91wyp1eeivW05Y3gFARMloAF3/ELD8zgoJNeRnv7tR4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=m03g4otD7ySQlczfNa/YOElBlepgrXBUUNpCiOf/pM6T46BPjJqRgqJU6nDh6rSMpDByZBLq/4K12iO827ALQoMFhg040WMsyMysHrK4c4VTqeW9PBnu0PKb6E2wIRbzzQyWHjsElEs5MHqf8plsb9djmqA6IgEG9xNdSTO9PUU= 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=QRL/cT1D; 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="QRL/cT1D" Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 8DF91600E4; Wed, 24 Apr 2024 12:16:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1713961004; bh=91wyp1eeivW05Y3gFARMloAF3/ELD8zgoJNeRnv7tR4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QRL/cT1D/u7NOwtzRt8mSpgkT5STeLsVR9xUhgixdR0y8iBj2FwOWOpq+DbENLRsx Hwtd0Mb6W1ui7yx+jZ1B1MN/ZQmWHHx/oHKTChWwTSmRVo8FXV1+4sEo3by227QIze 4WgarA7W34eqrKyzFZAlzT3vPOzq3hdmvEmTC9cI3SS+qJAx/s5QDB898cCdiAkDia /ZUdfwaf4Kh2P9EYt4H+d3xKM0CxvwMKyNOToqM4LqltzwmEbw88eCMORe1pdUnnbp +PJZPTT/7mjBkzTFMUa2biKSJBJZfn8Sqco1XWy9D804soSeD14Gq7T/Bg2RjW4FBg GvNP/TLw2CJmw== Received: by x201s (Postfix, from userid 1000) id 082F6205A1A; Wed, 24 Apr 2024 12:16:36 +0000 (UTC) From: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= To: netdev@vger.kernel.org Cc: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= , Steen Hegelund , Lars Povlsen , Daniel Machon , UNGLinuxDriver@microchip.com, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org, Jiri Pirko , Simon Horman Subject: [PATCH net-next v2 1/4] net: sparx5: flower: only do lookup if fragment flags are set Date: Wed, 24 Apr 2024 12:16:22 +0000 Message-ID: <20240424121632.459022-2-ast@fiberby.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240424121632.459022-1-ast@fiberby.net> References: <20240424121632.459022-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 The fragment lookup should only be performed, when at least one of the fragment flags are set. This change was deliberately not included in commit 68aba00483c7 ("net: sparx5: flower: fix fragment flags handling") as it's only needed for future proffing the code, since "mask" is currently only set in conjunction with the fragment flags. (The 3rd flag FLOW_DIS_ENCAPSULATION is only used with "key") Only compile tested. Signed-off-by: Asbjørn Sloth Tønnesen --- drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c index 663571fe7b2d..ca9e69d39439 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c @@ -165,7 +165,7 @@ sparx5_tc_flower_handler_control_usage(struct vcap_tc_flower_parse_usage *st) flow_rule_match_control(st->frule, &mt); - if (mt.mask->flags) { + if (mt.mask->flags & (FLOW_DIS_IS_FRAGMENT | FLOW_DIS_FIRST_FRAG)) { u8 is_frag_key = !!(mt.key->flags & FLOW_DIS_IS_FRAGMENT); u8 is_frag_mask = !!(mt.mask->flags & FLOW_DIS_IS_FRAGMENT); u8 is_frag_idx = (is_frag_key << 1) | is_frag_mask; From patchwork Wed Apr 24 12:16:23 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: 13641777 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 6D11C15ADA6; Wed, 24 Apr 2024 12:16:52 +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=1713961015; cv=none; b=LmX507xOPLnbslKwVQSI+r8Nzbp2EQEcWFTVF1oX5/jcX3U7eRHdIkZjAbFYpmFkwSKJssiJWgrBz6MpTb6yC9zOvWGsUu9FyylJNIgZy/GuRclhjfenBnVXq/9rcOy0j3axQsAQRL7mWBhku3eWDfD9yFCQT2FdCD7/VHjQgzQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713961015; c=relaxed/simple; bh=uPBYsIyiiEFEvZqPZEpLvz84HGap+VSrek84RUNYIOM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=V2kb/sWz2LOwzfUBVDie/SwYu/CNf1mG2qkbfyBPjVaBYcrnBtNGmhK/IsDoxXInJYlOOAqVUDMLiGJbhGbhnoGdjKGzHdNUUhCJXElgOjTa8b4+9AV24EA6mDYR78/h41qKkmFhyiMPSjtte39l7Dnkh99nCHQQGEjx9odcRM0= 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=jFGpnxzp; 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="jFGpnxzp" Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id EF0FE600AF; Wed, 24 Apr 2024 12:16:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1713961004; bh=uPBYsIyiiEFEvZqPZEpLvz84HGap+VSrek84RUNYIOM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jFGpnxzpZ4ybBphl4wFEMJrlSed+bG0cdeadajBxD7ZBLhs7vLTKmMzGTdleRpfJU 1dRVxtIS4+A1mQO+Fnlz519CEDA4E2zcOn4Ya6y+VDiVtGYOkJBUyO2QN4itQbeYRp r2qgodXDyAO0zvjw3a/6JZyA31iaQjnGW4/yCK8rVADCXaa/mYEFHYKNC/PePVPtxr VxuBx2laNbvQ1AusJr9x7yeaJDEUOKtzZNvT8JvappY0Zv+ye1RCHoLAjV1N5iaPRx 0bwm7lEa86UqZNxkBspS6+Ctp9FGkdELK8jqwfNQjZA6Pyq3CzwDb40PTljIKNUbXD +7zRYMu/K/JvQ== Received: by x201s (Postfix, from userid 1000) id 7E77821BB45; Wed, 24 Apr 2024 12:16:36 +0000 (UTC) From: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= To: netdev@vger.kernel.org Cc: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= , Steen Hegelund , Lars Povlsen , Daniel Machon , UNGLinuxDriver@microchip.com, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org, Jiri Pirko , Simon Horman Subject: [PATCH net-next v2 2/4] net: sparx5: flower: add extack to sparx5_tc_flower_handler_control_usage() Date: Wed, 24 Apr 2024 12:16:23 +0000 Message-ID: <20240424121632.459022-3-ast@fiberby.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240424121632.459022-1-ast@fiberby.net> References: <20240424121632.459022-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 Define extack locally, to reduce line lengths and aid future users. Only compile tested. Signed-off-by: Asbjørn Sloth Tønnesen --- drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c index ca9e69d39439..d0dca65f8e76 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c @@ -159,6 +159,7 @@ sparx5_tc_flower_handler_basic_usage(struct vcap_tc_flower_parse_usage *st) static int sparx5_tc_flower_handler_control_usage(struct vcap_tc_flower_parse_usage *st) { + struct netlink_ext_ack *extack = st->fco->common.extack; struct flow_match_control mt; u32 value, mask; int err = 0; @@ -178,7 +179,7 @@ sparx5_tc_flower_handler_control_usage(struct vcap_tc_flower_parse_usage *st) u8 vdt = sparx5_vcap_frag_map[is_frag_idx][first_frag_idx]; if (vdt == FRAG_INVAL) { - NL_SET_ERR_MSG_MOD(st->fco->common.extack, + NL_SET_ERR_MSG_MOD(extack, "Match on invalid fragment flag combination"); return -EINVAL; } @@ -199,7 +200,7 @@ sparx5_tc_flower_handler_control_usage(struct vcap_tc_flower_parse_usage *st) return err; out: - NL_SET_ERR_MSG_MOD(st->fco->common.extack, "ip_frag parse error"); + NL_SET_ERR_MSG_MOD(extack, "ip_frag parse error"); return err; } From patchwork Wed Apr 24 12:16:24 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: 13641773 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 E8D521DFCE; Wed, 24 Apr 2024 12:16:51 +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=1713961014; cv=none; b=JezGgvgQjG6Uq2gUmMAeBXsVubMjn92Qx03pQApvsiA3cxfPVBi8j/uTZhIFeLNpdW0+wboA1a+G9yx8Ybx/UB2M0660JPHqja6YjMld79MDDSaCyalU0P/Jbo9STTLD4P+VeGWdE4UrkoFea3hmPVg7lBIo4XrS2/j2r48hhGI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713961014; c=relaxed/simple; bh=WlV+NTBBGpvEW9L0XHBhxoYKJ2JFhI+MtCnUapFUQWU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=h2zts6bIuZ4fP0A+dmVTmMWOpOKCV/ql7q4JuWlNqNNs8b9R2R5xWJQk4PaSGIBGpc2ENAdGMwkwgQu+kdPEnB/bNqX3t02Ek0YmxURm6NKsoby1z2Fzzd1iA6/dLYipZa4AAZlXhNQLYUTd5h5RHQWvWAQbaigs2AVVGSY6jxA= 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=v1QXhCID; 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="v1QXhCID" Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id EADC6600A9; Wed, 24 Apr 2024 12:16:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1713961004; bh=WlV+NTBBGpvEW9L0XHBhxoYKJ2JFhI+MtCnUapFUQWU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v1QXhCIDY2KnFl/dei+LcGMEwoFvimRsuaWY7k3kE764ngjCGqQC6ZrMzAQlyasaI YE1ZQtVFrqv073RftLcwTS18e4eKOp9jkd4DqwZVA1BCbSmgtgPXFW6Uxk3ra7ni5R YB6j/KvmUi16jsjcmrJ8kyLvUjGMWaBC7jirh415UghbITDAqFsZDobw0DT1KJ02Vp 4fvWd7649uxLRQzCzffWJkGH8YZ5DBVOVArfwuPd4vJG9y4WnFVYQmGLYwDZ5A+Sru 46jaREVy7eaaG3rvy0A35/7zQBIfe2jdufsL20F39UfPQq2YsqjtuMA5y+5FSHIJld VPj9quz9PvDvw== Received: by x201s (Postfix, from userid 1000) id 3536621BB47; Wed, 24 Apr 2024 12:16:37 +0000 (UTC) From: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= To: netdev@vger.kernel.org Cc: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= , Steen Hegelund , Lars Povlsen , Daniel Machon , UNGLinuxDriver@microchip.com, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org, Jiri Pirko , Simon Horman Subject: [PATCH net-next v2 3/4] net: sparx5: flower: remove goto in sparx5_tc_flower_handler_control_usage() Date: Wed, 24 Apr 2024 12:16:24 +0000 Message-ID: <20240424121632.459022-4-ast@fiberby.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240424121632.459022-1-ast@fiberby.net> References: <20240424121632.459022-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 Remove goto, as it's only used once, and the error message is specific to that context. Only compile tested. Signed-off-by: Asbjørn Sloth Tønnesen --- .../net/ethernet/microchip/sparx5/sparx5_tc_flower.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c index d0dca65f8e76..22f6c778afb0 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c @@ -191,17 +191,15 @@ sparx5_tc_flower_handler_control_usage(struct vcap_tc_flower_parse_usage *st) err = vcap_rule_add_key_u32(st->vrule, VCAP_KF_L3_FRAGMENT_TYPE, value, mask); - if (err) - goto out; + if (err) { + NL_SET_ERR_MSG_MOD(extack, "ip_frag parse error"); + return err; + } } st->used_keys |= BIT_ULL(FLOW_DISSECTOR_KEY_CONTROL); return err; - -out: - NL_SET_ERR_MSG_MOD(extack, "ip_frag parse error"); - return err; } static int From patchwork Wed Apr 24 12:16:25 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: 13641776 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 E8FD415AD9E; Wed, 24 Apr 2024 12:16:51 +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=1713961015; cv=none; b=oahlixZyowEeWPvjEOyUfA7q+x0da2mdyJs6srCc3K66HB7VL9rxMQrDoneXUTBKlR8XPwxEIMbAtnOVqhcWynTUxLcUiMhebP5Oi7//vOzV3xdyiMqO7tPcQN0Mf9Tewib/KdRA6RooUp0UF22iSnh+5gGRdmgB+3m01vYRyEU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713961015; c=relaxed/simple; bh=h8eKlpA8aZZwVUqM78/5h1yz+b7OYeMXRZb+mmI+cIU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lhvn9sPhp3gfuOmGVTkkd9HurA0OOu7kJxSW5JMLgydddikSuRAT7ImP/VsUW7cv897Kom0L/LaXgz9TvThD9Ox1PQepcTjRdmX9K8CsKGAO980759UBHEdIT/fKme9zXGvjBPvUaINrid6Lr4o3nEOlgMuLTPNSbLUYlr9F4K0= 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=U9zkW1MA; 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="U9zkW1MA" Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id E8314600A7; Wed, 24 Apr 2024 12:16:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1713961004; bh=h8eKlpA8aZZwVUqM78/5h1yz+b7OYeMXRZb+mmI+cIU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U9zkW1MAsDL+1CvLFFtUVK7aRTXGk8uRkn6uMXraIMcQn6NzX5hl0EiM0Gl6ElnEJ XDzQBzeRUo41sc1ojdtewLOsdgTN8q3EP500OlzAYqRMDiwuoURt0uASR8FV0x7bO7 kE0l7KC8K1o3IcaIQIYf5huZ8ooqayvxQIM8DJvJ6njFGLRQGA7Td2LY9mphGkLTNO EobCx6XmWLTCPN5e4Mo+bzYapHLl+RpvcRMhBmcYh78RaGgfESuPa+j3l4toFXBwMd pAA1knpezKGuE9+viyyMHF3Rk5Assmuw+g9IlZj8IaL8pCzJoQfj2bskV3poGAbjxA w6nYC3DrGAzRQ== Received: by x201s (Postfix, from userid 1000) id CA0D721BB49; Wed, 24 Apr 2024 12:16:37 +0000 (UTC) From: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= To: netdev@vger.kernel.org Cc: =?utf-8?q?Asbj=C3=B8rn_Sloth_T=C3=B8nnesen?= , Steen Hegelund , Lars Povlsen , Daniel Machon , UNGLinuxDriver@microchip.com, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org, Jiri Pirko , Simon Horman Subject: [PATCH net-next v2 4/4] net: sparx5: flower: check for unsupported control flags Date: Wed, 24 Apr 2024 12:16:25 +0000 Message-ID: <20240424121632.459022-5-ast@fiberby.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240424121632.459022-1-ast@fiberby.net> References: <20240424121632.459022-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 Use flow_rule_is_supp_control_flags() to reject filters with unsupported control flags. In case any unsupported control flags are masked, flow_rule_is_supp_control_flags() sets a NL extended error message, and we return -EOPNOTSUPP. Only compile-tested. Signed-off-by: Asbjørn Sloth Tønnesen --- drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c index 22f6c778afb0..8d67d9f24c76 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c @@ -197,6 +197,11 @@ sparx5_tc_flower_handler_control_usage(struct vcap_tc_flower_parse_usage *st) } } + if (!flow_rule_is_supp_control_flags(FLOW_DIS_IS_FRAGMENT | + FLOW_DIS_FIRST_FRAG, + mt.mask->flags, extack)) + return -EOPNOTSUPP; + st->used_keys |= BIT_ULL(FLOW_DISSECTOR_KEY_CONTROL); return err;