From ea09dccfea0503534688dd790c40d33c5399e7d8 Mon Sep 17 00:00:00 2001 From: robert-hh Date: Tue, 9 Nov 2021 13:58:45 +0100 Subject: [PATCH] mimxrt: Re-Enable eth checksum creation by HW. The initial problem with a wrong ICMP checksum was caused by the test code setting a checksum and the HW taking that probably as the start value and ending up with 0xffff. With a checksum field of 0 set by the test code the HW creates the proper checksum. --- ports/mimxrt/eth.c | 10 +--------- ports/mimxrt/lwip_inc/lwipopts.h | 5 +---- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/ports/mimxrt/eth.c b/ports/mimxrt/eth.c index d14c713961..9c036cd056 100644 --- a/ports/mimxrt/eth.c +++ b/ports/mimxrt/eth.c @@ -285,10 +285,7 @@ void eth_init(eth_t *self, int mac_idx, const phy_operations_t *phy_ops, int phy enet_config.miiDuplex = (enet_mii_duplex_t)duplex; enet_config.miiMode = kENET_RmiiMode; // Enable checksum generation by the ENET controller - // Note: Disabled due to problems with the checksum on ICMP requests - // Maybe caused by LWIP inserting 0xffff instead of 0x0000 - // Keep the code for now until it may be fixed. - // enet_config.txAccelerConfig = kENET_TxAccelIpCheckEnabled | kENET_TxAccelProtoCheckEnabled; + enet_config.txAccelerConfig = kENET_TxAccelIpCheckEnabled | kENET_TxAccelProtoCheckEnabled; // Set interrupt enet_config.interrupt |= ENET_TX_INTERRUPT | ENET_RX_INTERRUPT; @@ -351,11 +348,6 @@ STATIC err_t eth_netif_init(struct netif *netif) { | NETIF_CHECKSUM_CHECK_TCP | NETIF_CHECKSUM_CHECK_ICMP | NETIF_CHECKSUM_CHECK_ICMP6 - | NETIF_CHECKSUM_GEN_IP - | NETIF_CHECKSUM_GEN_UDP - | NETIF_CHECKSUM_GEN_TCP - | NETIF_CHECKSUM_GEN_ICMP - | NETIF_CHECKSUM_GEN_ICMP6 ); return ERR_OK; } diff --git a/ports/mimxrt/lwip_inc/lwipopts.h b/ports/mimxrt/lwip_inc/lwipopts.h index 42dc9fc5db..2401c05f95 100644 --- a/ports/mimxrt/lwip_inc/lwipopts.h +++ b/ports/mimxrt/lwip_inc/lwipopts.h @@ -13,11 +13,8 @@ #define MEM_ALIGNMENT 4 #define LWIP_CHKSUM_ALGORITHM 3 -// Chksum generaration by HW fails for ICMP -// Maybe caused by LWIP inserting ffff instead of 0000 // The checksum flags are set in eth.c -#define LWIP_CHECKSUM_CTRL_PER_NETIF 0 -#define LWIP_CHECKSUM_ON_COPY 0 +#define LWIP_CHECKSUM_CTRL_PER_NETIF 1 #define LWIP_ARP 1 #define LWIP_ETHERNET 1