- err_init:
---- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
-+++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
-@@ -410,7 +410,7 @@ static const u32 ar9300_2p2_baseband_cor
- {0x00009e30, 0x06336f77},
- {0x00009e34, 0x6af6532f},
- {0x00009e38, 0x0cc80c00},
-- {0x00009e40, 0x0d261820},
-+ {0x00009e40, 0x0d261800},
- {0x00009e4c, 0x00001004},
- {0x00009e50, 0x00ff03f1},
- {0x00009e54, 0x00000000},
---- a/drivers/net/wireless/ath/ath9k/ar9330_1p1_initvals.h
-+++ b/drivers/net/wireless/ath/ath9k/ar9330_1p1_initvals.h
-@@ -592,7 +592,7 @@ static const u32 ar9331_1p1_baseband_cor
- {0x00009e30, 0x06336f77},
- {0x00009e34, 0x6af6532f},
- {0x00009e38, 0x0cc80c00},
-- {0x00009e40, 0x0d261820},
-+ {0x00009e40, 0x0d261800},
- {0x00009e4c, 0x00001004},
- {0x00009e50, 0x00ff03f1},
- {0x00009fc0, 0x803e4788},
---- a/drivers/net/wireless/ath/ath9k/ar9330_1p2_initvals.h
-+++ b/drivers/net/wireless/ath/ath9k/ar9330_1p2_initvals.h
-@@ -231,7 +231,7 @@ static const u32 ar9331_1p2_baseband_cor
- {0x00009e30, 0x06336f77},
- {0x00009e34, 0x6af6532f},
- {0x00009e38, 0x0cc80c00},
-- {0x00009e40, 0x0d261820},
-+ {0x00009e40, 0x0d261800},
- {0x00009e4c, 0x00001004},
- {0x00009e50, 0x00ff03f1},
- {0x00009fc0, 0x803e4788},
---- a/drivers/net/wireless/ath/ath9k/ar9340_initvals.h
-+++ b/drivers/net/wireless/ath/ath9k/ar9340_initvals.h
-@@ -318,7 +318,7 @@ static const u32 ar9340_1p0_baseband_cor
- {0x00009e30, 0x06336f77},
- {0x00009e34, 0x6af6532f},
- {0x00009e38, 0x0cc80c00},
-- {0x00009e40, 0x0d261820},
-+ {0x00009e40, 0x0d261800},
- {0x00009e4c, 0x00001004},
- {0x00009e50, 0x00ff03f1},
- {0x00009e54, 0x00000000},
-@@ -348,9 +348,9 @@ static const u32 ar9340_1p0_baseband_cor
- {0x0000a370, 0x00000000},
- {0x0000a390, 0x00000001},
- {0x0000a394, 0x00000444},
-- {0x0000a398, 0x00000000},
-- {0x0000a39c, 0x210d0401},
-- {0x0000a3a0, 0xab9a7144},
-+ {0x0000a398, 0x001f0e0f},
-+ {0x0000a39c, 0x0075393f},
-+ {0x0000a3a0, 0xb79f6427},
- {0x0000a3a4, 0x00000000},
- {0x0000a3a8, 0xaaaaaaaa},
- {0x0000a3ac, 0x3c466478},
---- a/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h
-+++ b/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h
-@@ -90,7 +90,7 @@ static const u32 ar9580_1p0_baseband_cor
- {0x00009e30, 0x06336f77},
- {0x00009e34, 0x6af6532f},
- {0x00009e38, 0x0cc80c00},
-- {0x00009e40, 0x0d261820},
-+ {0x00009e40, 0x0d261800},
- {0x00009e4c, 0x00001004},
- {0x00009e50, 0x00ff03f1},
- {0x00009e54, 0x00000000},
---- a/drivers/net/wireless/ath/ath9k/ar953x_initvals.h
-+++ b/drivers/net/wireless/ath/ath9k/ar953x_initvals.h
-@@ -257,9 +257,9 @@ static const u32 qca953x_1p0_baseband_co
- {0x0000a370, 0x00000000},
- {0x0000a390, 0x00000001},
- {0x0000a394, 0x00000444},
-- {0x0000a398, 0x1f020503},
-- {0x0000a39c, 0x29180c03},
-- {0x0000a3a0, 0x9a8b6844},
-+ {0x0000a398, 0x001f0e0f},
-+ {0x0000a39c, 0x0075393f},
-+ {0x0000a3a0, 0xb79f6427},
- {0x0000a3a4, 0x000000ff},
- {0x0000a3a8, 0x6a6a6a6a},
- {0x0000a3ac, 0x6a6a6a6a},
---- a/drivers/net/wireless/ath/ath5k/phy.c
-+++ b/drivers/net/wireless/ath/ath5k/phy.c
-@@ -3709,8 +3709,8 @@ ath5k_hw_txpower(struct ath5k_hw *ah, st
- AR5K_REG_MS(AR5K_TUNE_MAX_TXPOWER, AR5K_TPC_CHIRP),
- AR5K_TPC);
+ /* used to reconfigure hardware SM PS */
+ struct work_struct recalc_smps;
+@@ -1850,6 +1860,8 @@ int ieee80211_tdls_oper(struct wiphy *wi
+ const u8 *peer, enum nl80211_tdls_operation oper);
+
+
++extern const struct ethtool_ops ieee80211_ethtool_ops;
++
+ #ifdef CPTCFG_MAC80211_NOINLINE
+ #define debug_noinline noinline
+ #else
+--- a/net/mac80211/iface.c
++++ b/net/mac80211/iface.c
+@@ -399,6 +399,7 @@ int ieee80211_add_virtual_monitor(struct
+ sdata->vif.type = NL80211_IFTYPE_MONITOR;
+ snprintf(sdata->name, IFNAMSIZ, "%s-monitor",
+ wiphy_name(local->hw.wiphy));
++ sdata->wdev.iftype = NL80211_IFTYPE_MONITOR;
+
+ sdata->encrypt_headroom = IEEE80211_ENCRYPT_HEADROOM;
+
+@@ -1303,6 +1304,7 @@ static void ieee80211_setup_sdata(struct
+ sdata->control_port_protocol = cpu_to_be16(ETH_P_PAE);
+ sdata->control_port_no_encrypt = false;
+ sdata->encrypt_headroom = IEEE80211_ENCRYPT_HEADROOM;
++ sdata->vif.bss_conf.idle = true;
+
+ sdata->noack_map = 0;
+
+@@ -1721,6 +1723,8 @@ int ieee80211_if_add(struct ieee80211_lo
+
+ ndev->features |= local->hw.netdev_features;
+
++ netdev_set_default_ethtool_ops(ndev, &ieee80211_ethtool_ops);
++
+ ret = register_netdevice(ndev);
+ if (ret) {
+ free_netdev(ndev);
+--- a/net/wireless/core.c
++++ b/net/wireless/core.c
+@@ -25,7 +25,6 @@
+ #include "sysfs.h"
+ #include "debugfs.h"
+ #include "wext-compat.h"
+-#include "ethtool.h"
+ #include "rdev-ops.h"
+
+ /* name for sysfs, %d is appended */
+@@ -940,8 +939,6 @@ static int cfg80211_netdev_notifier_call
+ /* allow mac80211 to determine the timeout */
+ wdev->ps_timeout = -1;
+
+- netdev_set_default_ethtool_ops(dev, &cfg80211_ethtool_ops);
+-
+ if ((wdev->iftype == NL80211_IFTYPE_STATION ||
+ wdev->iftype == NL80211_IFTYPE_P2P_CLIENT ||
+ wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr)
+--- a/net/wireless/ethtool.c
++++ b/net/wireless/ethtool.c
+@@ -1,11 +1,9 @@
+ #include <linux/utsname.h>
+ #include <net/cfg80211.h>
+ #include "core.h"
+-#include "ethtool.h"
+ #include "rdev-ops.h"
+
+-static void cfg80211_get_drvinfo(struct net_device *dev,
+- struct ethtool_drvinfo *info)
++void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
+ {
+ struct wireless_dev *wdev = dev->ieee80211_ptr;
+
+@@ -23,84 +21,4 @@ static void cfg80211_get_drvinfo(struct
+ strlcpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)),
+ sizeof(info->bus_info));
+ }
+-
+-static int cfg80211_get_regs_len(struct net_device *dev)
+-{
+- /* For now, return 0... */
+- return 0;
+-}
+-
+-static void cfg80211_get_regs(struct net_device *dev, struct ethtool_regs *regs,
+- void *data)
+-{
+- struct wireless_dev *wdev = dev->ieee80211_ptr;
+-
+- regs->version = wdev->wiphy->hw_version;
+- regs->len = 0;
+-}
+-
+-static void cfg80211_get_ringparam(struct net_device *dev,
+- struct ethtool_ringparam *rp)
+-{
+- struct wireless_dev *wdev = dev->ieee80211_ptr;
+- struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
+-
+- memset(rp, 0, sizeof(*rp));
+-
+- if (rdev->ops->get_ringparam)
+- rdev_get_ringparam(rdev, &rp->tx_pending, &rp->tx_max_pending,
+- &rp->rx_pending, &rp->rx_max_pending);
+-}
+-
+-static int cfg80211_set_ringparam(struct net_device *dev,
+- struct ethtool_ringparam *rp)
+-{
+- struct wireless_dev *wdev = dev->ieee80211_ptr;
+- struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
+-
+- if (rp->rx_mini_pending != 0 || rp->rx_jumbo_pending != 0)
+- return -EINVAL;
+-
+- if (rdev->ops->set_ringparam)
+- return rdev_set_ringparam(rdev, rp->tx_pending, rp->rx_pending);
+-
+- return -ENOTSUPP;
+-}
+-
+-static int cfg80211_get_sset_count(struct net_device *dev, int sset)
+-{
+- struct wireless_dev *wdev = dev->ieee80211_ptr;
+- struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
+- if (rdev->ops->get_et_sset_count)
+- return rdev_get_et_sset_count(rdev, dev, sset);
+- return -EOPNOTSUPP;
+-}
+-
+-static void cfg80211_get_stats(struct net_device *dev,
+- struct ethtool_stats *stats, u64 *data)
+-{
+- struct wireless_dev *wdev = dev->ieee80211_ptr;
+- struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
+- if (rdev->ops->get_et_stats)
+- rdev_get_et_stats(rdev, dev, stats, data);
+-}
+-
+-static void cfg80211_get_strings(struct net_device *dev, u32 sset, u8 *data)
+-{
+- struct wireless_dev *wdev = dev->ieee80211_ptr;
+- struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
+- if (rdev->ops->get_et_strings)
+- rdev_get_et_strings(rdev, dev, sset, data);
+-}
+-
+-const struct ethtool_ops cfg80211_ethtool_ops = {
+- .get_drvinfo = cfg80211_get_drvinfo,
+- .get_regs_len = cfg80211_get_regs_len,
+- .get_regs = cfg80211_get_regs,
+- .get_link = ethtool_op_get_link,
+- .get_ringparam = cfg80211_get_ringparam,
+- .set_ringparam = cfg80211_set_ringparam,
+- .get_strings = cfg80211_get_strings,
+- .get_ethtool_stats = cfg80211_get_stats,
+- .get_sset_count = cfg80211_get_sset_count,
+-};
++EXPORT_SYMBOL(cfg80211_get_drvinfo);
+--- a/net/wireless/ethtool.h
++++ /dev/null
+@@ -1,6 +0,0 @@
+-#ifndef __CFG80211_ETHTOOL__
+-#define __CFG80211_ETHTOOL__
+-
+-extern const struct ethtool_ops cfg80211_ethtool_ops;
+-
+-#endif /* __CFG80211_ETHTOOL__ */
+--- a/net/wireless/rdev-ops.h
++++ b/net/wireless/rdev-ops.h
+@@ -714,25 +714,6 @@ static inline int rdev_get_antenna(struc
+ return ret;
+ }
+
+-static inline int rdev_set_ringparam(struct cfg80211_registered_device *rdev,
+- u32 tx, u32 rx)
+-{
+- int ret;
+- trace_rdev_set_ringparam(&rdev->wiphy, tx, rx);
+- ret = rdev->ops->set_ringparam(&rdev->wiphy, tx, rx);
+- trace_rdev_return_int(&rdev->wiphy, ret);
+- return ret;
+-}
+-
+-static inline void rdev_get_ringparam(struct cfg80211_registered_device *rdev,
+- u32 *tx, u32 *tx_max, u32 *rx,
+- u32 *rx_max)
+-{
+- trace_rdev_get_ringparam(&rdev->wiphy);
+- rdev->ops->get_ringparam(&rdev->wiphy, tx, tx_max, rx, rx_max);
+- trace_rdev_return_void_tx_rx(&rdev->wiphy, *tx, *tx_max, *rx, *rx_max);
+-}
+-
+ static inline int
+ rdev_sched_scan_start(struct cfg80211_registered_device *rdev,
+ struct net_device *dev,
+@@ -816,35 +797,6 @@ static inline int rdev_set_noack_map(str
+ }
+
+ static inline int
+-rdev_get_et_sset_count(struct cfg80211_registered_device *rdev,
+- struct net_device *dev, int sset)
+-{
+- int ret;
+- trace_rdev_get_et_sset_count(&rdev->wiphy, dev, sset);
+- ret = rdev->ops->get_et_sset_count(&rdev->wiphy, dev, sset);
+- trace_rdev_return_int(&rdev->wiphy, ret);
+- return ret;
+-}
+-
+-static inline void rdev_get_et_stats(struct cfg80211_registered_device *rdev,
+- struct net_device *dev,
+- struct ethtool_stats *stats, u64 *data)
+-{
+- trace_rdev_get_et_stats(&rdev->wiphy, dev);
+- rdev->ops->get_et_stats(&rdev->wiphy, dev, stats, data);
+- trace_rdev_return_void(&rdev->wiphy);
+-}
+-
+-static inline void rdev_get_et_strings(struct cfg80211_registered_device *rdev,
+- struct net_device *dev, u32 sset,
+- u8 *data)
+-{
+- trace_rdev_get_et_strings(&rdev->wiphy, dev, sset);
+- rdev->ops->get_et_strings(&rdev->wiphy, dev, sset, data);
+- trace_rdev_return_void(&rdev->wiphy);
+-}
+-
+-static inline int
+ rdev_get_channel(struct cfg80211_registered_device *rdev,
+ struct wireless_dev *wdev,
+ struct cfg80211_chan_def *chandef)
+--- a/net/wireless/trace.h
++++ b/net/wireless/trace.h
+@@ -298,11 +298,6 @@ DEFINE_EVENT(wiphy_only_evt, rdev_return
+ TP_ARGS(wiphy)
+ );
+
+-DEFINE_EVENT(wiphy_only_evt, rdev_get_ringparam,
+- TP_PROTO(struct wiphy *wiphy),
+- TP_ARGS(wiphy)
+-);
+-
+ DEFINE_EVENT(wiphy_only_evt, rdev_get_antenna,
+ TP_PROTO(struct wiphy *wiphy),
+ TP_ARGS(wiphy)
+@@ -580,11 +575,6 @@ DEFINE_EVENT(wiphy_netdev_evt, rdev_stop
+ TP_ARGS(wiphy, netdev)
+ );
+
+-DEFINE_EVENT(wiphy_netdev_evt, rdev_get_et_stats,
+- TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
+- TP_ARGS(wiphy, netdev)
+-);
+-
+ DEFINE_EVENT(wiphy_netdev_evt, rdev_sched_scan_stop,
+ TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
+ TP_ARGS(wiphy, netdev)
+@@ -1439,11 +1429,6 @@ DECLARE_EVENT_CLASS(tx_rx_evt,
+ WIPHY_PR_ARG, __entry->tx, __entry->rx)
+ );
+
+-DEFINE_EVENT(tx_rx_evt, rdev_set_ringparam,
+- TP_PROTO(struct wiphy *wiphy, u32 tx, u32 rx),
+- TP_ARGS(wiphy, rx, tx)
+-);
+-
+ DEFINE_EVENT(tx_rx_evt, rdev_set_antenna,
+ TP_PROTO(struct wiphy *wiphy, u32 tx, u32 rx),
+ TP_ARGS(wiphy, rx, tx)
+@@ -1725,40 +1710,6 @@ TRACE_EVENT(rdev_set_noack_map,
+ WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->noack_map)
+ );
+
+-TRACE_EVENT(rdev_get_et_sset_count,
+- TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, int sset),
+- TP_ARGS(wiphy, netdev, sset),
+- TP_STRUCT__entry(
+- WIPHY_ENTRY
+- NETDEV_ENTRY
+- __field(int, sset)
+- ),
+- TP_fast_assign(
+- WIPHY_ASSIGN;
+- NETDEV_ASSIGN;
+- __entry->sset = sset;
+- ),
+- TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", sset: %d",
+- WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->sset)
+-);
+-
+-TRACE_EVENT(rdev_get_et_strings,
+- TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u32 sset),
+- TP_ARGS(wiphy, netdev, sset),
+- TP_STRUCT__entry(
+- WIPHY_ENTRY
+- NETDEV_ENTRY
+- __field(u32, sset)
+- ),
+- TP_fast_assign(
+- WIPHY_ASSIGN;
+- NETDEV_ASSIGN;
+- __entry->sset = sset;
+- ),
+- TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", sset: %u",
+- WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->sset)
+-);
+-
+ DEFINE_EVENT(wiphy_wdev_evt, rdev_get_channel,
+ TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
+ TP_ARGS(wiphy, wdev)
+--- /dev/null
++++ b/net/mac80211/ethtool.c
+@@ -0,0 +1,244 @@
++/*
++ * mac80211 ethtool hooks for cfg80211
++ *
++ * Copied from cfg.c - originally
++ * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
++ * Copyright 2014 Intel Corporation (Author: Johannes Berg)
++ *
++ * This file is GPLv2 as found in COPYING.
++ */
++#include <linux/types.h>
++#include <net/cfg80211.h>
++#include "ieee80211_i.h"
++#include "sta_info.h"
++#include "driver-ops.h"
++
++static int ieee80211_set_ringparam(struct net_device *dev,
++ struct ethtool_ringparam *rp)
++{
++ struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr->wiphy);
++
++ if (rp->rx_mini_pending != 0 || rp->rx_jumbo_pending != 0)
++ return -EINVAL;
++
++ return drv_set_ringparam(local, rp->tx_pending, rp->rx_pending);
++}
++
++static void ieee80211_get_ringparam(struct net_device *dev,
++ struct ethtool_ringparam *rp)
++{
++ struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr->wiphy);
++
++ memset(rp, 0, sizeof(*rp));
++
++ drv_get_ringparam(local, &rp->tx_pending, &rp->tx_max_pending,
++ &rp->rx_pending, &rp->rx_max_pending);
++}
++
++static const char ieee80211_gstrings_sta_stats[][ETH_GSTRING_LEN] = {
++ "rx_packets", "rx_bytes",
++ "rx_duplicates", "rx_fragments", "rx_dropped",
++ "tx_packets", "tx_bytes", "tx_fragments",
++ "tx_filtered", "tx_retry_failed", "tx_retries",
++ "beacon_loss", "sta_state", "txrate", "rxrate", "signal",
++ "channel", "noise", "ch_time", "ch_time_busy",
++ "ch_time_ext_busy", "ch_time_rx", "ch_time_tx"
++};
++#define STA_STATS_LEN ARRAY_SIZE(ieee80211_gstrings_sta_stats)
++
++static int ieee80211_get_sset_count(struct net_device *dev, int sset)
++{
++ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
++ int rv = 0;
++
++ if (sset == ETH_SS_STATS)
++ rv += STA_STATS_LEN;
++
++ rv += drv_get_et_sset_count(sdata, sset);
++
++ if (rv == 0)
++ return -EOPNOTSUPP;
++ return rv;
++}
++
++static void ieee80211_get_stats(struct net_device *dev,
++ struct ethtool_stats *stats,
++ u64 *data)
++{
++ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
++ struct ieee80211_chanctx_conf *chanctx_conf;
++ struct ieee80211_channel *channel;
++ struct sta_info *sta;
++ struct ieee80211_local *local = sdata->local;
++ struct station_info sinfo;
++ struct survey_info survey;
++ int i, q;
++#define STA_STATS_SURVEY_LEN 7
++
++ memset(data, 0, sizeof(u64) * STA_STATS_LEN);
++
++#define ADD_STA_STATS(sta) \
++ do { \
++ data[i++] += sta->rx_packets; \
++ data[i++] += sta->rx_bytes; \
++ data[i++] += sta->num_duplicates; \
++ data[i++] += sta->rx_fragments; \
++ data[i++] += sta->rx_dropped; \
++ \
++ data[i++] += sinfo.tx_packets; \
++ data[i++] += sinfo.tx_bytes; \
++ data[i++] += sta->tx_fragments; \
++ data[i++] += sta->tx_filtered_count; \
++ data[i++] += sta->tx_retry_failed; \
++ data[i++] += sta->tx_retry_count; \
++ data[i++] += sta->beacon_loss_count; \
++ } while (0)
++
++ /* For Managed stations, find the single station based on BSSID
++ * and use that. For interface types, iterate through all available
++ * stations and add stats for any station that is assigned to this
++ * network device.
++ */
++
++ mutex_lock(&local->sta_mtx);
++
++ if (sdata->vif.type == NL80211_IFTYPE_STATION) {
++ sta = sta_info_get_bss(sdata, sdata->u.mgd.bssid);
++
++ if (!(sta && !WARN_ON(sta->sdata->dev != dev)))
++ goto do_survey;
++
++ sinfo.filled = 0;
++ sta_set_sinfo(sta, &sinfo);
++
++ i = 0;
++ ADD_STA_STATS(sta);
++
++ data[i++] = sta->sta_state;
++
++
++ if (sinfo.filled & STATION_INFO_TX_BITRATE)
++ data[i] = 100000 *
++ cfg80211_calculate_bitrate(&sinfo.txrate);
++ i++;
++ if (sinfo.filled & STATION_INFO_RX_BITRATE)
++ data[i] = 100000 *
++ cfg80211_calculate_bitrate(&sinfo.rxrate);
++ i++;
++
++ if (sinfo.filled & STATION_INFO_SIGNAL_AVG)
++ data[i] = (u8)sinfo.signal_avg;
++ i++;
++ } else {
++ list_for_each_entry(sta, &local->sta_list, list) {
++ /* Make sure this station belongs to the proper dev */
++ if (sta->sdata->dev != dev)
++ continue;
++
++ sinfo.filled = 0;
++ sta_set_sinfo(sta, &sinfo);
++ i = 0;
++ ADD_STA_STATS(sta);
++ }
++ }
++
++do_survey:
++ i = STA_STATS_LEN - STA_STATS_SURVEY_LEN;
++ /* Get survey stats for current channel */
++ survey.filled = 0;
++
++ rcu_read_lock();
++ chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
++ if (chanctx_conf)
++ channel = chanctx_conf->def.chan;
++ else
++ channel = NULL;
++ rcu_read_unlock();
++
++ if (channel) {
++ q = 0;
++ do {
++ survey.filled = 0;
++ if (drv_get_survey(local, q, &survey) != 0) {
++ survey.filled = 0;
++ break;
++ }
++ q++;
++ } while (channel != survey.channel);
++ }
++
++ if (survey.filled)
++ data[i++] = survey.channel->center_freq;
++ else
++ data[i++] = 0;
++ if (survey.filled & SURVEY_INFO_NOISE_DBM)
++ data[i++] = (u8)survey.noise;
++ else
++ data[i++] = -1LL;
++ if (survey.filled & SURVEY_INFO_CHANNEL_TIME)
++ data[i++] = survey.channel_time;
++ else
++ data[i++] = -1LL;
++ if (survey.filled & SURVEY_INFO_CHANNEL_TIME_BUSY)
++ data[i++] = survey.channel_time_busy;
++ else
++ data[i++] = -1LL;
++ if (survey.filled & SURVEY_INFO_CHANNEL_TIME_EXT_BUSY)
++ data[i++] = survey.channel_time_ext_busy;
++ else
++ data[i++] = -1LL;
++ if (survey.filled & SURVEY_INFO_CHANNEL_TIME_RX)
++ data[i++] = survey.channel_time_rx;
++ else
++ data[i++] = -1LL;
++ if (survey.filled & SURVEY_INFO_CHANNEL_TIME_TX)
++ data[i++] = survey.channel_time_tx;
++ else
++ data[i++] = -1LL;
++
++ mutex_unlock(&local->sta_mtx);
++
++ if (WARN_ON(i != STA_STATS_LEN))
++ return;
++
++ drv_get_et_stats(sdata, stats, &(data[STA_STATS_LEN]));
++}
++
++static void ieee80211_get_strings(struct net_device *dev, u32 sset, u8 *data)
++{
++ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
++ int sz_sta_stats = 0;
++
++ if (sset == ETH_SS_STATS) {
++ sz_sta_stats = sizeof(ieee80211_gstrings_sta_stats);
++ memcpy(data, ieee80211_gstrings_sta_stats, sz_sta_stats);
++ }
++ drv_get_et_strings(sdata, sset, &(data[sz_sta_stats]));
++}
++
++static int ieee80211_get_regs_len(struct net_device *dev)
++{
++ return 0;
++}
++
++static void ieee80211_get_regs(struct net_device *dev,
++ struct ethtool_regs *regs,
++ void *data)
++{
++ struct wireless_dev *wdev = dev->ieee80211_ptr;
++
++ regs->version = wdev->wiphy->hw_version;
++ regs->len = 0;
++}
++
++const struct ethtool_ops ieee80211_ethtool_ops = {
++ .get_drvinfo = cfg80211_get_drvinfo,
++ .get_regs_len = ieee80211_get_regs_len,
++ .get_regs = ieee80211_get_regs,
++ .get_link = ethtool_op_get_link,
++ .get_ringparam = ieee80211_get_ringparam,
++ .set_ringparam = ieee80211_set_ringparam,
++ .get_strings = ieee80211_get_strings,
++ .get_ethtool_stats = ieee80211_get_stats,
++ .get_sset_count = ieee80211_get_sset_count,
++};
+--- a/net/mac80211/ibss.c
++++ b/net/mac80211/ibss.c
+@@ -143,7 +143,7 @@ ieee80211_ibss_build_presp(struct ieee80
+ *pos++ = csa_settings->block_tx ? 1 : 0;
+ *pos++ = ieee80211_frequency_to_channel(
+ csa_settings->chandef.chan->center_freq);
+- sdata->csa_counter_offset_beacon[0] = (pos - presp->head);
++ presp->csa_counter_offsets[0] = (pos - presp->head);
+ *pos++ = csa_settings->count;
+ }
+
+@@ -1677,6 +1677,7 @@ int ieee80211_ibss_join(struct ieee80211
+ sdata->u.ibss.control_port = params->control_port;
+ sdata->u.ibss.userspace_handles_dfs = params->userspace_handles_dfs;
+ sdata->u.ibss.basic_rates = params->basic_rates;
++ sdata->u.ibss.last_scan_completed = jiffies;
+
+ /* fix basic_rates if channel does not support these rates */
+ rate_flags = ieee80211_chandef_rate_flags(¶ms->chandef);
+--- a/net/mac80211/mesh.c
++++ b/net/mac80211/mesh.c
+@@ -679,7 +679,7 @@ ieee80211_mesh_build_beacon(struct ieee8
+ *pos++ = 0x0;
+ *pos++ = ieee80211_frequency_to_channel(
+ csa->settings.chandef.chan->center_freq);
+- sdata->csa_counter_offset_beacon[0] = hdr_len + 6;
++ bcn->csa_counter_offsets[0] = hdr_len + 6;
+ *pos++ = csa->settings.count;
+ *pos++ = WLAN_EID_CHAN_SWITCH_PARAM;
+ *pos++ = 6;
+--- a/net/wireless/genregdb.awk
++++ b/net/wireless/genregdb.awk
+@@ -65,17 +65,7 @@ function parse_reg_rule()
+ sub(/,/, "", units)
+ dfs_cac = $9
+ if (units == "mW") {
+- if (power == 100) {
+- power = 20
+- } else if (power == 200) {
+- power = 23
+- } else if (power == 500) {
+- power = 27
+- } else if (power == 1000) {
+- power = 30
+- } else {
+- print "Unknown power value in database!"
+- }
++ power = 10 * log(power)/log(10)