From 9db78810c963432f0c312a139cb833a55034a689 Mon Sep 17 00:00:00 2001 From: Nisha Menon Date: Wed, 11 Dec 2019 16:09:04 -0800 Subject: [PATCH] qcacld-3.0: Update Wifi netdevs for IPA exception path NAPI Starting Kernel 4.19 IPA LAN RX supports NAPI polling mechanism. Netdevs that hook into IPA need to call netif_receive_skb() or similar to deliver the packet to network stack instead of using netif_rx_ni(). IPA driver exports ipa_get_lan_rx_napi(void) API for this purpose. If this API call returns true use netif_receive_skb() or fallback on legacy api. Add the changes under a feature flag IPA_LAN_RX_NAPI_SUPPORT. The flag is enabled only for linux kernel version 4.19 and above. Change-Id: I3bf200c993461e45da0d07697678c634760e9a89 CRs-Fixed: 2560360 --- core/hdd/src/wlan_hdd_ipa.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/core/hdd/src/wlan_hdd_ipa.c b/core/hdd/src/wlan_hdd_ipa.c index c379525da9..bb6722eb23 100644 --- a/core/hdd/src/wlan_hdd_ipa.c +++ b/core/hdd/src/wlan_hdd_ipa.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -355,6 +355,28 @@ static void hdd_ipa_set_wake_up_idle(bool wake_up_idle) } #endif +/** + * hdd_ipa_send_to_nw_stack() - Check if IPA supports NAPI + * polling during RX + * @skb : data buffer sent to network stack + * + * If IPA LAN RX supports NAPI polling mechanism use + * netif_receive_skb instead of netif_rx_ni to forward the skb + * to network stack. + * + * Return: Return value from netif_rx_ni/netif_receive_skb + */ +static int hdd_ipa_send_to_nw_stack(qdf_nbuf_t skb) +{ + int result; + + if (qdf_ipa_get_lan_rx_napi()) + result = netif_receive_skb(skb); + else + result = netif_rx_ni(skb); + return result; +} + #ifdef QCA_CONFIG_SMP /** @@ -367,13 +389,16 @@ static void hdd_ipa_set_wake_up_idle(bool wake_up_idle) * In this manner, UDP/TCP packets are sent in an aggregated way to the stack. * For IP/ICMP packets, simply call netif_rx_ni. * + * Check if IPA supports NAPI polling then use netif_receive_skb + * instead of 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) { int ret; - ret = netif_rx_ni(skb); + ret = hdd_ipa_send_to_nw_stack(skb); return ret; } #else @@ -387,13 +412,13 @@ static int hdd_ipa_aggregated_rx_ind(qdf_nbuf_t skb) ip_h = (struct iphdr *)(skb->data); if ((skb->protocol == htons(ETH_P_IP)) && (ip_h->protocol == IPPROTO_ICMP)) { - result = netif_rx_ni(skb); + result = hdd_ipa_send_to_nw_stack(skb); } else { /* Call netif_rx_ni for every IPA_WLAN_RX_SOFTIRQ_THRESH packets * to avoid excessive softirq's. */ if (atomic_dec_and_test(&softirq_mitigation_cntr)) { - result = netif_rx_ni(skb); + result = hdd_ipa_send_to_nw_stack(skb); atomic_set(&softirq_mitigation_cntr, IPA_WLAN_RX_SOFTIRQ_THRESH); } else {