public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Helmut Buchsbaum <helmut.buchsbaum@gmail•com>
To: Nicolas Ferre <nicolas.ferre@atmel•com>,
	Michal Simek <michal.simek@xilinx•com>
Cc: netdev@vger•kernel.org,
	Cyrille Pitchen <cyrille.pitchen@atmel•com>,
	Helmut Buchsbaum <helmut.buchsbaum@gmail•com>
Subject: [PATCH 1/1] net: macb: disable HW checksum offload for Xilinx Zynq
Date: Fri, 19 Aug 2016 15:04:58 +0200	[thread overview]
Message-ID: <1471611898-3852-2-git-send-email-helmut.buchsbaum@gmail.com> (raw)
In-Reply-To: <1471611898-3852-1-git-send-email-helmut.buchsbaum@gmail.com>

When sending UDP packets with data payload size <= 2, Zynq's GEM
implementation for HW checksum offloading calculates wrong checksums.

Adding a MACB_CAPS_NO_CSUM_OFFLOAD capability and turning off HW checksum
offloading for Zynq solves it.

Signed-off-by: Helmut Buchsbaum <helmut.buchsbaum@gmail•com>
---
 drivers/net/ethernet/cadence/macb.c | 6 ++++--
 drivers/net/ethernet/cadence/macb.h | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 89c0cfa..26eba1a 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -2430,7 +2430,8 @@ static int macb_init(struct platform_device *pdev)
 	/* Set features */
 	dev->hw_features = NETIF_F_SG;
 	/* Checksum offload is only available on gem with packet buffer */
-	if (macb_is_gem(bp) && !(bp->caps & MACB_CAPS_FIFO_MODE))
+	if (macb_is_gem(bp) && !(bp->caps & MACB_CAPS_FIFO_MODE) &&
+	    !(bp->caps & MACB_CAPS_NO_CSUM_OFFLOAD))
 		dev->hw_features |= NETIF_F_HW_CSUM | NETIF_F_RXCSUM;
 	if (bp->caps & MACB_CAPS_SG_DISABLED)
 		dev->hw_features &= ~NETIF_F_SG;
@@ -2829,7 +2830,8 @@ static const struct macb_config zynqmp_config = {
 };
 
 static const struct macb_config zynq_config = {
-	.caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_NO_GIGABIT_HALF,
+	.caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_NO_GIGABIT_HALF |
+		MACB_CAPS_NO_CSUM_OFFLOAD,
 	.dma_burst_length = 16,
 	.clk_init = macb_clk_init,
 	.init = macb_init,
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index b6fcf10..79193db 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -404,6 +404,7 @@
 #define MACB_CAPS_NO_GIGABIT_HALF		0x00000008
 #define MACB_CAPS_USRIO_DISABLED		0x00000010
 #define MACB_CAPS_JUMBO				0x00000020
+#define MACB_CAPS_NO_CSUM_OFFLOAD		0x08000000
 #define MACB_CAPS_FIFO_MODE			0x10000000
 #define MACB_CAPS_GIGABIT_MODE_AVAILABLE	0x20000000
 #define MACB_CAPS_SG_DISABLED			0x40000000
-- 
2.1.4

  reply	other threads:[~2016-08-19 13:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-19 13:04 [PATCH 0/1] HW checksum offload problem on Xilinx Zynq GEM Helmut Buchsbaum
2016-08-19 13:04 ` Helmut Buchsbaum [this message]
2016-08-29 13:57   ` [PATCH v2 0/1] net: macb: initialize checksum when using checksum Helmut Buchsbaum
2016-08-29 13:57     ` [PATCH v2 1/1] net: macb: initialize checksum when using checksum offloading Helmut Buchsbaum
2016-09-01 17:03       ` David Miller
2016-09-04 16:09       ` [PATCH v3] " Helmut Buchsbaum
2016-09-06 20:43         ` David Miller
2016-08-19 19:28 ` [PATCH 0/1] HW checksum offload problem on Xilinx Zynq GEM David Miller
2016-08-19 20:00   ` Tom Herbert
2016-08-23  5:39     ` Helmut Buchsbaum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1471611898-3852-2-git-send-email-helmut.buchsbaum@gmail.com \
    --to=helmut.buchsbaum@gmail$(echo .)com \
    --cc=cyrille.pitchen@atmel$(echo .)com \
    --cc=michal.simek@xilinx$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=nicolas.ferre@atmel$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox