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.
This commit is contained in:
robert-hh 2021-11-09 13:58:45 +01:00
parent bbe25f4704
commit ea09dccfea
2 changed files with 2 additions and 13 deletions

View File

@ -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.miiDuplex = (enet_mii_duplex_t)duplex;
enet_config.miiMode = kENET_RmiiMode; enet_config.miiMode = kENET_RmiiMode;
// Enable checksum generation by the ENET controller // Enable checksum generation by the ENET controller
// Note: Disabled due to problems with the checksum on ICMP requests enet_config.txAccelerConfig = kENET_TxAccelIpCheckEnabled | kENET_TxAccelProtoCheckEnabled;
// 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;
// Set interrupt // Set interrupt
enet_config.interrupt |= ENET_TX_INTERRUPT | ENET_RX_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_TCP
| NETIF_CHECKSUM_CHECK_ICMP | NETIF_CHECKSUM_CHECK_ICMP
| NETIF_CHECKSUM_CHECK_ICMP6 | 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; return ERR_OK;
} }

View File

@ -13,11 +13,8 @@
#define MEM_ALIGNMENT 4 #define MEM_ALIGNMENT 4
#define LWIP_CHKSUM_ALGORITHM 3 #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 // The checksum flags are set in eth.c
#define LWIP_CHECKSUM_CTRL_PER_NETIF 0 #define LWIP_CHECKSUM_CTRL_PER_NETIF 1
#define LWIP_CHECKSUM_ON_COPY 0
#define LWIP_ARP 1 #define LWIP_ARP 1
#define LWIP_ETHERNET 1 #define LWIP_ETHERNET 1