From cabf5e79d8203bb596f69a6a5e302b72ba48d476 Mon Sep 17 00:00:00 2001 From: Mohit Khanna Date: Tue, 24 Jul 2018 13:28:43 -0700 Subject: [PATCH] qcacld-3.0: Fixes for IPA enablement for lithium/Hasting Following changes were made - - Replace #ifdef CONFIG_LITHIUM with QCA_WIFI_QCA6290 and QCA_WIFI_QCA6390 flags. CONFIG_LITHIUM is not defined to be used within the code, the individual chip specific flags are defined, hence use those. - Pass IPA enable/disable ini configuration to DP layer Change-Id: If0bfdaf408b06a922923e998c0c6ad2157e2c080 CRs-Fixed: 2328711 --- components/ipa/core/inc/wlan_ipa_priv.h | 4 ++- components/ipa/core/src/wlan_ipa_core.c | 39 ++++++++++++++++++------- core/hdd/src/wlan_hdd_ipa.c | 24 +++++++++++---- core/hdd/src/wlan_hdd_main.c | 1 + 4 files changed, 51 insertions(+), 17 deletions(-) diff --git a/components/ipa/core/inc/wlan_ipa_priv.h b/components/ipa/core/inc/wlan_ipa_priv.h index d17b27201429..8497aadeb5a0 100644 --- a/components/ipa/core/inc/wlan_ipa_priv.h +++ b/components/ipa/core/inc/wlan_ipa_priv.h @@ -170,7 +170,9 @@ struct wlan_ipa_tx_hdr { * @reserved1: Reserved not used * @reserved2: Reserved not used */ -#if defined (QCA_WIFI_3_0) || defined (CONFIG_LITHIUM) +#if defined(QCA_WIFI_3_0) || \ + defined(QCA_WIFI_QCA6290) || \ + defined(QCA_WIFI_QCA6390) struct frag_header { uint16_t length; uint32_t reserved1; diff --git a/components/ipa/core/src/wlan_ipa_core.c b/components/ipa/core/src/wlan_ipa_core.c index 3b45420b46c5..cc39fe7994ad 100644 --- a/components/ipa/core/src/wlan_ipa_core.c +++ b/components/ipa/core/src/wlan_ipa_core.c @@ -274,11 +274,10 @@ static void wlan_ipa_send_pkt_to_tl( } #ifdef CONFIG_IPA_WDI_UNIFIED_API - /* * TODO: Get WDI version through FW capabilities */ -#ifdef CONFIG_LITHIUM +#if defined(QCA_WIFI_QCA6290) || defined(QCA_WIFI_QCA6390) static inline void wlan_ipa_wdi_get_wdi_version(struct wlan_ipa_priv *ipa_ctx) { ipa_ctx->wdi_version = IPA_WDI_3; @@ -760,7 +759,7 @@ static void __wlan_ipa_w2i_cb(void *priv, qdf_ipa_dp_evt_type_t evt, struct wlan_ipa_priv *ipa_ctx = NULL; qdf_nbuf_t skb; uint8_t iface_id; - uint8_t session_id; + uint8_t session_id = 0xff; struct wlan_ipa_iface_context *iface_context; uint8_t fw_desc; @@ -777,7 +776,6 @@ static void __wlan_ipa_w2i_cb(void *priv, qdf_ipa_dp_evt_type_t evt, switch (evt) { case IPA_RECEIVE: skb = (qdf_nbuf_t) data; - if (wlan_ipa_uc_is_enabled(ipa_ctx->config)) { session_id = (uint8_t)skb->cb[0]; iface_id = ipa_ctx->vdev_to_iface[session_id]; @@ -785,7 +783,9 @@ static void __wlan_ipa_w2i_cb(void *priv, qdf_ipa_dp_evt_type_t evt, iface_id = WLAN_IPA_GET_IFACE_ID(skb->data); } if (iface_id >= WLAN_IPA_MAX_IFACE) { - ipa_err_rl("Invalid iface_id: %u", iface_id); + ipa_err_rl("Invalid iface_id: %u,session id: %x %x %x %x. Dropped!", + iface_id, session_id, (uint8_t)skb->cb[1], + (uint8_t)skb->cb[2], (uint8_t)skb->cb[3]); ipa_ctx->ipa_rx_internal_drop_count++; dev_kfree_skb_any(skb); return; @@ -806,7 +806,6 @@ static void __wlan_ipa_w2i_cb(void *priv, qdf_ipa_dp_evt_type_t evt, } else { qdf_nbuf_pull_head(skb, WLAN_IPA_WLAN_CLD_HDR_LEN); } - iface_context->stats.num_rx_ipa_excep++; /* Disable to forward Intra-BSS Rx packets when @@ -1230,8 +1229,11 @@ static QDF_STATUS wlan_ipa_setup_iface(struct wlan_ipa_priv *ipa_ctx, if (device_mode == QDF_SAP_MODE) { for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) { iface_context = &(ipa_ctx->iface_context[i]); - if (iface_context->dev == net_dev) + if (iface_context->dev == net_dev) { + ipa_debug("found iface %u device_mode %u", + i, device_mode); return QDF_STATUS_SUCCESS; + } } } @@ -1435,8 +1437,8 @@ static QDF_STATUS __wlan_ipa_wlan_evt(qdf_netdev_t net_dev, uint8_t device_mode, QDF_STATUS status; uint8_t sta_session_id = WLAN_IPA_MAX_SESSION; - ipa_debug("%s: EVT: %d, MAC: %pM, sta_id: %d", - net_dev->name, type, mac_addr, sta_id); + ipa_debug("%s: EVT: %d, MAC: %pM, sta_id: %d session_id: %u", + net_dev->name, type, mac_addr, sta_id, session_id); if (type >= QDF_IPA_WLAN_EVENT_MAX) return QDF_STATUS_E_INVAL; @@ -1560,6 +1562,7 @@ static QDF_STATUS __wlan_ipa_wlan_evt(qdf_netdev_t net_dev, uint8_t device_mode, status = wlan_ipa_setup_iface(ipa_ctx, net_dev, device_mode, sta_id, session_id); if (status != QDF_STATUS_SUCCESS) { + ipa_err("wlan_ipa_setup_iface failed %u", status); qdf_mutex_release(&ipa_ctx->event_lock); goto end; } @@ -1581,7 +1584,10 @@ static QDF_STATUS __wlan_ipa_wlan_evt(qdf_netdev_t net_dev, uint8_t device_mode, qdf_mutex_release(&ipa_ctx->event_lock); - ipa_debug("sta_connected=%d", ipa_ctx->sta_connected); + ipa_debug("sta_connected=%d vdev_to_iface[%u] %u", + ipa_ctx->sta_connected, + session_id, + ipa_ctx->vdev_to_iface[session_id]); break; case QDF_IPA_AP_CONNECT: @@ -1617,6 +1623,9 @@ static QDF_STATUS __wlan_ipa_wlan_evt(qdf_netdev_t net_dev, uint8_t device_mode, ipa_ctx->vdev_to_iface[session_id] = wlan_ipa_get_ifaceid(ipa_ctx, session_id); + ipa_debug("vdev_to_iface[%u]=%u", + session_id, + ipa_ctx->vdev_to_iface[session_id]); qdf_mutex_release(&ipa_ctx->event_lock); break; @@ -1663,6 +1672,9 @@ static QDF_STATUS __wlan_ipa_wlan_evt(qdf_netdev_t net_dev, uint8_t device_mode, qdf_mutex_acquire(&ipa_ctx->event_lock); ipa_ctx->vdev_to_iface[session_id] = WLAN_IPA_MAX_SESSION; + ipa_debug("vdev_to_iface[%u]=%u", + session_id, + ipa_ctx->vdev_to_iface[session_id]); } for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) { @@ -1712,6 +1724,9 @@ static QDF_STATUS __wlan_ipa_wlan_evt(qdf_netdev_t net_dev, uint8_t device_mode, qdf_mutex_acquire(&ipa_ctx->event_lock); ipa_ctx->vdev_to_iface[session_id] = WLAN_IPA_MAX_SESSION; + ipa_debug("vdev_to_iface[%u]=%u", + session_id, + ipa_ctx->vdev_to_iface[session_id]); } for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) { @@ -1772,7 +1787,9 @@ static QDF_STATUS __wlan_ipa_wlan_evt(qdf_netdev_t net_dev, uint8_t device_mode, } return status; - } + } else + ipa_debug("%s: handle 1st con success", + net_dev->name); } ipa_ctx->sap_num_connected_sta++; diff --git a/core/hdd/src/wlan_hdd_ipa.c b/core/hdd/src/wlan_hdd_ipa.c index dabd424f0eaa..6eec59a0948b 100644 --- a/core/hdd/src/wlan_hdd_ipa.c +++ b/core/hdd/src/wlan_hdd_ipa.c @@ -350,9 +350,25 @@ static void hdd_ipa_set_wake_up_idle(bool wake_up_idle) #endif #ifdef QCA_CONFIG_SMP + +/** + * hdd_ipa_aggregated_rx_ind() - Submit aggregated packets to the stack + * @skb: skb to be submitted to the stack + * + * For CONFIG_SMP systems, simply call netif_rx_ni. + * For non CONFIG_SMP systems call netif_rx till + * IPA_WLAN_RX_SOFTIRQ_THRESH. When threshold is reached call netif_rx_ni. + * In this manner, UDP/TCP packets are sent in an aggregated way to the stack. + * For IP/ICMP packets, simply call netif_rx_ni. + * + * Return: return value from the netif_rx_ni/netif_rx api. + */ static int hdd_ipa_aggregated_rx_ind(qdf_nbuf_t skb) { - return netif_rx_ni(skb); + int ret; + + ret = netif_rx_ni(skb); + return ret; } #else static int hdd_ipa_aggregated_rx_ind(qdf_nbuf_t skb) @@ -432,11 +448,9 @@ void hdd_ipa_send_skb_to_network(qdf_nbuf_t skb, qdf_netdev_t dev) * Update STA RX exception packet stats. * For SAP as part of IPA HW stats are updated. */ - if (adapter->device_mode == QDF_STA_MODE) { - ++adapter->stats.rx_packets; - adapter->stats.rx_bytes += skb->len; - } + ++adapter->stats.rx_packets; + adapter->stats.rx_bytes += skb->len; result = hdd_ipa_aggregated_rx_ind(skb); if (result == NET_RX_SUCCESS) ++adapter->hdd_stats.tx_rx_stats.rx_delivered[cpu_index]; diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 0683db6ea76d..a1b5c7ac7e3c 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -13624,6 +13624,7 @@ static int hdd_update_dp_config(struct hdd_context *hdd_ctx) params.napi_enable = hdd_ctx->napi_enable; params.tcp_udp_checksumoffload = hdd_ctx->config->enable_ip_tcp_udp_checksum_offload; + params.ipa_enable = ucfg_ipa_is_enabled(); status = cdp_update_config_parameters( cds_get_context(QDF_MODULE_ID_SOC),