From patchwork Mon Apr 22 15:26: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: 13638621 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 AB8A4153815; Mon, 22 Apr 2024 15:28:03 +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=1713799685; cv=none; b=NvgZVR15j2gOBAxugph7HJ875e0rALvrf5QP2M9fXzshTNPpqC5KKGmDUXdM9LWcCxy/ErxIqG2gzca5Fg40ZjkJztrs7QrOdYH1usFyMFO63yCDNwwd6MmUlhqFkgDJ7nJ0uGNk23rZJ85gNU+I/CRjZ65tTWUZIm+iFCU9VAs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713799685; c=relaxed/simple; bh=Yxwk2rzoT3ceJNHFybYzVsfwPWlLFknDIb0RH9YnCdc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=C4YxJh1WlO03urYaWaTPYkz5Yncvzao95M5GbDDcG/quI/BWWRtVuCxBRl1EUhoY00b9FJvqZXsxuUwMOXL20BwMuzOVjrsjNwcBP6wh3qDWudVePW3P1MM8Rwx6hF73KAk8ijJNuOKjiiJvemkrF+s7gkMSfAlGq7+0Zcqn8RA= 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=LzIvlSLN; 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="LzIvlSLN" Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 892C4600B1; Mon, 22 Apr 2024 15:27:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1713799681; bh=Yxwk2rzoT3ceJNHFybYzVsfwPWlLFknDIb0RH9YnCdc=; h=From:To:Cc:Subject:Date:From; b=LzIvlSLNdhL7UaTTqaNKdMdwqcvrycqIIaXmFSf6Jl+5mZwEeE5+zWtwkWUk1xjAl h+DYBKWK8H+aQjdJ6+gyHKgj9xCEGpjojPCv/xeXYW2C7Wvj+BuGVJo6A2mgnbslpe 2DvtBglRRAG+YuKOxfnONWbX1omtlu/NMo0W+CZ+CG5rsY8nMBHhYm3GP1byFbTE9d gXgKG8Z2uIRVqUcEZo3HrEJrP4dfnhHR4KZS72rEXZa4IVYn51MoKc3SM+UwXgitSe ck7tQcHypfOZFy0iZ/QB7Gw9JC15L48EMgnXOXi2WbDdIHFaU4MmuK5IktfObLCjym r5VuhdaQZl7xQ== Received: by x201s (Postfix, from userid 1000) id 81A89206FD8; Mon, 22 Apr 2024 15:26:49 +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?= , linux-kernel@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Grygorii Strashko , Vladimir Oltean , Roger Quadros Subject: [PATCH net-next] net: ethernet: ti: am65-cpsw: flower: validate control flags Date: Mon, 22 Apr 2024 15:26:42 +0000 Message-ID: <20240422152643.175592-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 This driver currently doesn't support any control flags. Use flow_rule_match_has_control_flags() to check for control flags, such as can be set through `tc flower ... ip_flags frag`. In case any control flags are masked, flow_rule_match_has_control_flags() sets a NL extended error message, and we return -EOPNOTSUPP. Only compile-tested. Signed-off-by: Asbjørn Sloth Tønnesen Reviewed-by: Jiri Pirko --- drivers/net/ethernet/ti/am65-cpsw-qos.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/ti/am65-cpsw-qos.c b/drivers/net/ethernet/ti/am65-cpsw-qos.c index 816e73a3d6e4..16f192a5b160 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-qos.c +++ b/drivers/net/ethernet/ti/am65-cpsw-qos.c @@ -1008,6 +1008,9 @@ static int am65_cpsw_qos_clsflower_add_policer(struct am65_cpsw_port *port, return -EOPNOTSUPP; } + if (flow_rule_match_has_control_flags(rule, extack)) + return -EOPNOTSUPP; + if (!flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ETH_ADDRS)) { NL_SET_ERR_MSG_MOD(extack, "Not matching on eth address"); return -EOPNOTSUPP;