mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/4] net: stmmac: L3/L4 filter fixes and improvements
@ 2026-06-03  7:29 muhammad.nazim.amirul.nazle.asmade
  2026-06-03  7:29 ` [PATCH 1/4] net: stmmac: xgmac: fix l4 filter port overwrite on register update muhammad.nazim.amirul.nazle.asmade
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: muhammad.nazim.amirul.nazle.asmade @ 2026-06-03  7:29 UTC (permalink / raw)
  To: netdev
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, rmk+kernel,
	maxime.chevallier, Jose.Abreu, linux-kernel

From: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>

This series addresses several issues in the stmmac L3/L4 TC flower filter
implementation for the XGMAC2 core.

Patch 1 fixes a register corruption bug in the L4 filter port configuration.
The XGMAC_L4_ADDR register holds both source and destination port match
values in a single register. The original code overwrites the entire register
when setting either field, silently erasing the other. This is fixed by
using a read-modify-write sequence.

Patch 2 fixes the basic flow match parser to properly reject unsupported
offload requests with -EOPNOTSUPP instead of silently accepting them.
Unsupported cases include partial protocol masks, non-IPv4 network proto,
and non-TCP/UDP transport proto.

Patch 3 fixes a stale action bug on filter deletion. When a filter entry
with a drop action is deleted, the action field was not reset, causing
it to persist and potentially affect subsequent filter configurations.

Patch 4 adds L3/L4 filter match counting to the ethtool statistics by
reading the L3FM and L4FM bits from the RX descriptor status word (RDES2),
allowing users to observe filter hit rates via ethtool -S.

Patches 1-3 all fix the original L3/L4 filter implementation introduced in
425eabddaf0f ("net: stmmac: Implement L3/L4 Filters using TC Flower").

Nazim Amirul (4):
  net: stmmac: xgmac: fix l4 filter port overwrite on register update
  net: stmmac: fix l3l4 filter rejecting unsupported offload requests
  net: stmmac: reset residual action in L3L4 filters on delete
  net: stmmac: xgmac: report L3/L4 filter match count in ethtool stats

 .../net/ethernet/stmicro/stmmac/dwxgmac2.h    |  2 ++
 .../ethernet/stmicro/stmmac/dwxgmac2_core.c   | 28 +++++++++++--------
 .../ethernet/stmicro/stmmac/dwxgmac2_descs.c  |  6 ++++
 .../net/ethernet/stmicro/stmmac/stmmac_tc.c   | 27 ++++++++++++++++++
 4 files changed, 51 insertions(+), 12 deletions(-)

-- 
2.43.7


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/4] net: stmmac: xgmac: fix l4 filter port overwrite on register update
  2026-06-03  7:29 [PATCH 0/4] net: stmmac: L3/L4 filter fixes and improvements muhammad.nazim.amirul.nazle.asmade
@ 2026-06-03  7:29 ` muhammad.nazim.amirul.nazle.asmade
  2026-06-03  7:29 ` [PATCH 2/4] net: stmmac: fix l3l4 filter rejecting unsupported offload requests muhammad.nazim.amirul.nazle.asmade
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: muhammad.nazim.amirul.nazle.asmade @ 2026-06-03  7:29 UTC (permalink / raw)
  To: netdev
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, rmk+kernel,
	maxime.chevallier, Jose.Abreu, linux-kernel

From: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>

The XGMAC_L4_ADDR register holds both source and destination port
match values. The current implementation overwrites the entire register
when configuring either port, so setting one silently erases the other.

Fix this by reading the register first, then masking and updating only
the relevant field before writing back.

Fixes: 425eabddaf0f ("net: stmmac: Implement L3/L4 Filters using TC Flower")
Signed-off-by: Rohan G Thomas <rohan.g.thomas@altera.com>
Signed-off-by: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>
---
 .../ethernet/stmicro/stmmac/dwxgmac2_core.c   | 28 +++++++++++--------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
index f02b434bbd50..52054f31376d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
@@ -1370,36 +1370,40 @@ static int dwxgmac2_config_l4_filter(struct mac_device_info *hw, u32 filter_no,
 		value &= ~XGMAC_L4PEN0;
 	}
 
-	value &= ~(XGMAC_L4SPM0 | XGMAC_L4SPIM0);
-	value &= ~(XGMAC_L4DPM0 | XGMAC_L4DPIM0);
 	if (sa) {
 		value |= XGMAC_L4SPM0;
 		if (inv)
 			value |= XGMAC_L4SPIM0;
+		else
+			value &= ~XGMAC_L4SPIM0;
 	} else {
 		value |= XGMAC_L4DPM0;
 		if (inv)
 			value |= XGMAC_L4DPIM0;
+		else
+			value &= ~XGMAC_L4DPIM0;
 	}
 
 	ret = dwxgmac2_filter_write(hw, filter_no, XGMAC_L3L4_CTRL, value);
 	if (ret)
 		return ret;
 
-	if (sa) {
-		value = FIELD_PREP(XGMAC_L4SP0, match);
+	ret = dwxgmac2_filter_read(hw, filter_no, XGMAC_L4_ADDR, &value);
+	if (ret)
+		return ret;
 
-		ret = dwxgmac2_filter_write(hw, filter_no, XGMAC_L4_ADDR, value);
-		if (ret)
-			return ret;
+	if (sa) {
+		value &= ~XGMAC_L4SP0;
+		value |= FIELD_PREP(XGMAC_L4SP0, match);
 	} else {
-		value = FIELD_PREP(XGMAC_L4DP0, match);
-
-		ret = dwxgmac2_filter_write(hw, filter_no, XGMAC_L4_ADDR, value);
-		if (ret)
-			return ret;
+		value &= ~XGMAC_L4DP0;
+		value |= FIELD_PREP(XGMAC_L4DP0, match);
 	}
 
+	ret = dwxgmac2_filter_write(hw, filter_no, XGMAC_L4_ADDR, value);
+	if (ret)
+		return ret;
+
 	if (!en)
 		return dwxgmac2_filter_write(hw, filter_no, XGMAC_L3L4_CTRL, 0);
 
-- 
2.43.7


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/4] net: stmmac: fix l3l4 filter rejecting unsupported offload requests
  2026-06-03  7:29 [PATCH 0/4] net: stmmac: L3/L4 filter fixes and improvements muhammad.nazim.amirul.nazle.asmade
  2026-06-03  7:29 ` [PATCH 1/4] net: stmmac: xgmac: fix l4 filter port overwrite on register update muhammad.nazim.amirul.nazle.asmade
@ 2026-06-03  7:29 ` muhammad.nazim.amirul.nazle.asmade
  2026-06-03  7:29 ` [PATCH 3/4] net: stmmac: reset residual action in L3L4 filters on delete muhammad.nazim.amirul.nazle.asmade
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: muhammad.nazim.amirul.nazle.asmade @ 2026-06-03  7:29 UTC (permalink / raw)
  To: netdev
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, rmk+kernel,
	maxime.chevallier, Jose.Abreu, linux-kernel

From: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>

The basic flow parser in tc_add_basic_flow() does not validate match
keys before proceeding. Unsupported offload configurations such as
partial protocol masks, non-IPv4 network proto, or non-TCP/UDP transport
proto are silently accepted instead of returning -EOPNOTSUPP.

Add validation to return -EOPNOTSUPP early for:
- No network or transport proto present in the key
- Partial protocol mask (only full mask supported)
- Network proto is not IPv4
- Transport proto is not TCP or UDP

Also propagate -EOPNOTSUPP from the basic flow parser in tc_add_flow()
to fail early rather than continue with subsequent parsers.

Fixes: 425eabddaf0f ("net: stmmac: Implement L3/L4 Filters using TC Flower")
Signed-off-by: Rohan G Thomas <rohan.g.thomas@altera.com>
Signed-off-by: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>
---
 .../net/ethernet/stmicro/stmmac/stmmac_tc.c   | 26 +++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
index d78652718599..869f84756ca5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
@@ -446,6 +446,7 @@ static int tc_parse_flow_actions(struct stmmac_priv *priv,
 }
 
 #define ETHER_TYPE_FULL_MASK	cpu_to_be16(~0)
+#define IP_PROTO_FULL_MASK	0xFF
 
 static int tc_add_basic_flow(struct stmmac_priv *priv,
 			     struct flow_cls_offload *cls,
@@ -461,6 +462,25 @@ static int tc_add_basic_flow(struct stmmac_priv *priv,
 
 	flow_rule_match_basic(rule, &match);
 
+	/* Both network proto and transport proto not present in the key */
+	if (!match.mask || !(match.mask->n_proto || match.mask->ip_proto))
+		return -EOPNOTSUPP;
+
+	/* If the proto is present in the key and is not full mask */
+	if ((match.mask->n_proto && match.mask->n_proto != ETHER_TYPE_FULL_MASK) ||
+	    (match.mask->ip_proto && match.mask->ip_proto != IP_PROTO_FULL_MASK))
+		return -EOPNOTSUPP;
+
+	/* Network proto is present in the key and is not IPv4 */
+	if (match.mask->n_proto && match.key->n_proto != cpu_to_be16(ETH_P_IP))
+		return -EOPNOTSUPP;
+
+	/* Transport proto is present in the key and is not TCP or UDP */
+	if (match.mask->ip_proto &&
+	    match.key->ip_proto != IPPROTO_TCP &&
+	    match.key->ip_proto != IPPROTO_UDP)
+		return -EOPNOTSUPP;
+
 	entry->ip_proto = match.key->ip_proto;
 	return 0;
 }
@@ -598,6 +618,12 @@ static int tc_add_flow(struct stmmac_priv *priv,
 		ret = tc_flow_parsers[i].fn(priv, cls, entry);
 		if (!ret)
 			entry->in_use = true;
+		else if (ret == -EOPNOTSUPP)
+			/* The basic flow parser will return EOPNOTSUPP, if a
+			 * requested offload not fully supported by the hw. And
+			 * in that case fail early.
+			 */
+			break;
 	}
 
 	if (!entry->in_use)
-- 
2.43.7


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/4] net: stmmac: reset residual action in L3L4 filters on delete
  2026-06-03  7:29 [PATCH 0/4] net: stmmac: L3/L4 filter fixes and improvements muhammad.nazim.amirul.nazle.asmade
  2026-06-03  7:29 ` [PATCH 1/4] net: stmmac: xgmac: fix l4 filter port overwrite on register update muhammad.nazim.amirul.nazle.asmade
  2026-06-03  7:29 ` [PATCH 2/4] net: stmmac: fix l3l4 filter rejecting unsupported offload requests muhammad.nazim.amirul.nazle.asmade
@ 2026-06-03  7:29 ` muhammad.nazim.amirul.nazle.asmade
  2026-06-03  7:29 ` [PATCH 4/4] net: stmmac: xgmac: report L3/L4 filter match count in ethtool stats muhammad.nazim.amirul.nazle.asmade
  2026-06-03 13:19 ` [PATCH 0/4] net: stmmac: L3/L4 filter fixes and improvements Andrew Lunn
  4 siblings, 0 replies; 8+ messages in thread
From: muhammad.nazim.amirul.nazle.asmade @ 2026-06-03  7:29 UTC (permalink / raw)
  To: netdev
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, rmk+kernel,
	maxime.chevallier, Jose.Abreu, linux-kernel

From: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>

When deleting an L3/L4 flower filter entry, the action field is not
reset. If a filter was previously configured with a drop action, that
action may persist and affect subsequent filter configurations
unintentionally.

Clear the action field when the filter entry is deleted.

Fixes: 425eabddaf0f ("net: stmmac: Implement L3/L4 Filters using TC Flower")
Signed-off-by: Rohan G Thomas <rohan.g.thomas@altera.com>
Signed-off-by: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
index 869f84756ca5..4f9758eeb86f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
@@ -653,6 +653,7 @@ static int tc_del_flow(struct stmmac_priv *priv,
 	entry->in_use = false;
 	entry->cookie = 0;
 	entry->is_l4 = false;
+	entry->action = 0;
 	return ret;
 }
 
-- 
2.43.7


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 4/4] net: stmmac: xgmac: report L3/L4 filter match count in ethtool stats
  2026-06-03  7:29 [PATCH 0/4] net: stmmac: L3/L4 filter fixes and improvements muhammad.nazim.amirul.nazle.asmade
                   ` (2 preceding siblings ...)
  2026-06-03  7:29 ` [PATCH 3/4] net: stmmac: reset residual action in L3L4 filters on delete muhammad.nazim.amirul.nazle.asmade
@ 2026-06-03  7:29 ` muhammad.nazim.amirul.nazle.asmade
  2026-06-03 13:19 ` [PATCH 0/4] net: stmmac: L3/L4 filter fixes and improvements Andrew Lunn
  4 siblings, 0 replies; 8+ messages in thread
From: muhammad.nazim.amirul.nazle.asmade @ 2026-06-03  7:29 UTC (permalink / raw)
  To: netdev
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, rmk+kernel,
	maxime.chevallier, Jose.Abreu, linux-kernel

From: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>

Read the L3FM and L4FM bits from the RX descriptor status word (RDES2)
and increment the corresponding ethtool statistics counters. This allows
users to observe L3/L4 filter hit rates via ethtool -S.

Signed-off-by: Rohan G Thomas <rohan.g.thomas@altera.com>
Signed-off-by: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h       | 2 ++
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
index 51943705a2b0..95fdf3133208 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
@@ -429,6 +429,8 @@
 #define XGMAC_TDES3_VLTV		BIT(16)
 #define XGMAC_TDES3_VT			GENMASK(15, 0)
 #define XGMAC_TDES3_FL			GENMASK(14, 0)
+#define XGMAC_RDES2_L4FM		BIT(28)
+#define XGMAC_RDES2_L3FM		BIT(27)
 #define XGMAC_RDES2_HL			GENMASK(9, 0)
 #define XGMAC_RDES3_OWN			BIT(31)
 #define XGMAC_RDES3_CTXT		BIT(30)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c
index b5f200a87484..6719ac6e395b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c
@@ -27,6 +27,7 @@ static int dwxgmac2_get_rx_status(struct stmmac_extra_stats *x,
 				  struct dma_desc *p)
 {
 	u32 rdes3 = le32_to_cpu(p->des3);
+	u32 rdes2 = le32_to_cpu(p->des2);
 
 	if (unlikely(rdes3 & XGMAC_RDES3_OWN))
 		return dma_own;
@@ -37,6 +38,11 @@ static int dwxgmac2_get_rx_status(struct stmmac_extra_stats *x,
 	if (unlikely((rdes3 & XGMAC_RDES3_ES) && (rdes3 & XGMAC_RDES3_LD)))
 		return discard_frame;
 
+	if (rdes2 & XGMAC_RDES2_L3FM)
+		x->l3_filter_match++;
+	if (rdes2 & XGMAC_RDES2_L4FM)
+		x->l4_filter_match++;
+
 	return good_frame;
 }
 
-- 
2.43.7


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/4] net: stmmac: L3/L4 filter fixes and improvements
  2026-06-03  7:29 [PATCH 0/4] net: stmmac: L3/L4 filter fixes and improvements muhammad.nazim.amirul.nazle.asmade
                   ` (3 preceding siblings ...)
  2026-06-03  7:29 ` [PATCH 4/4] net: stmmac: xgmac: report L3/L4 filter match count in ethtool stats muhammad.nazim.amirul.nazle.asmade
@ 2026-06-03 13:19 ` Andrew Lunn
  2026-06-04  8:39   ` Nazle Asmade, Muhammad Nazim Amirul
  4 siblings, 1 reply; 8+ messages in thread
From: Andrew Lunn @ 2026-06-03 13:19 UTC (permalink / raw)
  To: muhammad.nazim.amirul.nazle.asmade
  Cc: netdev, andrew+netdev, davem, edumazet, kuba, pabeni, rmk+kernel,
	maxime.chevallier, Jose.Abreu, linux-kernel

On Wed, Jun 03, 2026 at 12:29:21AM -0700, muhammad.nazim.amirul.nazle.asmade@altera.com wrote:
> From: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>
> 
> This series addresses several issues in the stmmac L3/L4 TC flower filter
> implementation for the XGMAC2 core.
> 
> Patch 1 fixes a register corruption bug in the L4 filter port configuration.
> The XGMAC_L4_ADDR register holds both source and destination port match
> values in a single register. The original code overwrites the entire register
> when setting either field, silently erasing the other. This is fixed by
> using a read-modify-write sequence.
> 
> Patch 2 fixes the basic flow match parser to properly reject unsupported
> offload requests with -EOPNOTSUPP instead of silently accepting them.
> Unsupported cases include partial protocol masks, non-IPv4 network proto,
> and non-TCP/UDP transport proto.
> 
> Patch 3 fixes a stale action bug on filter deletion. When a filter entry
> with a drop action is deleted, the action field was not reset, causing
> it to persist and potentially affect subsequent filter configurations.

Please base these on net.

https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html

> 
> Patch 4 adds L3/L4 filter match counting to the ethtool statistics by
> reading the L3FM and L4FM bits from the RX descriptor status word (RDES2),
> allowing users to observe filter hit rates via ethtool -S.

and this one on net-next.

    Andrew

---
pw-bot: cr
	

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/4] net: stmmac: L3/L4 filter fixes and improvements
  2026-06-03 13:19 ` [PATCH 0/4] net: stmmac: L3/L4 filter fixes and improvements Andrew Lunn
@ 2026-06-04  8:39   ` Nazle Asmade, Muhammad Nazim Amirul
  0 siblings, 0 replies; 8+ messages in thread
From: Nazle Asmade, Muhammad Nazim Amirul @ 2026-06-04  8:39 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: netdev, andrew+netdev, davem, edumazet, kuba, pabeni, rmk+kernel,
	maxime.chevallier, Jose.Abreu, linux-kernel

On 3/6/2026 9:19 pm, Andrew Lunn wrote:
> On Wed, Jun 03, 2026 at 12:29:21AM -0700, muhammad.nazim.amirul.nazle.asmade@altera.com wrote:
>> From: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>
>>
>> This series addresses several issues in the stmmac L3/L4 TC flower filter
>> implementation for the XGMAC2 core.
>>
>> Patch 1 fixes a register corruption bug in the L4 filter port configuration.
>> The XGMAC_L4_ADDR register holds both source and destination port match
>> values in a single register. The original code overwrites the entire register
>> when setting either field, silently erasing the other. This is fixed by
>> using a read-modify-write sequence.
>>
>> Patch 2 fixes the basic flow match parser to properly reject unsupported
>> offload requests with -EOPNOTSUPP instead of silently accepting them.
>> Unsupported cases include partial protocol masks, non-IPv4 network proto,
>> and non-TCP/UDP transport proto.
>>
>> Patch 3 fixes a stale action bug on filter deletion. When a filter entry
>> with a drop action is deleted, the action field was not reset, causing
>> it to persist and potentially affect subsequent filter configurations.
>
> Please base these on net.
>
> https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
>
>>
>> Patch 4 adds L3/L4 filter match counting to the ethtool statistics by
>> reading the L3FM and L4FM bits from the RX descriptor status word (RDES2),
>> allowing users to observe filter hit rates via ethtool -S.
>
> and this one on net-next.
>
>      Andrew
>
> ---
> pw-bot: cr
>
Hi Andrew,

Thanks for a quick reply, I already move patch 4 to net-next and remain
the rest on net as per requested. Thanks!

Note: I mistakenly resend the wrong cover letter which was for previous
version, please ignore that

patch 1 to 3
https://lore.kernel.org/all/20260604083350.1701-2-muhammad.nazim.amirul.nazle.asmade@altera.com/
https://lore.kernel.org/all/20260604083350.1701-3-muhammad.nazim.amirul.nazle.asmade@altera.com/
https://lore.kernel.org/all/20260604083350.1701-4-muhammad.nazim.amirul.nazle.asmade@altera.com/
https://lore.kernel.org/all/20260604083350.1701-5-muhammad.nazim.amirul.nazle.asmade@altera.com/

patch 4
https://lore.kernel.org/all/20260604083037.24407-1-muhammad.nazim.amirul.nazle.asmade@altera.com/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 0/4] net: stmmac: L3/L4 filter fixes and improvements
@ 2026-06-04  8:33 muhammad.nazim.amirul.nazle.asmade
  0 siblings, 0 replies; 8+ messages in thread
From: muhammad.nazim.amirul.nazle.asmade @ 2026-06-04  8:33 UTC (permalink / raw)
  To: netdev
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, rmk+kernel,
	maxime.chevallier, Jose.Abreu, linux-kernel

From: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>

This series addresses several issues in the stmmac L3/L4 TC flower filter
implementation for the XGMAC2 core.

Patch 1 fixes a register corruption bug in the L4 filter port configuration.
The XGMAC_L4_ADDR register holds both source and destination port match
values in a single register. The original code overwrites the entire register
when setting either field, silently erasing the other. This is fixed by
using a read-modify-write sequence.

Patch 2 fixes the basic flow match parser to properly reject unsupported
offload requests with -EOPNOTSUPP instead of silently accepting them.
Unsupported cases include partial protocol masks, non-IPv4 network proto,
and non-TCP/UDP transport proto.

Patch 3 fixes a stale action bug on filter deletion. When a filter entry
with a drop action is deleted, the action field was not reset, causing
it to persist and potentially affect subsequent filter configurations.

Patch 4 adds L3/L4 filter match counting to the ethtool statistics by
reading the L3FM and L4FM bits from the RX descriptor status word (RDES2),
allowing users to observe filter hit rates via ethtool -S.

Patches 1-3 all fix the original L3/L4 filter implementation introduced in
425eabddaf0f ("net: stmmac: Implement L3/L4 Filters using TC Flower").

Nazim Amirul (4):
  net: stmmac: xgmac: fix l4 filter port overwrite on register update
  net: stmmac: fix l3l4 filter rejecting unsupported offload requests
  net: stmmac: reset residual action in L3L4 filters on delete
  net: stmmac: xgmac: report L3/L4 filter match count in ethtool stats

 .../net/ethernet/stmicro/stmmac/dwxgmac2.h    |  2 ++
 .../ethernet/stmicro/stmmac/dwxgmac2_core.c   | 28 +++++++++++--------
 .../ethernet/stmicro/stmmac/dwxgmac2_descs.c  |  6 ++++
 .../net/ethernet/stmicro/stmmac/stmmac_tc.c   | 27 ++++++++++++++++++
 4 files changed, 51 insertions(+), 12 deletions(-)

-- 
2.43.7


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-06-04  8:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-03  7:29 [PATCH 0/4] net: stmmac: L3/L4 filter fixes and improvements muhammad.nazim.amirul.nazle.asmade
2026-06-03  7:29 ` [PATCH 1/4] net: stmmac: xgmac: fix l4 filter port overwrite on register update muhammad.nazim.amirul.nazle.asmade
2026-06-03  7:29 ` [PATCH 2/4] net: stmmac: fix l3l4 filter rejecting unsupported offload requests muhammad.nazim.amirul.nazle.asmade
2026-06-03  7:29 ` [PATCH 3/4] net: stmmac: reset residual action in L3L4 filters on delete muhammad.nazim.amirul.nazle.asmade
2026-06-03  7:29 ` [PATCH 4/4] net: stmmac: xgmac: report L3/L4 filter match count in ethtool stats muhammad.nazim.amirul.nazle.asmade
2026-06-03 13:19 ` [PATCH 0/4] net: stmmac: L3/L4 filter fixes and improvements Andrew Lunn
2026-06-04  8:39   ` Nazle Asmade, Muhammad Nazim Amirul
2026-06-04  8:33 muhammad.nazim.amirul.nazle.asmade

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®