Message ID | 1471611898-3852-2-git-send-email-helmut.buchsbaum@gmail.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
When working on upgrading the v3.x kernels of our embedded devices to more recent 4.x kernels we noticed some of our proprietary networking stuff is broken. Further investigations brought up an issue with small UDP packets (data payload <= 2), which contained wrong UDP header checksums. We tracked this down to commit 85ff3d87bf2ef1fadcde8553628c60f79806fdb4 net/macb: add TX checksum offload feature. It turns out that (at least) Zynq's GEM needs the checksum field set to 0 to correctly calculate the checksum. Changes since v1: - dropped disabling HW checksum offload for Zynq - initialize checksum similar to net/ethernet/freescale/fec_main.c Helmut Buchsbaum (1): net: macb: initialize checksum when using checksum offloading drivers/net/ethernet/cadence/macb.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
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
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(-)