From 9cdb8bae50aca80b593d0f53be5b8efedfc91324 Mon Sep 17 00:00:00 2001
From: Tamizh Chelvam <tamizhr@codeaurora.org>
Date: Sun, 7 Mar 2021 22:49:26 +0530
Subject: [PATCH] backport: Compile fix

Adding these changes to fix compilation issue due to
package upgrade

Signed-off-by: Tamizh Chelvam <tamizhr@codeaurora.org>
Signed-off-by: Gautham Kumar Senthilkumaran <quic_gauthamk@quicinc.com>
---
 include/linux/backport-refcount.h        |  4 +--
 include/net/fq.h                         | 10 +++++-
 net/mac80211/cfg.c                       |  4 +--
 net/mac80211/ieee80211_i.h               |  4 ++-
 net/mac80211/iface.c                     |  2 --
 net/mac80211/rx.c                        | 23 +++++++++-----
 net/mac80211/tx.c                        | 54 ++++++++++++++++++++++----------
 7 files changed, 40 insertions(+), 23 deletions(-)

--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -218,6 +218,7 @@ enum ieee80211_rx_flags {
 };
 
 struct ieee80211_rx_data {
+	struct napi_struct *napi;
 	struct list_head *list;
 	struct sk_buff *skb;
 	struct ieee80211_local *local;
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -4702,19 +4702,21 @@ static void ieee80211_8023_xmit(struct i
 
 	ieee80211_aggr_check(sdata, sta, skb);
 
-	tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
-	tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]);
-	if (tid_tx) {
-		if (!test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) {
-			/* fall back to non-offload slow path */
-			__ieee80211_subif_start_xmit(skb, dev, 0,
-						     IEEE80211_TX_CTRL_MLO_LINK_UNSPEC,
-						     NULL);
-			return;
-		}
+	if (!ieee80211_hw_check(&local->hw, SUPPORTS_NSS_OFFLOAD)) {
+		tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
+		tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]);
+		if (tid_tx) {
+			if (!test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) {
+				/* fall back to non-offload slow path */
+				__ieee80211_subif_start_xmit(skb, dev, 0,
+						     	IEEE80211_TX_CTRL_MLO_LINK_UNSPEC,
+						     	NULL);
+				return;
+			}
 
-		if (tid_tx->timeout)
-			tid_tx->last_tx = jiffies;
+			if (tid_tx->timeout)
+				tid_tx->last_tx = jiffies;
+		}
 	}
 
 	skb = ieee80211_tx_skb_fixup(skb, ieee80211_sdata_netdev_features(sdata));
@@ -4774,7 +4776,7 @@ netdev_tx_t ieee80211_subif_start_xmit_8
 {
 	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 	struct ethhdr *ehdr = (struct ethhdr *)skb->data;
-	struct ieee80211_key *key;
+	struct ieee80211_key *key = NULL;
 	struct sta_info *sta;
 
 #ifdef CPTCFG_MAC80211_NSS_SUPPORT
@@ -4792,9 +4794,13 @@ netdev_tx_t ieee80211_subif_start_xmit_8
 		goto out;
 	}
 
-	if (unlikely(IS_ERR_OR_NULL(sta) || !sta->uploaded ||
-	    !test_sta_flag(sta, WLAN_STA_AUTHORIZED) ||
-	    sdata->control_port_protocol == ehdr->h_proto))
+	if (ieee80211_hw_check(&sdata->local->hw, SUPPORTS_NSS_OFFLOAD)) {
+		if (unlikely(IS_ERR_OR_NULL(sta) || !sta->uploaded))
+			sta = NULL;
+		goto tx_offload;
+	} else if (unlikely(IS_ERR_OR_NULL(sta) || !sta->uploaded ||
+		   !test_sta_flag(sta, WLAN_STA_AUTHORIZED) ||
+		   sdata->control_port_protocol == ehdr->h_proto))
 		goto skip_offload;
 
 	key = rcu_dereference(sta->ptk[sta->ptk_idx]);
@@ -4805,6 +4811,7 @@ netdev_tx_t ieee80211_subif_start_xmit_8
 		goto skip_offload;
 
 	sk_pacing_shift_update(skb->sk, sdata->local->hw.tx_sk_pacing_shift);
+tx_offload:
 	ieee80211_8023_xmit(sdata, dev, sta, key, skb);
 	goto out;
 
@@ -6329,13 +6336,7 @@ int ieee80211_tx_control_port(struct wip
 
 start_xmit:
 	local_bh_disable();
-
-	/* added hardware encap check for ethernet mode */
-	if (sdata->vif.offload_flags & IEEE80211_OFFLOAD_ENCAP_ENABLED)
-		ieee80211_subif_start_xmit_8023(skb, skb->dev);
-	else
-		__ieee80211_subif_start_xmit(skb, skb->dev, flags, ctrl_flags, cookie);
-
+	__ieee80211_subif_start_xmit(skb, skb->dev, flags, ctrl_flags, cookie);
 	local_bh_enable();
 
 	return 0;
