From 670edc32cf1ae09514f62cdc322cd59d7d7cca02 Mon Sep 17 00:00:00 2001 From: Amit Mehta Date: Mon, 17 Jan 2022 05:43:40 -0800 Subject: [PATCH] qcacld-3.0: Check if netdev feature need to update Currently based on the INI option we are scheduling work to dynamically disable/enable checksum offload and TSO. But in the case of roaming from latency critical connection to latency critical connection or non-latency critical connection to non-latency critical connection, we do not need to schedule work. So adding a condition to check : For non-latency critical connection: If checksum offload and TSO are not disabled then schedule work. For latency critical: If checksum offload and TSO are not enabled then schedule work. Change-Id: I75a51707774c3428971dfe5cc0b0d3cdc2a17ac8 CRs-Fixed: 3054183 --- core/hdd/inc/wlan_hdd_main.h | 2 ++ core/hdd/src/wlan_hdd_assoc.c | 27 ++++++++++++++++++++++++++- core/hdd/src/wlan_hdd_main.c | 12 ++++++++---- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 723101dcfb14..77e006598cff 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -1530,6 +1530,8 @@ struct hdd_adapter { uint8_t gro_disallowed[DP_MAX_RX_THREADS]; uint8_t gro_flushed[DP_MAX_RX_THREADS]; bool handle_feature_update; + /* Indicate if TSO and checksum offload features are enabled or not */ + bool tso_csum_feature_enabled; bool runtime_disable_rx_thread; ol_txrx_rx_fp rx_stack; diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index e410040400d9..c6c89f702790 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -2895,6 +2895,30 @@ void hdd_clear_fils_connection_info(struct hdd_adapter *adapter) } #endif +/** + * hdd_netif_features_update_required() - Check if feature update + * is required + * @adapter: pointer to the adapter structure + * Returns: true if the connection is legacy and TSO and Checksum offload + * enabled or if the connection is not latency and TSO and Checksum + * offload are not enabled, false otherwise + */ +static bool hdd_netif_features_update_required(struct hdd_adapter *adapter) +{ + bool is_legacy_connection = hdd_is_legacy_connection(adapter); + + hdd_debug("Legacy Connection: %d, TSO_CSUM Feature Enabled:%d", + is_legacy_connection, adapter->tso_csum_feature_enabled); + + if (adapter->tso_csum_feature_enabled && is_legacy_connection) + return true; + + if (!adapter->tso_csum_feature_enabled && !is_legacy_connection) + return true; + + return false; +} + /** * hdd_netif_queue_enable() - Enable the network queue for a * particular adapter. @@ -2912,7 +2936,8 @@ static inline void hdd_netif_queue_enable(struct hdd_adapter *adapter) ol_txrx_soc_handle soc = cds_get_context(QDF_MODULE_ID_SOC); struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); - if (cdp_cfg_get(soc, cfg_dp_disable_legacy_mode_csum_offload)) { + if (cdp_cfg_get(soc, cfg_dp_disable_legacy_mode_csum_offload) && + hdd_netif_features_update_required(adapter)) { hdd_adapter_ops_record_event(hdd_ctx, WLAN_HDD_ADAPTER_OPS_WORK_POST, adapter->vdev_id); diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 8717b9cd3554..3231742196af 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -5084,13 +5084,15 @@ static netdev_features_t __hdd_fix_features(struct net_device *net_dev, } feature_tso_csum = hdd_get_tso_csum_feature_flags(); - if (hdd_is_legacy_connection(adapter)) + if (hdd_is_legacy_connection(adapter)) { /* Disable checksum and TSO */ feature_change_req &= ~feature_tso_csum; - else + adapter->tso_csum_feature_enabled = 0; + } else { /* Enable checksum and TSO */ feature_change_req |= feature_tso_csum; - + adapter->tso_csum_feature_enabled = 1; + } hdd_debug("vdev mode %d current features 0x%llx, requesting feature change 0x%llx", adapter->device_mode, net_dev->features, feature_change_req); @@ -7731,9 +7733,11 @@ void hdd_set_netdev_flags(struct hdd_adapter *adapter) adapter->dev->features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); - if (cdp_cfg_get(soc, cfg_dp_tso_enable) && enable_csum) + if (cdp_cfg_get(soc, cfg_dp_tso_enable) && enable_csum) { adapter->dev->features |= (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_SG); + adapter->tso_csum_feature_enabled = 1; + } adapter->dev->features |= NETIF_F_RXCSUM; temp = (uint64_t)adapter->dev->features;