]> git.hungrycats.org Git - linux/commitdiff
net: stmmac: selftests: Pass the IP proto mask in the TC selftest
authorMaxime Chevallier <maxime.chevallier@bootlin.com>
Tue, 25 Aug 2026 21:17:46 +0000 (23:17 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Sep 2026 11:36:14 +0000 (13:36 +0200)
[ Upstream commit 9a56a27e6002e29a6707dc4238d469ec84c3a68e ]

The stmmac TC filtering rules have recently gained sanity checks to make
sure the passed keys and their respective masks are aligned with the HW
filtering abilities.

The stmmac selftests failed to pass the mask in the match data for L4
filtering tests, and are now failing consistently with -EINVAL :

$ ethtool -t eth1
[...]
23. L4 DA TCP Filtering          -22
24. L4 SA TCP Filtering          -22
25. L4 DA UDP Filtering          -22
26. L4 SA UDP Filtering          -22

Let's pass the ip_proto mask in the l4 filtering tests match data. Found
on imx8mp, which now have passing L4 tests :

$ ethtool -t eth1
[...]
23. L4 DA TCP Filtering          0
24. L4 SA TCP Filtering          0
25. L4 DA UDP Filtering          0
26. L4 SA UDP Filtering          0

While at it, initialize the masks and keys to avoid re-using whatever
was on the stack.

Fixes: 5536d7c84363 ("net: stmmac: fix l3l4 filter rejecting unsupported offload requests")
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Link: https://patch.msgid.link/20260825211748.360935-1-maxime.chevallier@bootlin.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c

index a01bc394d1ac467ba15d2068629c7bbabc05ecc6..df64889aa4ea3c6450f695c6e0f4a276b3f4b5e3 100644 (file)
@@ -1452,11 +1452,11 @@ static int __stmmac_test_l4filt(struct stmmac_priv *priv, u32 dst, u32 src,
        struct {
                struct flow_dissector_key_basic bkey;
                struct flow_dissector_key_ports key;
-       } __aligned(BITS_PER_LONG / 8) keys;
+       } __aligned(BITS_PER_LONG / 8) keys = { };
        struct {
                struct flow_dissector_key_basic bmask;
                struct flow_dissector_key_ports mask;
-       } __aligned(BITS_PER_LONG / 8) masks;
+       } __aligned(BITS_PER_LONG / 8) masks = { };
        unsigned long dummy_cookie = 0xdeadbeef;
        struct stmmac_packet_attrs attr = { };
        struct flow_dissector *dissector;
@@ -1509,6 +1509,8 @@ static int __stmmac_test_l4filt(struct stmmac_priv *priv, u32 dst, u32 src,
        keys.bkey.ip_proto = udp ? IPPROTO_UDP : IPPROTO_TCP;
        keys.key.src = htons(src);
        keys.key.dst = htons(dst);
+       /* Match the full IP proto field */
+       masks.bmask.ip_proto = 0xff;
        masks.mask.src = src_mask;
        masks.mask.dst = dst_mask;