From c3389f87ea09dea804cda2483922e03ad3eb6c79 Mon Sep 17 00:00:00 2001
From: P Praneesh <ppranees@codeaurora.org>
Date: Thu, 18 Jun 2020 00:07:15 +0530
Subject: [PATCH] mac80211: fix xmit callback when hwencap enable in sta

Since transmit control port uses same callback for both
(ieee80211_subif_start_xmit) ethernet mode and native
wifi mode, which cause regression in ethernet mode
when we use DUT as a STA with encryption(psk2+ccmp).

Added hardware encap check to filter out ethernet mode
packets to follow ieee80211_subif_start_xmit_8023 callback.

Signed-off-by: P Praneesh <ppranees@codeaurora.org>
---
 net/mac80211/tx.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -5485,7 +5485,13 @@ int ieee80211_tx_control_port(struct wip
 	mutex_lock(&local->mtx);
 
 	local_bh_disable();
-	__ieee80211_subif_start_xmit(skb, skb->dev, flags, ctrl_flags, cookie);
+
+	/* 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);
+
 	local_bh_enable();
 
 	mutex_unlock(&local->mtx);
