From patchwork Tue Apr 23 10:27:17 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: 13639729 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 AB86261694; Tue, 23 Apr 2024 10:28:14 +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=1713868096; cv=none; b=SNfyLnqwK9y+sA8Z+UlmXdUT829Y8W+ExneTuKdaiMePNjI1UKvZ7YqnmgtnJPCvVAnbwGTs7F9w1M3aNDv3ieDjVZ3myAmTdZj6tP3oHdLQO5a7eJJaK9bPcjMMNjOzIchoE7DAaFO6UJvxQZpSb/J59+2u8WoltPjkRa5zjJA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713868096; c=relaxed/simple; bh=b7EYECfaQpkuXRm4fwoJzpN0LrsyfwmAPnfkai828dE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=R4I5kU5cqq8ZKXsBzecAfqLMpqQqx/vxKDtEa2eFY2sDCtAt2ms+mxptL8p5ptnWL5TaoNLljvpr/hQp1hzpmCO1Fs+GiI0FlIW3m4NbzE+lvV3+CBQgsDh1aDYELqGuy5wMUHxJ74L1JvLHQgoqufOVP9GG84pNsVbNZzvMQaY= 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=dreCglqb; 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="dreCglqb" Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 69071600AF; Tue, 23 Apr 2024 10:28:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1713868087; bh=b7EYECfaQpkuXRm4fwoJzpN0LrsyfwmAPnfkai828dE=; h=From:To:Cc:Subject:Date:From; b=dreCglqb9B46tN4utGlbkHf0tCeEhW1Sqy+zGl1z7i3igNJ0ANs9PuCjrAGUml8PR eGt6Y21FK9E7Dqm3yuxX099PXg9tE9FzMSld1zP1fbOmcsFcw43p1pHQ+nrovGobT+ CLHu14yip5KBr/qIrHk+ve5xgYR8IckKFSJ9rCtcbTBrQ3fiY5gDzDRMpCtKwlaFF7 ogeeoIR1EZ06u/gk55N8PikAk8jHnVKPNmxHgtAB5nJAlGbQxb8JusTaX1st4UwWdh n7tUTA8j1oHcGjBHCVysdBphyDm40lR9Lc4xgNiInhFtQOtQelMyVuNDyVAkuVGgul umL3JD75v63hQ== Received: by x201s (Postfix, from userid 1000) id A8D1B205A1A; Tue, 23 Apr 2024 10:27:20 +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?= , Horatiu Vultur , UNGLinuxDriver@microchip.com, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/2] net: lan966x: cleanup lan966x_tc_flower_handler_control_usage() Date: Tue, 23 Apr 2024 10:27:17 +0000 Message-ID: <20240423102720.228728-1-ast@fiberby.net> X-Mailer: git-send-email 2.43.0 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 future users. Rename goto, as the error message is specific to the fragment flags. Only compile-tested. Signed-off-by: Asbjørn Sloth Tønnesen --- .../net/ethernet/microchip/lan966x/lan966x_tc_flower.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_tc_flower.c b/drivers/net/ethernet/microchip/lan966x/lan966x_tc_flower.c index d696cf9dbd19..8baec0cd8d95 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_tc_flower.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_tc_flower.c @@ -45,6 +45,7 @@ static bool lan966x_tc_is_known_etype(struct vcap_tc_flower_parse_usage *st, static int lan966x_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 match; int err = 0; @@ -59,7 +60,7 @@ lan966x_tc_flower_handler_control_usage(struct vcap_tc_flower_parse_usage *st) VCAP_KF_L3_FRAGMENT, VCAP_BIT_0); if (err) - goto out; + goto bad_frag_out; } if (match.mask->flags & FLOW_DIS_FIRST_FRAG) { @@ -72,15 +73,15 @@ lan966x_tc_flower_handler_control_usage(struct vcap_tc_flower_parse_usage *st) VCAP_KF_L3_FRAG_OFS_GT0, VCAP_BIT_1); if (err) - goto out; + goto bad_frag_out; } st->used_keys |= BIT_ULL(FLOW_DISSECTOR_KEY_CONTROL); return err; -out: - NL_SET_ERR_MSG_MOD(st->fco->common.extack, "ip_frag parse error"); +bad_frag_out: + NL_SET_ERR_MSG_MOD(extack, "ip_frag parse error"); return err; } From patchwork Tue Apr 23 10:27:27 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: 13639728 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 04E9560267; Tue, 23 Apr 2024 10:28:12 +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=1713868095; cv=none; b=tf+YotlAzGDpjTxS5Z8RxtbUzjBhs6aNKLxiWoqYNGF1STiUh5Gg/+yJIWLdIWu1bOxPiDdgGUSxcYOByClvMDyZ08l6uandIFs2ZT5w9+3YZnKqF9Ck6D6b9FSYdelj//Qn6sv9mv+OycJYBNdXIcT7nHsdQcOOhk+uqolzbzI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713868095; c=relaxed/simple; bh=39WhF6eCSOF/ZCUdao6fmDVARxWuHqpggCtYOqxbRdc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=f3IAcp5c6a7S4XHfMWDuILc32rM+IKvqoPnaT0DGm6GmSd0zOkv7/U1NMhlaG5o7xdgdHlkVYOipMFZAMw8U0lDDcI9kV35+Cw+5g7KJtuNemAYbgaOlFCXKtlBU9g59c7FwgrvZUzO4lreRdbV0mSouLmu1O1D95cT1URfaxk8= 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=DRopk1Cb; 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="DRopk1Cb" Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 29706600A7; Tue, 23 Apr 2024 10:28:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1713868084; bh=39WhF6eCSOF/ZCUdao6fmDVARxWuHqpggCtYOqxbRdc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DRopk1CbxQFpR7TwvdM4LduXW51OoycFf176Xzt0GSHWRVRlo9Sa+0GfjFY3CopnG tLAyQFME3G2F3goHqEyYYyjrxDVNSURLwnTsRa678RL1cgZMh+eMTtPLlZlgZO5IHw R9epoP7Li6mTiNjf1ns9eO8YfP/6J5dLkdRiuURfFFpwUv1FxJCV5mzpN1OHt2UMyz HsmMyu2SLZ12JRIpB+4R+tJ0qrDwz5gXFU2EZBro5v7TiKYKem3y3ndNGi3Uyvb2FL av/uwjNBrdv4GXtyAlY1FHLoE087RSPnHgFT9pXq6teEA4leaqRQYNPafcGHCpo0MD I2KEwvAYaSHTQ== Received: by x201s (Postfix, from userid 1000) id 61B34216B93; Tue, 23 Apr 2024 10:27:29 +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, Jacob Keller Subject: [PATCH net-next 2/2] net: sparx5: flower: check for unsupported control flags Date: Tue, 23 Apr 2024 10:27:27 +0000 Message-ID: <20240423102728.228765-2-ast@fiberby.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240423102728.228765-1-ast@fiberby.net> References: <20240423102728.228765-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 d846edd77a01..f81d89f8f620 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;