mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-20 10:51:27 +00:00
389 lines
12 KiB
Diff
389 lines
12 KiB
Diff
From 193bfea2185a0ee976f54812e41ace77e6ee85e4 Mon Sep 17 00:00:00 2001
|
|
From: Sriram R <srirrama@codeaurora.org>
|
|
Date: Fri, 10 Jul 2020 12:46:12 +0530
|
|
Subject: [PATCH 1/3] mac80211: add nss support
|
|
|
|
Add Support for NSS Offload if the HW supports it.
|
|
New flag is introduced to indicate HW support for NSS
|
|
offload
|
|
|
|
Signed-off-by: Sriram R <srirrama@codeaurora.org>
|
|
---
|
|
include/net/mac80211.h | 13 +++++++++++++
|
|
net/mac80211/debugfs.c | 1 +
|
|
net/mac80211/util.c | 16 ++++++++++++++++
|
|
3 files changed, 30 insertions(+)
|
|
|
|
--- a/include/net/mac80211.h
|
|
+++ b/include/net/mac80211.h
|
|
@@ -354,6 +354,20 @@ enum ieee80211_bss_change {
|
|
/* when adding here, make sure to change ieee80211_reconfig */
|
|
};
|
|
|
|
+/**
|
|
+ * enum ieee80211_nss_bss_change - NSS BSS change notification flags
|
|
+ *
|
|
+ * These flags are used with the nss_bss_info_changed() callback
|
|
+ * to indicate which NSS BSS parameter changed.
|
|
+ *
|
|
+ * @BSS_CHANGED_NSS_AP_ISOLATE: AP Isolate feature in NSS mode
|
|
+ *
|
|
+ */
|
|
+
|
|
+enum ieee80211_nss_bss_change {
|
|
+ BSS_CHANGED_NSS_AP_ISOLATE = BIT(0),
|
|
+};
|
|
+
|
|
/*
|
|
* The maximum number of IPv4 addresses listed for ARP filtering. If the number
|
|
* of addresses for an interface increase beyond this value, hardware ARP
|
|
@@ -607,6 +621,7 @@ struct ieee80211_ftm_responder_params {
|
|
* @he_oper: HE operation information of the AP we are connected to
|
|
* @he_obss_pd: OBSS Packet Detection parameters.
|
|
* @he_bss_color: BSS coloring settings, if BSS supports HE
|
|
+ * @nss_ap_isolate: Used for notifying the NSS host about AP isolate feature
|
|
*/
|
|
struct ieee80211_bss_conf {
|
|
const u8 *bssid;
|
|
@@ -675,6 +690,7 @@ struct ieee80211_bss_conf {
|
|
struct ieee80211_he_obss_pd he_obss_pd;
|
|
struct ieee80211_he_cap_elem he_cap_elem;
|
|
struct cfg80211_he_bss_color he_bss_color;
|
|
+ bool nss_ap_isolate;
|
|
};
|
|
|
|
/**
|
|
@@ -1714,6 +1730,16 @@ struct ieee80211_vif *wdev_to_ieee80211_
|
|
struct wireless_dev *ieee80211_vif_to_wdev(struct ieee80211_vif *vif);
|
|
|
|
/**
|
|
+ * ieee80211_vif_to_wdev_relaxed - return a wdev struct from a vif
|
|
+ * @vif: the vif to get the wdev for
|
|
+ *
|
|
+ * This function is similar to ieee80211_vif_to_wdev, but the wdev
|
|
+ * is returned even if sdata is not running.
|
|
+ *
|
|
+ */
|
|
+struct wireless_dev *ieee80211_vif_to_wdev_relaxed(struct ieee80211_vif *vif);
|
|
+
|
|
+/**
|
|
* enum ieee80211_key_flags - key flags
|
|
*
|
|
* These flags are used for communication about keys between the driver
|
|
@@ -2331,6 +2357,8 @@ struct ieee80211_txq {
|
|
* aggregating MPDUs with the same keyid, allowing mac80211 to keep Tx
|
|
* A-MPDU sessions active while rekeying with Extended Key ID.
|
|
*
|
|
+ * @IEEE80211_HW_SUPPORTS_NSS_OFFLOAD: Hardware/driver supports NSS offload
|
|
+ *
|
|
* @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
|
|
*/
|
|
enum ieee80211_hw_flags {
|
|
@@ -2383,6 +2411,7 @@ enum ieee80211_hw_flags {
|
|
IEEE80211_HW_SUPPORTS_MULTI_BSSID,
|
|
IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID,
|
|
IEEE80211_HW_AMPDU_KEYBORDER_SUPPORT,
|
|
+ IEEE80211_HW_SUPPORTS_NSS_OFFLOAD,
|
|
|
|
/* keep last, obviously */
|
|
NUM_IEEE80211_HW_FLAGS
|
|
@@ -3361,6 +3390,10 @@ enum ieee80211_reconfig_type {
|
|
* of the bss parameters has changed when a call is made. The callback
|
|
* can sleep.
|
|
*
|
|
+ * @nss_bss_info_changed: Handler for configuration requests related to NSS BSS
|
|
+ * parameters that may vary during BSS's lifespan, and may affect low level
|
|
+ * driver.
|
|
+ *
|
|
* @prepare_multicast: Prepare for multicast filter configuration.
|
|
* This callback is optional, and its return value is passed
|
|
* to configure_filter(). This callback must be atomic.
|
|
@@ -3841,6 +3874,9 @@ struct ieee80211_ops {
|
|
struct ieee80211_vif *vif,
|
|
struct ieee80211_bss_conf *info,
|
|
u32 changed);
|
|
+ void (*nss_bss_info_changed)(struct ieee80211_hw *hw,
|
|
+ struct ieee80211_vif *vif,
|
|
+ u32 changed);
|
|
|
|
int (*start_ap)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
|
|
void (*stop_ap)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
|
|
--- a/net/mac80211/debugfs.c
|
|
+++ b/net/mac80211/debugfs.c
|
|
@@ -408,6 +408,7 @@ static const char *hw_flag_names[] = {
|
|
FLAG(SUPPORTS_MULTI_BSSID),
|
|
FLAG(SUPPORTS_ONLY_HE_MULTI_BSSID),
|
|
FLAG(AMPDU_KEYBORDER_SUPPORT),
|
|
+ FLAG(SUPPORTS_NSS_OFFLOAD),
|
|
#undef FLAG
|
|
};
|
|
|
|
--- a/net/mac80211/util.c
|
|
+++ b/net/mac80211/util.c
|
|
@@ -826,6 +826,22 @@ struct wireless_dev *ieee80211_vif_to_wd
|
|
}
|
|
EXPORT_SYMBOL_GPL(ieee80211_vif_to_wdev);
|
|
|
|
+struct wireless_dev *ieee80211_vif_to_wdev_relaxed(struct ieee80211_vif *vif)
|
|
+{
|
|
+ struct ieee80211_sub_if_data *sdata;
|
|
+
|
|
+ if (!vif)
|
|
+ return NULL;
|
|
+
|
|
+ sdata = vif_to_sdata(vif);
|
|
+
|
|
+ if (sdata)
|
|
+ return &sdata->wdev;
|
|
+
|
|
+ return NULL;
|
|
+}
|
|
+EXPORT_SYMBOL(ieee80211_vif_to_wdev_relaxed);
|
|
+
|
|
/*
|
|
* Nothing should have been stuffed into the workqueue during
|
|
* the suspend->resume cycle. Since we can't check each caller
|
|
--- a/net/mac80211/main.c
|
|
+++ b/net/mac80211/main.c
|
|
@@ -210,6 +210,17 @@ void ieee80211_bss_info_change_notify(st
|
|
drv_bss_info_changed(local, sdata, &sdata->vif.bss_conf, changed);
|
|
}
|
|
|
|
+void ieee80211_nss_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
|
|
+ u32 changed)
|
|
+{
|
|
+ struct ieee80211_local *local = sdata->local;
|
|
+
|
|
+ if (!changed || sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
|
|
+ return;
|
|
+
|
|
+ drv_nss_bss_info_changed(local, sdata, &sdata->vif.bss_conf, changed);
|
|
+}
|
|
+
|
|
u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata)
|
|
{
|
|
sdata->vif.bss_conf.use_cts_prot = false;
|
|
@@ -595,12 +606,6 @@ struct ieee80211_hw *ieee80211_alloc_hw_
|
|
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_FILS_STA);
|
|
#endif
|
|
wiphy_ext_feature_set(wiphy,
|
|
- NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211);
|
|
- wiphy_ext_feature_set(wiphy,
|
|
- NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH);
|
|
- wiphy_ext_feature_set(wiphy,
|
|
- NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211_TX_STATUS);
|
|
- wiphy_ext_feature_set(wiphy,
|
|
NL80211_EXT_FEATURE_SCAN_FREQ_KHZ);
|
|
|
|
if (!ops->hw_scan) {
|
|
@@ -922,6 +927,18 @@ int ieee80211_register_hw(struct ieee802
|
|
(!local->ops->start_nan || !local->ops->stop_nan)))
|
|
return -EINVAL;
|
|
|
|
+ /* Control port over nl80211 is disabled for nss offload as
|
|
+ * sending per packet tx status is not supported and only
|
|
+ * rx over netdev from driver is done currently */
|
|
+ if (!ieee80211_hw_check(hw, SUPPORTS_NSS_OFFLOAD)) {
|
|
+ wiphy_ext_feature_set(hw->wiphy,
|
|
+ NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211);
|
|
+ wiphy_ext_feature_set(hw->wiphy,
|
|
+ NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH);
|
|
+ wiphy_ext_feature_set(hw->wiphy,
|
|
+ NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211_TX_STATUS);
|
|
+ }
|
|
+
|
|
#ifdef CONFIG_PM
|
|
if (hw->wiphy->wowlan && (!local->ops->suspend || !local->ops->resume))
|
|
return -EINVAL;
|
|
--- a/net/mac80211/sta_info.c
|
|
+++ b/net/mac80211/sta_info.c
|
|
@@ -2080,7 +2080,10 @@ sta_get_last_rx_stats(struct sta_info *s
|
|
struct ieee80211_local *local = sta->local;
|
|
int cpu;
|
|
|
|
- if (!ieee80211_hw_check(&local->hw, USES_RSS))
|
|
+ if (ieee80211_hw_check(&local->hw, SUPPORTS_NSS_OFFLOAD))
|
|
+ return stats;
|
|
+
|
|
+ if (!ieee80211_hw_check(&local->hw, USES_RSS))
|
|
return stats;
|
|
|
|
for_each_possible_cpu(cpu) {
|
|
--- a/net/mac80211/tx.c
|
|
+++ b/net/mac80211/tx.c
|
|
@@ -1003,11 +1003,23 @@ ieee80211_tx_h_stats(struct ieee80211_tx
|
|
{
|
|
struct sk_buff *skb;
|
|
int ac = -1;
|
|
+ struct ieee80211_hdr *hdr;
|
|
+ bool nss_offload;
|
|
|
|
if (!tx->sta)
|
|
return TX_CONTINUE;
|
|
|
|
+ nss_offload = ieee80211_hw_check(&tx->local->hw, SUPPORTS_NSS_OFFLOAD);
|
|
+
|
|
skb_queue_walk(&tx->skbs, skb) {
|
|
+ /* Do not increment stats for data packets if NSS offload is enabled.
|
|
+ * As we use the stats from NSS, this will be a duplication
|
|
+ */
|
|
+ if (nss_offload) {
|
|
+ hdr = (void *) skb->data;
|
|
+ if (ieee80211_is_data(hdr->frame_control))
|
|
+ continue;
|
|
+ }
|
|
ac = skb_get_queue_mapping(skb);
|
|
tx->sta->tx_stats.bytes[ac] += skb->len;
|
|
}
|
|
@@ -4247,7 +4259,7 @@ static void ieee80211_8023_xmit(struct i
|
|
|
|
ieee80211_tx_stats(dev, skb->len);
|
|
|
|
- if (sta) {
|
|
+ if (sta && !ieee80211_hw_check(&local->hw, SUPPORTS_NSS_OFFLOAD)) {
|
|
sta->tx_stats.bytes[skb_get_queue_mapping(skb)] += skb->len;
|
|
sta->tx_stats.packets[skb_get_queue_mapping(skb)]++;
|
|
}
|
|
--- a/net/wireless/util.c
|
|
+++ b/net/wireless/util.c
|
|
@@ -1986,6 +1986,9 @@ bool cfg80211_does_bw_fit_range(const st
|
|
|
|
int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp)
|
|
{
|
|
+ if(sinfo->pertid)
|
|
+ return 0;
|
|
+
|
|
sinfo->pertid = kcalloc(IEEE80211_NUM_TIDS + 1,
|
|
sizeof(*(sinfo->pertid)),
|
|
gfp);
|
|
--- a/net/mac80211/cfg.c
|
|
+++ b/net/mac80211/cfg.c
|
|
@@ -2194,7 +2194,7 @@ static int ieee80211_change_bss(struct w
|
|
{
|
|
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
|
|
struct ieee80211_supported_band *sband;
|
|
- u32 changed = 0;
|
|
+ u32 changed = 0, nss_changed = 0;;
|
|
|
|
if (!sdata_dereference(sdata->u.ap.beacon, sdata))
|
|
return -ENOENT;
|
|
@@ -2241,6 +2241,8 @@ static int ieee80211_change_bss(struct w
|
|
sdata->flags |= IEEE80211_SDATA_DONT_BRIDGE_PACKETS;
|
|
else
|
|
sdata->flags &= ~IEEE80211_SDATA_DONT_BRIDGE_PACKETS;
|
|
+ sdata->vif.bss_conf.nss_ap_isolate = params->ap_isolate;
|
|
+ nss_changed |= BSS_CHANGED_NSS_AP_ISOLATE;
|
|
ieee80211_check_fast_rx_iface(sdata);
|
|
}
|
|
|
|
@@ -2270,6 +2272,8 @@ static int ieee80211_change_bss(struct w
|
|
|
|
ieee80211_bss_info_change_notify(sdata, changed);
|
|
|
|
+ ieee80211_nss_bss_info_change_notify(sdata, nss_changed);
|
|
+
|
|
return 0;
|
|
}
|
|
|
|
--- a/net/mac80211/driver-ops.h
|
|
+++ b/net/mac80211/driver-ops.h
|
|
@@ -178,6 +178,23 @@ static inline void drv_bss_info_changed(
|
|
trace_drv_return_void(local);
|
|
}
|
|
|
|
+static inline void drv_nss_bss_info_changed(struct ieee80211_local *local,
|
|
+ struct ieee80211_sub_if_data *sdata,
|
|
+ struct ieee80211_bss_conf *info,
|
|
+ u32 changed)
|
|
+{
|
|
+ might_sleep();
|
|
+
|
|
+ if (!check_sdata_in_driver(sdata))
|
|
+ return;
|
|
+
|
|
+ trace_drv_nss_bss_info_changed(local, sdata, info, changed);
|
|
+ if (local->ops->nss_bss_info_changed) {
|
|
+ local->ops->nss_bss_info_changed(&local->hw, &sdata->vif, changed);
|
|
+ }
|
|
+ trace_drv_nss_return_void(local);
|
|
+}
|
|
+
|
|
static inline u64 drv_prepare_multicast(struct ieee80211_local *local,
|
|
struct netdev_hw_addr_list *mc_list)
|
|
{
|
|
--- a/net/mac80211/ieee80211_i.h
|
|
+++ b/net/mac80211/ieee80211_i.h
|
|
@@ -1614,6 +1614,8 @@ int ieee80211_hw_config(struct ieee80211
|
|
void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx);
|
|
void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
|
|
u32 changed);
|
|
+void ieee80211_nss_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
|
|
+ u32 changed);
|
|
void ieee80211_configure_filter(struct ieee80211_local *local);
|
|
u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata);
|
|
|
|
--- a/net/mac80211/trace.h
|
|
+++ b/net/mac80211/trace.h
|
|
@@ -389,6 +389,38 @@ TRACE_EVENT(drv_config,
|
|
LOCAL_PR_ARG, __entry->changed, CHANDEF_PR_ARG
|
|
)
|
|
);
|
|
+TRACE_EVENT(drv_nss_bss_info_changed,
|
|
+ TP_PROTO(struct ieee80211_local *local,
|
|
+ struct ieee80211_sub_if_data *sdata,
|
|
+ struct ieee80211_bss_conf *info,
|
|
+ u32 changed),
|
|
+
|
|
+ TP_ARGS(local, sdata, info, changed),
|
|
+
|
|
+ TP_STRUCT__entry(
|
|
+ LOCAL_ENTRY
|
|
+ VIF_ENTRY
|
|
+ __field(u32, changed)
|
|
+ __field(bool, nss_ap_isolate);
|
|
+ ),
|
|
+
|
|
+ TP_fast_assign(
|
|
+ LOCAL_ASSIGN;
|
|
+ VIF_ASSIGN;
|
|
+ __entry->changed = changed;
|
|
+ __entry->nss_ap_isolate = info->nss_ap_isolate;
|
|
+ ),
|
|
+
|
|
+ TP_printk(
|
|
+ LOCAL_PR_FMT VIF_PR_FMT " changed:%#x",
|
|
+ LOCAL_PR_ARG, VIF_PR_ARG, __entry->changed
|
|
+ )
|
|
+);
|
|
+
|
|
+DEFINE_EVENT(local_only_evt, drv_nss_return_void,
|
|
+ TP_PROTO(struct ieee80211_local *local),
|
|
+ TP_ARGS(local)
|
|
+);
|
|
|
|
TRACE_EVENT(drv_bss_info_changed,
|
|
TP_PROTO(struct ieee80211_local *local,
|
|
--- a/net/mac80211/iface.c
|
|
+++ b/net/mac80211/iface.c
|
|
@@ -1306,6 +1306,7 @@ bool ieee80211_set_hw_80211_encap(struct
|
|
struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
|
|
struct ieee80211_local *local = sdata->local;
|
|
struct ieee80211_sub_if_data *iter;
|
|
+ bool nss_offload = ieee80211_hw_check(&local->hw, SUPPORTS_NSS_OFFLOAD);
|
|
|
|
mutex_lock(&local->iflist_mtx);
|
|
list_for_each_entry(iter, &local->interfaces, list) {
|
|
@@ -1313,10 +1314,10 @@ bool ieee80211_set_hw_80211_encap(struct
|
|
|
|
if (vif->type == NL80211_IFTYPE_MONITOR) {
|
|
disable = iter;
|
|
- __ieee80211_set_hw_80211_encap(iter, false);
|
|
+ __ieee80211_set_hw_80211_encap(iter, nss_offload ? enable : false);
|
|
} else if (iter->vif.type == NL80211_IFTYPE_MONITOR) {
|
|
disable = sdata;
|
|
- enable = false;
|
|
+ enable = nss_offload ? enable : false;
|
|
}
|
|
if (disable)
|
|
sdata_dbg(disable,
|