devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v7 0/2] net: stmmac: Tx coe sw fallback
@ 2023-09-16  6:33 Rohan G Thomas
  2023-09-16  6:33 ` [PATCH net-next v7 1/2] dt-bindings: net: snps,dwmac: Tx coe unsupported Rohan G Thomas
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Rohan G Thomas @ 2023-09-16  6:33 UTC (permalink / raw)
  To: David S . Miller, Alexandre Torgue, Jose Abreu, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Giuseppe Cavallaro,
	fancer.lancer
  Cc: netdev, devicetree, linux-stm32, linux-arm-kernel, linux-kernel,
	Rohan G Thomas

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 v7:
* Updated commit message.
* Add blank lines around newly added dt binding.

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 |  5 +++++
 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, 19 insertions(+)

-- 
2.25.1


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

* [PATCH net-next v7 1/2] dt-bindings: net: snps,dwmac: Tx coe unsupported
  2023-09-16  6:33 [PATCH net-next v7 0/2] net: stmmac: Tx coe sw fallback Rohan G Thomas
@ 2023-09-16  6:33 ` Rohan G Thomas
  2023-09-17 10:03   ` Conor Dooley
  2023-09-16  6:33 ` [PATCH net-next v7 2/2] net: stmmac: Tx coe sw fallback Rohan G Thomas
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Rohan G Thomas @ 2023-09-16  6:33 UTC (permalink / raw)
  To: David S . Miller, Alexandre Torgue, Jose Abreu, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Giuseppe Cavallaro,
	fancer.lancer
  Cc: netdev, devicetree, linux-stm32, linux-arm-kernel, linux-kernel,
	Rohan G Thomas

Add dt-bindings for coe-unsupported property per tx queue. Some DWMAC
IPs support tx checksum offloading(coe) only for a few tx queues.

DW xGMAC IP can be synthesized such that it can support tx coe 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
property is added to have sw fallback for checksum calculation if a
tx queue doesn't support tx coe.

Signed-off-by: Rohan G Thomas <rohan.g.thomas@intel.com>
---
 Documentation/devicetree/bindings/net/snps,dwmac.yaml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index ddf9522a5dc2..5c2769dc689a 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -394,6 +394,11 @@ 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:
-- 
2.25.1


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

* [PATCH net-next v7 2/2] net: stmmac: Tx coe sw fallback
  2023-09-16  6:33 [PATCH net-next v7 0/2] net: stmmac: Tx coe sw fallback Rohan G Thomas
  2023-09-16  6:33 ` [PATCH net-next v7 1/2] dt-bindings: net: snps,dwmac: Tx coe unsupported Rohan G Thomas
@ 2023-09-16  6:33 ` Rohan G Thomas
  2023-09-18  0:35 ` [PATCH net-next v7 0/2] " Serge Semin
  2023-09-18 10:40 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 6+ messages in thread
From: Rohan G Thomas @ 2023-09-16  6:33 UTC (permalink / raw)
  To: David S . Miller, Alexandre Torgue, Jose Abreu, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Giuseppe Cavallaro,
	fancer.lancer
  Cc: netdev, devicetree, linux-stm32, linux-arm-kernel, linux-kernel,
	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.

Signed-off-by: Rohan G Thomas <rohan.g.thomas@intel.com>
---
 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(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 2206789802bf..9201ed778ebc 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -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);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 0f28795e581c..a09014c9e7d0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -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) {
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index ce89cc3e4913..c0079a7574ae 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -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;
-- 
2.25.1


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

* Re: [PATCH net-next v7 1/2] dt-bindings: net: snps,dwmac: Tx coe unsupported
  2023-09-16  6:33 ` [PATCH net-next v7 1/2] dt-bindings: net: snps,dwmac: Tx coe unsupported Rohan G Thomas
@ 2023-09-17 10:03   ` Conor Dooley
  0 siblings, 0 replies; 6+ messages in thread
From: Conor Dooley @ 2023-09-17 10:03 UTC (permalink / raw)
  To: Rohan G Thomas
  Cc: David S . Miller, Alexandre Torgue, Jose Abreu, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Giuseppe Cavallaro,
	fancer.lancer, netdev, devicetree, linux-stm32, linux-arm-kernel,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1569 bytes --]

On Sat, Sep 16, 2023 at 02:33:11PM +0800, Rohan G Thomas wrote:
> Add dt-bindings for coe-unsupported property per tx queue. Some DWMAC
> IPs support tx checksum offloading(coe) only for a few tx queues.
> 
> DW xGMAC IP can be synthesized such that it can support tx coe 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
> property is added to have sw fallback for checksum calculation if a
> tx queue doesn't support tx coe.
> 
> Signed-off-by: Rohan G Thomas <rohan.g.thomas@intel.com>

Acked-by: Conor Dooley <conor.dooley@microchip.com>

Thanks,
Conor.

> ---
>  Documentation/devicetree/bindings/net/snps,dwmac.yaml | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> index ddf9522a5dc2..5c2769dc689a 100644
> --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> @@ -394,6 +394,11 @@ 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:
> -- 
> 2.25.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH net-next v7 0/2] net: stmmac: Tx coe sw fallback
  2023-09-16  6:33 [PATCH net-next v7 0/2] net: stmmac: Tx coe sw fallback Rohan G Thomas
  2023-09-16  6:33 ` [PATCH net-next v7 1/2] dt-bindings: net: snps,dwmac: Tx coe unsupported Rohan G Thomas
  2023-09-16  6:33 ` [PATCH net-next v7 2/2] net: stmmac: Tx coe sw fallback Rohan G Thomas
@ 2023-09-18  0:35 ` Serge Semin
  2023-09-18 10:40 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 6+ messages in thread
From: Serge Semin @ 2023-09-18  0:35 UTC (permalink / raw)
  To: Rohan G Thomas
  Cc: David S . Miller, Alexandre Torgue, Jose Abreu, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Giuseppe Cavallaro, netdev,
	devicetree, linux-stm32, linux-arm-kernel, linux-kernel

On Sat, Sep 16, 2023 at 02:33:10PM +0800, Rohan G Thomas wrote:
> 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.

The series looks good to me. Thanks!
Reviewed-by: Serge Semin <fancer.lancer@gmail.com>

-Serge(y)

> 
> changelog v7:
> * Updated commit message.
> * Add blank lines around newly added dt binding.
> 
> 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 |  5 +++++
>  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, 19 insertions(+)
> 
> -- 
> 2.25.1
> 

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

* Re: [PATCH net-next v7 0/2] net: stmmac: Tx coe sw fallback
  2023-09-16  6:33 [PATCH net-next v7 0/2] net: stmmac: Tx coe sw fallback Rohan G Thomas
                   ` (2 preceding siblings ...)
  2023-09-18  0:35 ` [PATCH net-next v7 0/2] " Serge Semin
@ 2023-09-18 10:40 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-09-18 10:40 UTC (permalink / raw)
  To: Rohan G Thomas
  Cc: davem, alexandre.torgue, joabreu, edumazet, kuba, pabeni,
	mcoquelin.stm32, robh+dt, krzysztof.kozlowski+dt, conor+dt,
	peppe.cavallaro, fancer.lancer, netdev, devicetree, linux-stm32,
	linux-arm-kernel, linux-kernel

Hello:

This series was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Sat, 16 Sep 2023 14:33:10 +0800 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [net-next,v7,1/2] dt-bindings: net: snps,dwmac: Tx coe unsupported
    https://git.kernel.org/netdev/net-next/c/6fb8c20a04be
  - [net-next,v7,2/2] net: stmmac: Tx coe sw fallback
    https://git.kernel.org/netdev/net-next/c/8452a05b2c63

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2023-09-18 10:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-16  6:33 [PATCH net-next v7 0/2] net: stmmac: Tx coe sw fallback Rohan G Thomas
2023-09-16  6:33 ` [PATCH net-next v7 1/2] dt-bindings: net: snps,dwmac: Tx coe unsupported Rohan G Thomas
2023-09-17 10:03   ` Conor Dooley
2023-09-16  6:33 ` [PATCH net-next v7 2/2] net: stmmac: Tx coe sw fallback Rohan G Thomas
2023-09-18  0:35 ` [PATCH net-next v7 0/2] " Serge Semin
2023-09-18 10:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).