From 9705fc06b481a95c4fdc426a03e07b77f20ed943 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Tue, 5 Nov 2024 02:52:17 +0530 Subject: [PATCH] [nrf fromlist] drivers: nrfwifi: Fix CSUM support With introduction of Raw modes, nRF70 driver now advertises get_c onfig OP, but doesn't implement all types. This causes problems two-fold with checksum calculations: 1. The "config" isn't uninitialized, so, every call returns differnet values. So, for UDP header checksum would be done and pkt->chksumdone would be set. But for IPv4 header checksum might be skipped. 2. Even if we initialize to zero, then network stack gets all zeros and calculates checksum by itself rendering offload moot. There is another problem in #1, as there is only single flag for pkt for all checksum, nRF70 driver sees this and tells UMAC to skip checksum for the entire packet. The design isn't coherent, and should be converted to communicate per-type checksum status (some are filled by network stack and some HW). But as nRF70 support all checksum offloads, advertise all types for both RX and TX. Upstream PR #: 80882 Signed-off-by: Chaitanya Tata --- drivers/wifi/nrfwifi/src/net_if.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/wifi/nrfwifi/src/net_if.c b/drivers/wifi/nrfwifi/src/net_if.c index 1a8b0c7361af4c..19b232b6fe347a 100644 --- a/drivers/wifi/nrfwifi/src/net_if.c +++ b/drivers/wifi/nrfwifi/src/net_if.c @@ -980,10 +980,23 @@ int nrf_wifi_if_get_config_zep(const struct device *dev, goto unlock; } + memset(config, 0, sizeof(struct ethernet_config)); + if (type == ETHERNET_CONFIG_TYPE_TXINJECTION_MODE) { config->txinjection_mode = def_dev_ctx->vif_ctx[vif_ctx_zep->vif_idx]->txinjection_mode; } +#ifdef CONFIG_NRF70_TCP_IP_CHECKSUM_OFFLOAD + if (type == ETHERNET_CONFIG_TYPE_TX_CHECKSUM_SUPPORT || + type == ETHERNET_CONFIG_TYPE_RX_CHECKSUM_SUPPORT) { + config->chksum_support = ETHERNET_CHECKSUM_SUPPORT_IPV4_HEADER | + ETHERNET_CHECKSUM_SUPPORT_IPV4_ICMP | + ETHERNET_CHECKSUM_SUPPORT_IPV6_HEADER | + ETHERNET_CHECKSUM_SUPPORT_IPV6_ICMP | + ETHERNET_CHECKSUM_SUPPORT_TCP | + ETHERNET_CHECKSUM_SUPPORT_UDP; + } +#endif ret = 0; unlock: k_mutex_unlock(&vif_ctx_zep->vif_lock);