Skip to contentSkip to conversation

net: stmmac: Tx coe sw fallback

PATCH Superseded Rohan G Thomas 2 participants 5 messages Sep 15, 2023 – Sep 16, 2023

Subsystems (5)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v6 cover net: stmmac: Tx coe sw fallback

Hi,
DW xGMAC IP can be synthesized such that it can support tx checksum offloading only for a few initial tx queues. Also as Serge pointed out, for the DW QoS IP, tx coe can be individually configured for each tx queue. This patchset adds support for tx coe sw fallback for those queues that don't support tx coe. Also, add binding for snps,coe-unsupported property.

changelog v6:
* Reworked patchset to cover DW QoS Ethernet IP also.

changelog v5:
* As rightly suggested by Serge, reworked redundant code.

changelog v4:
* Replaced tx_q_coe_lmt with bit flag.

changelog v3:
* Resend with complete email list.

changelog v2:
* Reformed binding description.
* Minor grammatical corrections in comments and commit messages.

Rohan G Thomas (2):
dt-bindings: net: snps,dwmac: Tx coe unsupported
net: stmmac: Tx coe sw fallback

 Documentation/devicetree/bindings/net/snps,dwmac.yaml |  3 +++
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c     | 10 ++++++++++
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |  3 +++
 include/linux/stmmac.h                                |  1 +
 4 files changed, 17 insertions(+)
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw

PATCH v6 1/2 dt-bindings: net: snps,dwmac: Tx coe unsupported

Add dt-bindings for coe-unsupported property per tx queue.

---
 Documentation/devicetree/bindings/net/snps,dwmac.yaml | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/net/snps,dwmac.yaml +3 -0
index ddf9522a5dc2..365e6cb73484 100644
@@ -394,6 +394,9 @@ properties:
               When a PFC frame is received with priorities matching the bitmask,
               the queue is blocked from transmitting for the pause time specified
               in the PFC frame.
+          snps,coe-unsupported:
+            type: boolean
+            description: TX checksum offload is unsupported by the TX queue.
         allOf:
           - if:
               required:
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer
#2 lore raw

Re: [PATCH net-next v6 1/2] dt-bindings: net: snps,dwmac: Tx coe unsupported

Quoted 1 line · Rohan G Thomas

Add dt-bindings for coe-unsupported property per tx queue.

Why? (What every commit msg should answer)

Quoted 11 lines
---
 Documentation/devicetree/bindings/net/snps,dwmac.yaml | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/net/snps,dwmac.yaml +0 -0
index ddf9522a5dc2..365e6cb73484 100644

Documentation/devicetree/bindings/net/snps,dwmac.yaml properties: · line 396

Quoted 3 lines
Documentation/devicetree/bindings/net/snps,dwmac.yaml +0 -0
@@ -394,6 +394,9 @@ properties:
               When a PFC frame is received with priorities matching the bitmask,
               the queue is blocked from transmitting for the pause time specified
               in the PFC frame.

blank line needed

Documentation/devicetree/bindings/net/snps,dwmac.yaml properties: · line 399

Quoted 3 lines
Documentation/devicetree/bindings/net/snps,dwmac.yaml +3 -0
+          snps,coe-unsupported:
+            type: boolean
+            description: TX checksum offload is unsupported by the TX queue.

And here.

Quoted 6 lines
Documentation/devicetree/bindings/net/snps,dwmac.yaml +0 -0
         allOf:
           - if:
               required:
Signature · 1 line
2.25.1
#3 lore raw

Re: [linux-drivers-review] [PATCH net-next v2 1/3] net: stmmac: xgmac: EST interrupts handling

From: Rohan G Thomas <[email protected]>

Thanks for the review comments.
Will address this in the next version.

Quoted 33 lines · Rohan G Thomas
Quoted 1 line

Add dt-bindings for coe-unsupported property per tx queue.

Why? (What every commit msg should answer)

Quoted 11 lines
---
 Documentation/devicetree/bindings/net/snps,dwmac.yaml | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/net/snps,dwmac.yaml +0 -0
index ddf9522a5dc2..365e6cb73484 100644

Documentation/devicetree/bindings/net/snps,dwmac.yaml properties: · line 396

Quoted 3 lines
Documentation/devicetree/bindings/net/snps,dwmac.yaml +0 -0
@@ -394,6 +394,9 @@ properties:
               When a PFC frame is received with priorities matching the bitmask,
               the queue is blocked from transmitting for the pause time specified
               in the PFC frame.

blank line needed

Documentation/devicetree/bindings/net/snps,dwmac.yaml properties: · line 399

Quoted 3 lines
Documentation/devicetree/bindings/net/snps,dwmac.yaml +3 -0
+          snps,coe-unsupported:
+            type: boolean
+            description: TX checksum offload is unsupported by the TX queue.

And here.

Quoted 6 lines
Documentation/devicetree/bindings/net/snps,dwmac.yaml +0 -0
         allOf:
           - if:
               required:
Signature · 1 line
2.25.1
#4 lore raw

PATCH v6 2/2 net: stmmac: Tx coe sw fallback

In reply to Rohan G Thomas

Add sw fallback of tx checksum calculation for those tx queues that don't support tx checksum offloading. DW xGMAC IP can be synthesized such that it can support tx checksum offloading only for a few initial tx queues. Also as Serge pointed out, for the DW QoS IP, tx coe can be individually configured for each tx queue.

So when tx coe is enabled, for any tx queue that doesn't support tx coe with 'coe-unsupported' flag set will have a sw fallback happen in the driver for tx checksum calculation when any packets to be transmitted on these tx queues.

---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c     | 10 ++++++++++
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |  3 +++
 include/linux/stmmac.h                                |  1 +
 3 files changed, 14 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +10 -0
index 2206789802bf..9201ed778ebc 100644
@@ -4401,6 +4401,16 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
 	WARN_ON(tx_q->tx_skbuff[first_entry]);
 
 	csum_insertion = (skb->ip_summed == CHECKSUM_PARTIAL);
+	/* DWMAC IPs can be synthesized to support tx coe only for a few tx
+	 * queues. In that case, checksum offloading for those queues that don't
+	 * support tx coe needs to fallback to software checksum calculation.
+	 */
+	if (csum_insertion &&
+	    priv->plat->tx_queues_cfg[queue].coe_unsupported) {
+		if (unlikely(skb_checksum_help(skb)))
+			goto dma_map_err;
+		csum_insertion = !csum_insertion;
+	}
 
 	if (likely(priv->extend_desc))
 		desc = (struct dma_desc *)(tx_q->dma_etx + entry);
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +3 -0
index 0f28795e581c..a09014c9e7d0 100644
@@ -276,6 +276,9 @@ static int stmmac_mtl_setup(struct platform_device *pdev,
 			plat->tx_queues_cfg[queue].use_prio = true;
 		}
 
+		plat->tx_queues_cfg[queue].coe_unsupported =
+			of_property_read_bool(q_node, "snps,coe-unsupported");
+
 		queue++;
 	}
 	if (queue != plat->tx_queues_to_use) {
include/linux/stmmac.h +1 -0
index ce89cc3e4913..c0079a7574ae 100644
@@ -139,6 +139,7 @@ struct stmmac_rxq_cfg {
 
 struct stmmac_txq_cfg {
 	u32 weight;
+	bool coe_unsupported;
 	u8 mode_to_use;
 	/* Credit Base Shaper parameters */
 	u32 send_slope;
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel