This is an automated email from the ASF dual-hosted git repository.

kasjer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit b12079629fd78d9c5ea596e00bec3a989a23db07
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Tue Oct 13 12:35:48 2026 +0200

    drivers/stm32_eth: Disable lwIP checksums only for Ethernet interface
    
    stm32_eth disabled lwIP checksum generation and checking for the whole
    application with app.cflags because the controller handles checksums
    in hardware.  Any other interface in the same build (e.g. USB network)
    then sent packets with zero checksums.
    
    Use per interface checksum control instead, so only the Ethernet
    interface skips software checksums.
    
    Assisted-by: Claude:claude-opus-5-5
    Signed-off-by: Jerzy Kasenberg <[email protected]>
---
 hw/drivers/lwip/stm32_eth/pkg.yml         | 12 ------------
 hw/drivers/lwip/stm32_eth/src/stm32_eth.c |  5 +++++
 2 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/hw/drivers/lwip/stm32_eth/pkg.yml 
b/hw/drivers/lwip/stm32_eth/pkg.yml
index 55d3241de..4f448b636 100644
--- a/hw/drivers/lwip/stm32_eth/pkg.yml
+++ b/hw/drivers/lwip/stm32_eth/pkg.yml
@@ -38,18 +38,6 @@ pkg.deps.MCU_STM32F4:
 pkg.deps.MCU_STM32F7:
     - "@apache-mynewt-core/hw/mcu/stm/stm32f7xx"
 
-app.cflags:
-    - -DCHECKSUM_GEN_IP=0
-    - -DCHECKSUM_GEN_UDP=0
-    - -DCHECKSUM_GEN_TCP=0
-    - -DCHECKSUM_GEN_ICMP=0
-    - -DCHECKSUM_GEN_ICMP6=0
-    - -DCHECKSUM_CHECK_IP=0
-    - -DCHECKSUM_CHECK_UDP=0
-    - -DCHECKSUM_CHECK_TCP=0
-    - -DCHECKSUM_CHECK_ICMP=0
-    - -DCHECKSUM_CHECK_ICMP6=0
-
 pkg.whole_archive: true
 
 pkg.req_apis:
diff --git a/hw/drivers/lwip/stm32_eth/src/stm32_eth.c 
b/hw/drivers/lwip/stm32_eth/src/stm32_eth.c
index a32fabdd4..5e27a07c3 100644
--- a/hw/drivers/lwip/stm32_eth/src/stm32_eth.c
+++ b/hw/drivers/lwip/stm32_eth/src/stm32_eth.c
@@ -556,6 +556,11 @@ stm32_lwip_init(struct netif *nif)
     nif->mtu = 1500;
     nif->hwaddr_len = ETHARP_HWADDR_LEN;
     nif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP;
+    /*
+     * Controller inserts and verifies IP/UDP/TCP/ICMP checksums in hardware,
+     * lwIP does not need to compute them for this interface.
+     */
+    NETIF_SET_CHECKSUM_CTRL(nif, NETIF_CHECKSUM_DISABLE_ALL);
 
 #if LWIP_IGMP
     nif->flags |= NETIF_FLAG_IGMP;

Reply via email to