linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/4] net: xilinx: axienet: Partial checksum offload improvements
@ 2024-09-09 16:10 Sean Anderson
  2024-09-09 16:10 ` [PATCH net-next v2 1/4] net: xilinx: axienet: Remove unused checksum variables Sean Anderson
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Sean Anderson @ 2024-09-09 16:10 UTC (permalink / raw)
  To: Radhey Shyam Pandey, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev
  Cc: linux-arm-kernel, linux-kernel, Michal Simek, Sean Anderson

Partial checksum offload is not always used when it could be. Enable it
in more cases.

Changes in v2:
- Set RXCSUM in features
- Expand commit message with testing methodology

Sean Anderson (4):
  net: xilinx: axienet: Remove unused checksum variables
  net: xilinx: axienet: Enable NETIF_F_HW_CSUM for partial tx
    checksumming
  net: xilinx: axienet: Set RXCSUM in features
  net: xilinx: axienet: Relax partial rx checksum checks

 drivers/net/ethernet/xilinx/xilinx_axienet.h  |  5 -----
 .../net/ethernet/xilinx/xilinx_axienet_main.c | 22 +++++--------------
 2 files changed, 5 insertions(+), 22 deletions(-)

-- 
2.35.1.1320.gc452695387.dirty



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

* [PATCH net-next v2 1/4] net: xilinx: axienet: Remove unused checksum variables
  2024-09-09 16:10 [PATCH net-next v2 0/4] net: xilinx: axienet: Partial checksum offload improvements Sean Anderson
@ 2024-09-09 16:10 ` Sean Anderson
  2024-09-09 16:10 ` [PATCH net-next v2 2/4] net: xilinx: axienet: Enable NETIF_F_HW_CSUM for partial tx checksumming Sean Anderson
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Sean Anderson @ 2024-09-09 16:10 UTC (permalink / raw)
  To: Radhey Shyam Pandey, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev
  Cc: linux-arm-kernel, linux-kernel, Michal Simek, Sean Anderson,
	Simon Horman

These variables are set but never used. Remove them.

Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
---

(no changes since v1)

 drivers/net/ethernet/xilinx/xilinx_axienet.h      |  5 -----
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 12 ------------
 2 files changed, 17 deletions(-)

diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet.h b/drivers/net/ethernet/xilinx/xilinx_axienet.h
index c301dd2ee083..b9d2d7319220 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet.h
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h
@@ -527,8 +527,6 @@ struct skbuf_dma_descriptor {
  *		  supported, the maximum frame size would be 9k. Else it is
  *		  1522 bytes (assuming support for basic VLAN)
  * @rxmem:	Stores rx memory size for jumbo frame handling.
- * @csum_offload_on_tx_path:	Stores the checksum selection on TX side.
- * @csum_offload_on_rx_path:	Stores the checksum selection on RX side.
  * @coalesce_count_rx:	Store the irq coalesce on RX side.
  * @coalesce_usec_rx:	IRQ coalesce delay for RX
  * @coalesce_count_tx:	Store the irq coalesce on TX side.
@@ -606,9 +604,6 @@ struct axienet_local {
 	u32 max_frm_size;
 	u32 rxmem;
 
-	int csum_offload_on_tx_path;
-	int csum_offload_on_rx_path;
-
 	u32 coalesce_count_rx;
 	u32 coalesce_usec_rx;
 	u32 coalesce_count_tx;
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index fe6a0e2e463f..60ec430f3eb0 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -2631,38 +2631,26 @@ static int axienet_probe(struct platform_device *pdev)
 	if (!ret) {
 		switch (value) {
 		case 1:
-			lp->csum_offload_on_tx_path =
-				XAE_FEATURE_PARTIAL_TX_CSUM;
 			lp->features |= XAE_FEATURE_PARTIAL_TX_CSUM;
 			/* Can checksum TCP/UDP over IPv4. */
 			ndev->features |= NETIF_F_IP_CSUM;
 			break;
 		case 2:
-			lp->csum_offload_on_tx_path =
-				XAE_FEATURE_FULL_TX_CSUM;
 			lp->features |= XAE_FEATURE_FULL_TX_CSUM;
 			/* Can checksum TCP/UDP over IPv4. */
 			ndev->features |= NETIF_F_IP_CSUM;
 			break;
-		default:
-			lp->csum_offload_on_tx_path = XAE_NO_CSUM_OFFLOAD;
 		}
 	}
 	ret = of_property_read_u32(pdev->dev.of_node, "xlnx,rxcsum", &value);
 	if (!ret) {
 		switch (value) {
 		case 1:
-			lp->csum_offload_on_rx_path =
-				XAE_FEATURE_PARTIAL_RX_CSUM;
 			lp->features |= XAE_FEATURE_PARTIAL_RX_CSUM;
 			break;
 		case 2:
-			lp->csum_offload_on_rx_path =
-				XAE_FEATURE_FULL_RX_CSUM;
 			lp->features |= XAE_FEATURE_FULL_RX_CSUM;
 			break;
-		default:
-			lp->csum_offload_on_rx_path = XAE_NO_CSUM_OFFLOAD;
 		}
 	}
 	/* For supporting jumbo frames, the Axi Ethernet hardware must have
-- 
2.35.1.1320.gc452695387.dirty



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

* [PATCH net-next v2 2/4] net: xilinx: axienet: Enable NETIF_F_HW_CSUM for partial tx checksumming
  2024-09-09 16:10 [PATCH net-next v2 0/4] net: xilinx: axienet: Partial checksum offload improvements Sean Anderson
  2024-09-09 16:10 ` [PATCH net-next v2 1/4] net: xilinx: axienet: Remove unused checksum variables Sean Anderson
@ 2024-09-09 16:10 ` Sean Anderson
  2024-09-09 16:10 ` [PATCH net-next v2 3/4] net: xilinx: axienet: Set RXCSUM in features Sean Anderson
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Sean Anderson @ 2024-09-09 16:10 UTC (permalink / raw)
  To: Radhey Shyam Pandey, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev
  Cc: linux-arm-kernel, linux-kernel, Michal Simek, Sean Anderson,
	Simon Horman

Partial tx chechsumming is completely generic and does not depend on the
L3/L4 protocol. Signal this to the net subsystem by enabling the
more-generic offload feature (instead of restricting ourselves to
TCP/UDP over IPv4 checksumming only like is necessary with full
checksumming).

Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
Reviewed-by: Simon Horman <horms@kernel.org>
---

(no changes since v1)

 drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 60ec430f3eb0..74fade5a95c2 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -2632,8 +2632,8 @@ static int axienet_probe(struct platform_device *pdev)
 		switch (value) {
 		case 1:
 			lp->features |= XAE_FEATURE_PARTIAL_TX_CSUM;
-			/* Can checksum TCP/UDP over IPv4. */
-			ndev->features |= NETIF_F_IP_CSUM;
+			/* Can checksum any contiguous range */
+			ndev->features |= NETIF_F_HW_CSUM;
 			break;
 		case 2:
 			lp->features |= XAE_FEATURE_FULL_TX_CSUM;
-- 
2.35.1.1320.gc452695387.dirty



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

* [PATCH net-next v2 3/4] net: xilinx: axienet: Set RXCSUM in features
  2024-09-09 16:10 [PATCH net-next v2 0/4] net: xilinx: axienet: Partial checksum offload improvements Sean Anderson
  2024-09-09 16:10 ` [PATCH net-next v2 1/4] net: xilinx: axienet: Remove unused checksum variables Sean Anderson
  2024-09-09 16:10 ` [PATCH net-next v2 2/4] net: xilinx: axienet: Enable NETIF_F_HW_CSUM for partial tx checksumming Sean Anderson
@ 2024-09-09 16:10 ` Sean Anderson
  2024-09-09 16:10 ` [PATCH net-next v2 4/4] net: xilinx: axienet: Relax partial rx checksum checks Sean Anderson
  2024-09-11  2:10 ` [PATCH net-next v2 0/4] net: xilinx: axienet: Partial checksum offload improvements patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Sean Anderson @ 2024-09-09 16:10 UTC (permalink / raw)
  To: Radhey Shyam Pandey, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev
  Cc: linux-arm-kernel, linux-kernel, Michal Simek, Sean Anderson

When it is supported by hardware, we enable receive checksum offload
unconditionally. Update features to reflect this.

Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
---

Changes in v2:
- New

 drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 74fade5a95c2..2f7ab0922aed 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -2647,9 +2647,11 @@ static int axienet_probe(struct platform_device *pdev)
 		switch (value) {
 		case 1:
 			lp->features |= XAE_FEATURE_PARTIAL_RX_CSUM;
+			ndev->features |= NETIF_F_RXCSUM;
 			break;
 		case 2:
 			lp->features |= XAE_FEATURE_FULL_RX_CSUM;
+			ndev->features |= NETIF_F_RXCSUM;
 			break;
 		}
 	}
-- 
2.35.1.1320.gc452695387.dirty



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

* [PATCH net-next v2 4/4] net: xilinx: axienet: Relax partial rx checksum checks
  2024-09-09 16:10 [PATCH net-next v2 0/4] net: xilinx: axienet: Partial checksum offload improvements Sean Anderson
                   ` (2 preceding siblings ...)
  2024-09-09 16:10 ` [PATCH net-next v2 3/4] net: xilinx: axienet: Set RXCSUM in features Sean Anderson
@ 2024-09-09 16:10 ` Sean Anderson
  2024-09-11  2:10 ` [PATCH net-next v2 0/4] net: xilinx: axienet: Partial checksum offload improvements patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Sean Anderson @ 2024-09-09 16:10 UTC (permalink / raw)
  To: Radhey Shyam Pandey, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev
  Cc: linux-arm-kernel, linux-kernel, Michal Simek, Sean Anderson,
	Simon Horman

The partial rx checksum feature computes a checksum over the entire
packet, regardless of the L3 protocol. Remove the check for IPv4.
Additionally, testing with csum.py (from kselftests) shows no anomalies
with 64-byte packets, so we can remove that check as well.

Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
Reviewed-by: Simon Horman <horms@kernel.org>
---
Testing was performed with csum.py between two axienet netdevs. I also tested
with a macb netdev, but I saw some errors due to 007e4ba3ee13 ("net: macb:
initialize checksum when using checksum offloading"). I also tested
manually with a dpaa netdev, but I wasn't set up for ssh.

Changes in v2:
- Expand commit message with testing methodology

 drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 2f7ab0922aed..4185c5708742 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -1188,9 +1188,7 @@ static int axienet_rx_poll(struct napi_struct *napi, int budget)
 				    csumstatus == XAE_IP_UDP_CSUM_VALIDATED) {
 					skb->ip_summed = CHECKSUM_UNNECESSARY;
 				}
-			} else if ((lp->features & XAE_FEATURE_PARTIAL_RX_CSUM) != 0 &&
-				   skb->protocol == htons(ETH_P_IP) &&
-				   skb->len > 64) {
+			} else if (lp->features & XAE_FEATURE_PARTIAL_RX_CSUM) {
 				skb->csum = be32_to_cpu(cur_p->app3 & 0xFFFF);
 				skb->ip_summed = CHECKSUM_COMPLETE;
 			}
-- 
2.35.1.1320.gc452695387.dirty



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

* Re: [PATCH net-next v2 0/4] net: xilinx: axienet: Partial checksum offload improvements
  2024-09-09 16:10 [PATCH net-next v2 0/4] net: xilinx: axienet: Partial checksum offload improvements Sean Anderson
                   ` (3 preceding siblings ...)
  2024-09-09 16:10 ` [PATCH net-next v2 4/4] net: xilinx: axienet: Relax partial rx checksum checks Sean Anderson
@ 2024-09-11  2:10 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-09-11  2:10 UTC (permalink / raw)
  To: Sean Anderson
  Cc: radhey.shyam.pandey, davem, edumazet, kuba, pabeni, netdev,
	linux-arm-kernel, linux-kernel, michal.simek

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon,  9 Sep 2024 12:10:12 -0400 you wrote:
> Partial checksum offload is not always used when it could be. Enable it
> in more cases.
> 
> Changes in v2:
> - Set RXCSUM in features
> - Expand commit message with testing methodology
> 
> [...]

Here is the summary with links:
  - [net-next,v2,1/4] net: xilinx: axienet: Remove unused checksum variables
    https://git.kernel.org/netdev/net-next/c/b1e455cd864c
  - [net-next,v2,2/4] net: xilinx: axienet: Enable NETIF_F_HW_CSUM for partial tx checksumming
    https://git.kernel.org/netdev/net-next/c/dd28f4c0e81f
  - [net-next,v2,3/4] net: xilinx: axienet: Set RXCSUM in features
    https://git.kernel.org/netdev/net-next/c/06c069ff2f70
  - [net-next,v2,4/4] net: xilinx: axienet: Relax partial rx checksum checks
    https://git.kernel.org/netdev/net-next/c/736f0c7a8ec2

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:[~2024-09-11  2:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-09 16:10 [PATCH net-next v2 0/4] net: xilinx: axienet: Partial checksum offload improvements Sean Anderson
2024-09-09 16:10 ` [PATCH net-next v2 1/4] net: xilinx: axienet: Remove unused checksum variables Sean Anderson
2024-09-09 16:10 ` [PATCH net-next v2 2/4] net: xilinx: axienet: Enable NETIF_F_HW_CSUM for partial tx checksumming Sean Anderson
2024-09-09 16:10 ` [PATCH net-next v2 3/4] net: xilinx: axienet: Set RXCSUM in features Sean Anderson
2024-09-09 16:10 ` [PATCH net-next v2 4/4] net: xilinx: axienet: Relax partial rx checksum checks Sean Anderson
2024-09-11  2:10 ` [PATCH net-next v2 0/4] net: xilinx: axienet: Partial checksum offload improvements 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).