--- /dev/null
+From 2629a0390c8b1341f38379329e6b9f734ce94803 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 11 Apr 2019 13:47:25 -0700
+Subject: mac80211: add option for setting control flags
+
+From: Rajkumar Manoharan <rmanohar@codeaurora.org>
+
+[ Upstream commit 060167729a78d626abaee1a0ebb64b252374426e ]
+
+Allows setting of control flags of skb cb - if needed -
+when calling ieee80211_subif_start_xmit().
+
+Tested-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
+Signed-off-by: Rajkumar Manoharan <rmanohar@codeaurora.org>
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/mac80211/ieee80211_i.h | 3 ++-
+ net/mac80211/tdls.c | 2 +-
+ net/mac80211/tx.c | 18 +++++++++++-------
+ 3 files changed, 14 insertions(+), 9 deletions(-)
+
+diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
+index cfd30671ccdf9..a879d8071712b 100644
+--- a/net/mac80211/ieee80211_i.h
++++ b/net/mac80211/ieee80211_i.h
+@@ -1729,7 +1729,8 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
+ struct net_device *dev);
+ void __ieee80211_subif_start_xmit(struct sk_buff *skb,
+ struct net_device *dev,
+- u32 info_flags);
++ u32 info_flags,
++ u32 ctrl_flags);
+ void ieee80211_purge_tx_queue(struct ieee80211_hw *hw,
+ struct sk_buff_head *skbs);
+ struct sk_buff *
+diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
+index 67745d1d4c5d1..aa6fabfed3a70 100644
+--- a/net/mac80211/tdls.c
++++ b/net/mac80211/tdls.c
+@@ -1055,7 +1055,7 @@ ieee80211_tdls_prep_mgmt_packet(struct wiphy *wiphy, struct net_device *dev,
+
+ /* disable bottom halves when entering the Tx path */
+ local_bh_disable();
+- __ieee80211_subif_start_xmit(skb, dev, flags);
++ __ieee80211_subif_start_xmit(skb, dev, flags, 0);
+ local_bh_enable();
+
+ return ret;
+diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
+index cb84f2b411ae7..71159ee098ff6 100644
+--- a/net/mac80211/tx.c
++++ b/net/mac80211/tx.c
+@@ -2399,6 +2399,7 @@ static int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata,
+ * @sdata: virtual interface to build the header for
+ * @skb: the skb to build the header in
+ * @info_flags: skb flags to set
++ * @ctrl_flags: info control flags to set
+ *
+ * This function takes the skb with 802.3 header and reformats the header to
+ * the appropriate IEEE 802.11 header based on which interface the packet is
+@@ -2414,7 +2415,7 @@ static int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata,
+ */
+ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
+ struct sk_buff *skb, u32 info_flags,
+- struct sta_info *sta)
++ struct sta_info *sta, u32 ctrl_flags)
+ {
+ struct ieee80211_local *local = sdata->local;
+ struct ieee80211_tx_info *info;
+@@ -2786,6 +2787,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
+ info->flags = info_flags;
+ info->ack_frame_id = info_id;
+ info->band = band;
++ info->control.flags = ctrl_flags;
+
+ return skb;
+ free:
+@@ -3612,7 +3614,8 @@ EXPORT_SYMBOL(ieee80211_tx_dequeue);
+
+ void __ieee80211_subif_start_xmit(struct sk_buff *skb,
+ struct net_device *dev,
+- u32 info_flags)
++ u32 info_flags,
++ u32 ctrl_flags)
+ {
+ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+ struct sta_info *sta;
+@@ -3683,7 +3686,8 @@ void __ieee80211_subif_start_xmit(struct sk_buff *skb,
+ skb->prev = NULL;
+ skb->next = NULL;
+
+- skb = ieee80211_build_hdr(sdata, skb, info_flags, sta);
++ skb = ieee80211_build_hdr(sdata, skb, info_flags,
++ sta, ctrl_flags);
+ if (IS_ERR(skb))
+ goto out;
+
+@@ -3823,9 +3827,9 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
+ __skb_queue_head_init(&queue);
+ ieee80211_convert_to_unicast(skb, dev, &queue);
+ while ((skb = __skb_dequeue(&queue)))
+- __ieee80211_subif_start_xmit(skb, dev, 0);
++ __ieee80211_subif_start_xmit(skb, dev, 0, 0);
+ } else {
+- __ieee80211_subif_start_xmit(skb, dev, 0);
++ __ieee80211_subif_start_xmit(skb, dev, 0, 0);
+ }
+
+ return NETDEV_TX_OK;
+@@ -3850,7 +3854,7 @@ ieee80211_build_data_template(struct ieee80211_sub_if_data *sdata,
+ goto out;
+ }
+
+- skb = ieee80211_build_hdr(sdata, skb, info_flags, sta);
++ skb = ieee80211_build_hdr(sdata, skb, info_flags, sta, 0);
+ if (IS_ERR(skb))
+ goto out;
+
+@@ -4887,7 +4891,7 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
+ skb_reset_mac_header(skb);
+
+ local_bh_disable();
+- __ieee80211_subif_start_xmit(skb, skb->dev, flags);
++ __ieee80211_subif_start_xmit(skb, skb->dev, flags, 0);
+ local_bh_enable();
+
+ return 0;
+--
+2.20.1
+
--- /dev/null
+From ecead51fca58f7fa5149111dfd5693d7d3f31d6a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 26 Mar 2020 15:53:34 +0100
+Subject: mac80211: set IEEE80211_TX_CTRL_PORT_CTRL_PROTO for nl80211 TX
+
+From: Johannes Berg <johannes.berg@intel.com>
+
+[ Upstream commit b95d2ccd2ccb834394d50347d0e40dc38a954e4a ]
+
+When a frame is transmitted via the nl80211 TX rather than as a
+normal frame, IEEE80211_TX_CTRL_PORT_CTRL_PROTO wasn't set and
+this will lead to wrong decisions (rate control etc.) being made
+about the frame; fix this.
+
+Fixes: 911806491425 ("mac80211: Add support for tx_control_port")
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Link: https://lore.kernel.org/r/20200326155333.f183f52b02f0.I4054e2a8c11c2ddcb795a0103c87be3538690243@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/mac80211/tx.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
+index 71159ee098ff6..e2487da4024ba 100644
+--- a/net/mac80211/tx.c
++++ b/net/mac80211/tx.c
+@@ -4,7 +4,7 @@
+ * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
+ * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2013-2014 Intel Mobile Communications GmbH
+- * Copyright (C) 2018 Intel Corporation
++ * Copyright (C) 2018, 2020 Intel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+@@ -4857,6 +4857,7 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
+ struct ieee80211_local *local = sdata->local;
+ struct sk_buff *skb;
+ struct ethhdr *ehdr;
++ u32 ctrl_flags = 0;
+ u32 flags;
+
+ /* Only accept CONTROL_PORT_PROTOCOL configured in CONNECT/ASSOCIATE
+@@ -4866,6 +4867,9 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
+ proto != cpu_to_be16(ETH_P_PREAUTH))
+ return -EINVAL;
+
++ if (proto == sdata->control_port_protocol)
++ ctrl_flags |= IEEE80211_TX_CTRL_PORT_CTRL_PROTO;
++
+ if (unencrypted)
+ flags = IEEE80211_TX_INTFL_DONT_ENCRYPT;
+ else
+@@ -4891,7 +4895,7 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
+ skb_reset_mac_header(skb);
+
+ local_bh_disable();
+- __ieee80211_subif_start_xmit(skb, skb->dev, flags, 0);
++ __ieee80211_subif_start_xmit(skb, skb->dev, flags, ctrl_flags);
+ local_bh_enable();
+
+ return 0;
+--
+2.20.1
+