The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH net-next v3 0/3] net: stmmac: new features
@ 2025-09-16 12:48 Konrad Leszczynski
  2025-09-16 12:48 ` [PATCH net-next v3 1/3] net: stmmac: enhance VLAN protocol detection for GRO Konrad Leszczynski
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Konrad Leszczynski @ 2025-09-16 12:48 UTC (permalink / raw)
  To: davem, andrew+netdev, edumazet, kuba, pabeni
  Cc: netdev, linux-kernel, cezary.rojewski, sebastian.basierski,
	Konrad Leszczynski

This series adds three new patches which introduce features such as VLAN
protocol detection, TC flower filter support and enhanced descriptor
printing.

Patchset has been created as a result of discussion at [1].

v2 can be found at [2].

[1] https://lore.kernel.org/netdev/20250826113247.3481273-1-konrad.leszczynski@intel.com/
[2] https://lore.kernel.org/netdev/20250828144558.304304-1-konrad.leszczynski@intel.com/

v2 -> v3:
- removed ARP offload patches
- add patch for enhanced descriptor printing

v1 -> v2:
- add missing SoB lines
- place ifa_list under RCU protection

Karol Jurczenia (1):
  net: stmmac: add TC flower filter support for IP EtherType

Piotr Warpechowski (2):
  net: stmmac: enhance VLAN protocol detection for GRO
  net: stmmac: correct Tx descriptors debugfs prints

 drivers/net/ethernet/stmicro/stmmac/stmmac.h  |  1 +
 .../net/ethernet/stmicro/stmmac/stmmac_main.c | 40 +++++++++++++------
 .../net/ethernet/stmicro/stmmac/stmmac_tc.c   | 19 ++++++++-
 3 files changed, 47 insertions(+), 13 deletions(-)

-- 
2.34.1


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

* [PATCH net-next v3 1/3] net: stmmac: enhance VLAN protocol detection for GRO
  2025-09-16 12:48 [PATCH net-next v3 0/3] net: stmmac: new features Konrad Leszczynski
@ 2025-09-16 12:48 ` Konrad Leszczynski
  2025-09-17 14:54   ` Simon Horman
  2025-09-16 12:48 ` [PATCH net-next v3 2/3] net: stmmac: add TC flower filter support for IP EtherType Konrad Leszczynski
  2025-09-16 12:48 ` [PATCH net-next v3 3/3] net: stmmac: correct Tx descriptors debugfs prints Konrad Leszczynski
  2 siblings, 1 reply; 5+ messages in thread
From: Konrad Leszczynski @ 2025-09-16 12:48 UTC (permalink / raw)
  To: davem, andrew+netdev, edumazet, kuba, pabeni
  Cc: netdev, linux-kernel, cezary.rojewski, sebastian.basierski,
	Piotr Warpechowski, Karol Jurczenia, Konrad Leszczynski

From: Piotr Warpechowski <piotr.warpechowski@intel.com>

Enhance protocol extraction in stmmac_has_ip_ethertype() by introducing
MAC offset parameter and changing:

__vlan_get_protocol() ->  __vlan_get_protocol_offset()

Add correct header length for VLAN tags, which enable Generic Receive
Offload (GRO) in VLAN.

Co-developed-by: Karol Jurczenia <karol.jurczenia@intel.com>
Signed-off-by: Karol Jurczenia <karol.jurczenia@intel.com>
Reviewed-by: Konrad Leszczynski <konrad.leszczynski@intel.com>
Reviewed-by: Sebastian Basierski <sebastian.basierski@intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Piotr Warpechowski <piotr.warpechowski@intel.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index fa3d26c28502..4df967500cd3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4566,13 +4566,14 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
  */
 static bool stmmac_has_ip_ethertype(struct sk_buff *skb)
 {
-	int depth = 0;
+	int depth = 0, hlen;
 	__be16 proto;
 
-	proto = __vlan_get_protocol(skb, eth_header_parse_protocol(skb),
-				    &depth);
+	proto = __vlan_get_protocol_offset(skb, skb->protocol,
+					   skb_mac_offset(skb), &depth);
+	hlen = eth_type_vlan(skb->protocol) ? VLAN_ETH_HLEN : ETH_HLEN;
 
-	return (depth <= ETH_HLEN) &&
+	return (depth <= hlen) &&
 		(proto == htons(ETH_P_IP) || proto == htons(ETH_P_IPV6));
 }
 
-- 
2.34.1


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

* [PATCH net-next v3 2/3] net: stmmac: add TC flower filter support for IP EtherType
  2025-09-16 12:48 [PATCH net-next v3 0/3] net: stmmac: new features Konrad Leszczynski
  2025-09-16 12:48 ` [PATCH net-next v3 1/3] net: stmmac: enhance VLAN protocol detection for GRO Konrad Leszczynski
@ 2025-09-16 12:48 ` Konrad Leszczynski
  2025-09-16 12:48 ` [PATCH net-next v3 3/3] net: stmmac: correct Tx descriptors debugfs prints Konrad Leszczynski
  2 siblings, 0 replies; 5+ messages in thread
From: Konrad Leszczynski @ 2025-09-16 12:48 UTC (permalink / raw)
  To: davem, andrew+netdev, edumazet, kuba, pabeni
  Cc: netdev, linux-kernel, cezary.rojewski, sebastian.basierski,
	Karol Jurczenia, Konrad Leszczynski

From: Karol Jurczenia <karol.jurczenia@intel.com>

Add missing Traffic Control (TC) offload for flower filters matching the
IP EtherType (ETH_P_IP).

Reviewed-by: Konrad Leszczynski <konrad.leszczynski@intel.com>
Reviewed-by: Sebastian Basierski <sebastian.basierski@intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Karol Jurczenia <karol.jurczenia@intel.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac.h  |  1 +
 .../net/ethernet/stmicro/stmmac/stmmac_tc.c   | 19 ++++++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 78d6b3737a26..77f900a328aa 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -206,6 +206,7 @@ enum stmmac_rfs_type {
 	STMMAC_RFS_T_VLAN,
 	STMMAC_RFS_T_LLDP,
 	STMMAC_RFS_T_1588,
+	STMMAC_RFS_T_IP,
 	STMMAC_RFS_T_MAX,
 };
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
index 694d6ee14381..c5577652d6ed 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
@@ -239,6 +239,7 @@ static int tc_rfs_init(struct stmmac_priv *priv)
 	priv->rfs_entries_max[STMMAC_RFS_T_VLAN] = 8;
 	priv->rfs_entries_max[STMMAC_RFS_T_LLDP] = 1;
 	priv->rfs_entries_max[STMMAC_RFS_T_1588] = 1;
+	priv->rfs_entries_max[STMMAC_RFS_T_IP] = 32;
 
 	for (i = 0; i < STMMAC_RFS_T_MAX; i++)
 		priv->rfs_entries_total += priv->rfs_entries_max[i];
@@ -777,6 +778,17 @@ static int tc_add_ethtype_flow(struct stmmac_priv *priv,
 			stmmac_rx_queue_routing(priv, priv->hw,
 						PACKET_PTPQ, tc);
 			break;
+		case ETH_P_IP:
+			if (priv->rfs_entries_cnt[STMMAC_RFS_T_IP] >=
+			    priv->rfs_entries_max[STMMAC_RFS_T_IP])
+				return -ENOENT;
+
+			entry->type = STMMAC_RFS_T_IP;
+			priv->rfs_entries_cnt[STMMAC_RFS_T_IP]++;
+
+			stmmac_rx_queue_routing(priv, priv->hw,
+						PACKET_UPQ, tc);
+			break;
 		default:
 			netdev_err(priv->dev, "EthType(0x%x) is not supported", etype);
 			return -EINVAL;
@@ -800,7 +812,7 @@ static int tc_del_ethtype_flow(struct stmmac_priv *priv,
 
 	if (!entry || !entry->in_use ||
 	    entry->type < STMMAC_RFS_T_LLDP ||
-	    entry->type > STMMAC_RFS_T_1588)
+	    entry->type > STMMAC_RFS_T_IP)
 		return -ENOENT;
 
 	switch (entry->etype) {
@@ -814,6 +826,11 @@ static int tc_del_ethtype_flow(struct stmmac_priv *priv,
 					PACKET_PTPQ, 0);
 		priv->rfs_entries_cnt[STMMAC_RFS_T_1588]--;
 		break;
+	case ETH_P_IP:
+		stmmac_rx_queue_routing(priv, priv->hw,
+					PACKET_UPQ, 0);
+		priv->rfs_entries_cnt[STMMAC_RFS_T_IP]--;
+		break;
 	default:
 		netdev_err(priv->dev, "EthType(0x%x) is not supported",
 			   entry->etype);
-- 
2.34.1


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

* [PATCH net-next v3 3/3] net: stmmac: correct Tx descriptors debugfs prints
  2025-09-16 12:48 [PATCH net-next v3 0/3] net: stmmac: new features Konrad Leszczynski
  2025-09-16 12:48 ` [PATCH net-next v3 1/3] net: stmmac: enhance VLAN protocol detection for GRO Konrad Leszczynski
  2025-09-16 12:48 ` [PATCH net-next v3 2/3] net: stmmac: add TC flower filter support for IP EtherType Konrad Leszczynski
@ 2025-09-16 12:48 ` Konrad Leszczynski
  2 siblings, 0 replies; 5+ messages in thread
From: Konrad Leszczynski @ 2025-09-16 12:48 UTC (permalink / raw)
  To: davem, andrew+netdev, edumazet, kuba, pabeni
  Cc: netdev, linux-kernel, cezary.rojewski, sebastian.basierski,
	Piotr Warpechowski, Konrad Leszczynski

From: Piotr Warpechowski <piotr.warpechowski@intel.com>

It was observed that extended descriptors are not printed out fully and
enhanced descriptors are completely omitted in stmmac_rings_status_show().

Correct printing according to documentation and other existing prints in
the driver.

Reviewed-by: Konrad Leszczynski <konrad.leszczynski@intel.com>
Reviewed-by: Sebastian Basierski <sebastian.basierski@intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Piotr Warpechowski <piotr.warpechowski@intel.com>
---
 .../net/ethernet/stmicro/stmmac/stmmac_main.c | 31 ++++++++++++++-----
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 4df967500cd3..38f130cb0c9f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -6355,14 +6355,25 @@ static void sysfs_display_ring(void *head, int size, int extend_desc,
 	desc_size = extend_desc ? sizeof(*ep) : sizeof(*p);
 	for (i = 0; i < size; i++) {
 		dma_addr = dma_phy_addr + i * desc_size;
-		seq_printf(seq, "%d [%pad]: 0x%x 0x%x 0x%x 0x%x\n",
-				i, &dma_addr,
-				le32_to_cpu(p->des0), le32_to_cpu(p->des1),
-				le32_to_cpu(p->des2), le32_to_cpu(p->des3));
-		if (extend_desc)
-			p = &(++ep)->basic;
-		else
+		if (extend_desc) {
+			seq_printf(seq, "%d [%pad]: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",
+				   i, &dma_addr,
+				   le32_to_cpu(ep->basic.des0),
+				   le32_to_cpu(ep->basic.des1),
+				   le32_to_cpu(ep->basic.des2),
+				   le32_to_cpu(ep->basic.des3),
+				   le32_to_cpu(ep->des4),
+				   le32_to_cpu(ep->des5),
+				   le32_to_cpu(ep->des6),
+				   le32_to_cpu(ep->des7));
+			ep++;
+		} else {
+			seq_printf(seq, "%d [%pad]: 0x%x 0x%x 0x%x 0x%x\n",
+				   i, &dma_addr,
+				   le32_to_cpu(p->des0), le32_to_cpu(p->des1),
+				   le32_to_cpu(p->des2), le32_to_cpu(p->des3));
 			p++;
+		}
 	}
 }
 
@@ -6402,7 +6413,11 @@ static int stmmac_rings_status_show(struct seq_file *seq, void *v)
 			seq_printf(seq, "Extended descriptor ring:\n");
 			sysfs_display_ring((void *)tx_q->dma_etx,
 					   priv->dma_conf.dma_tx_size, 1, seq, tx_q->dma_tx_phy);
-		} else if (!(tx_q->tbs & STMMAC_TBS_AVAIL)) {
+		} else if (tx_q->tbs & STMMAC_TBS_AVAIL) {
+			seq_printf(seq, "Enhanced descriptor ring:\n");
+			sysfs_display_ring((void *)tx_q->dma_entx,
+					   priv->dma_conf.dma_tx_size, 1, seq, tx_q->dma_tx_phy);
+		} else {
 			seq_printf(seq, "Descriptor ring:\n");
 			sysfs_display_ring((void *)tx_q->dma_tx,
 					   priv->dma_conf.dma_tx_size, 0, seq, tx_q->dma_tx_phy);
-- 
2.34.1


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

* Re: [PATCH net-next v3 1/3] net: stmmac: enhance VLAN protocol detection for GRO
  2025-09-16 12:48 ` [PATCH net-next v3 1/3] net: stmmac: enhance VLAN protocol detection for GRO Konrad Leszczynski
@ 2025-09-17 14:54   ` Simon Horman
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2025-09-17 14:54 UTC (permalink / raw)
  To: Konrad Leszczynski
  Cc: davem, andrew+netdev, edumazet, kuba, pabeni, netdev,
	linux-kernel, cezary.rojewski, sebastian.basierski,
	Piotr Warpechowski, Karol Jurczenia

On Tue, Sep 16, 2025 at 02:48:06PM +0200, Konrad Leszczynski wrote:
> From: Piotr Warpechowski <piotr.warpechowski@intel.com>
> 
> Enhance protocol extraction in stmmac_has_ip_ethertype() by introducing
> MAC offset parameter and changing:
> 
> __vlan_get_protocol() ->  __vlan_get_protocol_offset()
> 
> Add correct header length for VLAN tags, which enable Generic Receive
> Offload (GRO) in VLAN.
> 
> Co-developed-by: Karol Jurczenia <karol.jurczenia@intel.com>
> Signed-off-by: Karol Jurczenia <karol.jurczenia@intel.com>
> Reviewed-by: Konrad Leszczynski <konrad.leszczynski@intel.com>
> Reviewed-by: Sebastian Basierski <sebastian.basierski@intel.com>
> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
> Signed-off-by: Piotr Warpechowski <piotr.warpechowski@intel.com>

Hi Konrad,

As you are sending these patches, your Signed-off-by line is needed.
I would suggest at the end of the tags. And when present,
you can drop your Reviewed-by tag (it is implied).

Otherwise this patch looks good to me.

Same for the other patches in this series.

-- 
pw-bot: changes-requested

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

end of thread, other threads:[~2025-09-17 14:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-16 12:48 [PATCH net-next v3 0/3] net: stmmac: new features Konrad Leszczynski
2025-09-16 12:48 ` [PATCH net-next v3 1/3] net: stmmac: enhance VLAN protocol detection for GRO Konrad Leszczynski
2025-09-17 14:54   ` Simon Horman
2025-09-16 12:48 ` [PATCH net-next v3 2/3] net: stmmac: add TC flower filter support for IP EtherType Konrad Leszczynski
2025-09-16 12:48 ` [PATCH net-next v3 3/3] net: stmmac: correct Tx descriptors debugfs prints Konrad Leszczynski

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