aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEliad Peller <eliad@wizery.com>2011-09-21 07:06:11 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-09-27 14:27:48 -0400
commit37a41b4affa33bb237d3692bf51f1b5ebcaf29d8 (patch)
tree0201e166912d12bd8270b2117b11717756cfd5db
parent129321804e36721e71fadcab5b475bd37bf53044 (diff)
mac80211: add ieee80211_vif param to tsf functions
TSF can be kept per vif. Add ieee80211_vif param to set/get/reset_tsf, and move the debugfs entries to the per-vif directory. Update all the drivers that implement these callbacks. Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/adm8211.c3
-rw-r--r--drivers/net/wireless/ath/ath5k/mac80211-ops.c6
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_main.c9
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c8
-rw-r--r--drivers/net/wireless/ath/carl9170/main.c3
-rw-r--r--drivers/net/wireless/b43/main.c5
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-core.c3
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-core.h3
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c5
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c3
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.h2
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c2
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180/dev.c5
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187/dev.c2
-rw-r--r--drivers/net/wireless/rtlwifi/core.c8
-rw-r--r--drivers/net/wireless/wl12xx/main.c3
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.c2
-rw-r--r--drivers/staging/brcm80211/brcmsmac/mac80211_if.c12
-rw-r--r--drivers/staging/winbond/wbusb.c2
-rw-r--r--include/net/mac80211.h7
-rw-r--r--net/mac80211/debugfs.c52
-rw-r--r--net/mac80211/debugfs_netdev.c48
-rw-r--r--net/mac80211/driver-ops.h22
-rw-r--r--net/mac80211/driver-trace.h26
-rw-r--r--net/mac80211/ibss.c4
27 files changed, 137 insertions, 112 deletions
diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c
index 43ebc44fc82c..3b752d9fb3cd 100644
--- a/drivers/net/wireless/adm8211.c
+++ b/drivers/net/wireless/adm8211.c
@@ -1249,7 +1249,8 @@ static int adm8211_hw_reset(struct ieee80211_hw *dev)
1249 return 0; 1249 return 0;
1250} 1250}
1251 1251
1252static u64 adm8211_get_tsft(struct ieee80211_hw *dev) 1252static u64 adm8211_get_tsft(struct ieee80211_hw *dev,
1253 struct ieee80211_vif *vif)
1253{ 1254{
1254 struct adm8211_priv *priv = dev->priv; 1255 struct adm8211_priv *priv = dev->priv;
1255 u32 tsftl; 1256 u32 tsftl;
diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
index 0560234ec3f6..bba4f6fcf7e2 100644
--- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c
+++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
@@ -602,7 +602,7 @@ ath5k_conf_tx(struct ieee80211_hw *hw, u16 queue,
602 602
603 603
604static u64 604static u64
605ath5k_get_tsf(struct ieee80211_hw *hw) 605ath5k_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
606{ 606{
607 struct ath5k_hw *ah = hw->priv; 607 struct ath5k_hw *ah = hw->priv;
608 608
@@ -611,7 +611,7 @@ ath5k_get_tsf(struct ieee80211_hw *hw)
611 611
612 612
613static void 613static void
614ath5k_set_tsf(struct ieee80211_hw *hw, u64 tsf) 614ath5k_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u64 tsf)
615{ 615{
616 struct ath5k_hw *ah = hw->priv; 616 struct ath5k_hw *ah = hw->priv;
617 617
@@ -620,7 +620,7 @@ ath5k_set_tsf(struct ieee80211_hw *hw, u64 tsf)
620 620
621 621
622static void 622static void
623ath5k_reset_tsf(struct ieee80211_hw *hw) 623ath5k_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
624{ 624{
625 struct ath5k_hw *ah = hw->priv; 625 struct ath5k_hw *ah = hw->priv;
626 626
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 495fdf680a6c..17dbbd9d2f53 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1563,7 +1563,8 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw,
1563 mutex_unlock(&priv->mutex); 1563 mutex_unlock(&priv->mutex);
1564} 1564}
1565 1565
1566static u64 ath9k_htc_get_tsf(struct ieee80211_hw *hw) 1566static u64 ath9k_htc_get_tsf(struct ieee80211_hw *hw,
1567 struct ieee80211_vif *vif)
1567{ 1568{
1568 struct ath9k_htc_priv *priv = hw->priv; 1569 struct ath9k_htc_priv *priv = hw->priv;
1569 u64 tsf; 1570 u64 tsf;
@@ -1577,7 +1578,8 @@ static u64 ath9k_htc_get_tsf(struct ieee80211_hw *hw)
1577 return tsf; 1578 return tsf;
1578} 1579}
1579 1580
1580static void ath9k_htc_set_tsf(struct ieee80211_hw *hw, u64 tsf) 1581static void ath9k_htc_set_tsf(struct ieee80211_hw *hw,
1582 struct ieee80211_vif *vif, u64 tsf)
1581{ 1583{
1582 struct ath9k_htc_priv *priv = hw->priv; 1584 struct ath9k_htc_priv *priv = hw->priv;
1583 1585
@@ -1588,7 +1590,8 @@ static void ath9k_htc_set_tsf(struct ieee80211_hw *hw, u64 tsf)
1588 mutex_unlock(&priv->mutex); 1590 mutex_unlock(&priv->mutex);
1589} 1591}
1590 1592
1591static void ath9k_htc_reset_tsf(struct ieee80211_hw *hw) 1593static void ath9k_htc_reset_tsf(struct ieee80211_hw *hw,
1594 struct ieee80211_vif *vif)
1592{ 1595{
1593 struct ath9k_htc_priv *priv = hw->priv; 1596 struct ath9k_htc_priv *priv = hw->priv;
1594 1597
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index ee39702da5d8..fb803e209760 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -2143,7 +2143,7 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
2143 ath9k_ps_restore(sc); 2143 ath9k_ps_restore(sc);
2144} 2144}
2145 2145
2146static u64 ath9k_get_tsf(struct ieee80211_hw *hw) 2146static u64 ath9k_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
2147{ 2147{
2148 struct ath_softc *sc = hw->priv; 2148 struct ath_softc *sc = hw->priv;
2149 u64 tsf; 2149 u64 tsf;
@@ -2157,7 +2157,9 @@ static u64 ath9k_get_tsf(struct ieee80211_hw *hw)
2157 return tsf; 2157 return tsf;
2158} 2158}
2159 2159
2160static void ath9k_set_tsf(struct ieee80211_hw *hw, u64 tsf) 2160static void ath9k_set_tsf(struct ieee80211_hw *hw,
2161 struct ieee80211_vif *vif,
2162 u64 tsf)
2161{ 2163{
2162 struct ath_softc *sc = hw->priv; 2164 struct ath_softc *sc = hw->priv;
2163 2165
@@ -2168,7 +2170,7 @@ static void ath9k_set_tsf(struct ieee80211_hw *hw, u64 tsf)
2168 mutex_unlock(&sc->mutex); 2170 mutex_unlock(&sc->mutex);
2169} 2171}
2170 2172
2171static void ath9k_reset_tsf(struct ieee80211_hw *hw) 2173static void ath9k_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
2172{ 2174{
2173 struct ath_softc *sc = hw->priv; 2175 struct ath_softc *sc = hw->priv;
2174 2176
diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c
index af351ecd87c4..8b780d6d470f 100644
--- a/drivers/net/wireless/ath/carl9170/main.c
+++ b/drivers/net/wireless/ath/carl9170/main.c
@@ -1078,7 +1078,8 @@ out:
1078 mutex_unlock(&ar->mutex); 1078 mutex_unlock(&ar->mutex);
1079} 1079}
1080 1080
1081static u64 carl9170_op_get_tsf(struct ieee80211_hw *hw) 1081static u64 carl9170_op_get_tsf(struct ieee80211_hw *hw,
1082 struct ieee80211_vif *vif)
1082{ 1083{
1083 struct ar9170 *ar = hw->priv; 1084 struct ar9170 *ar = hw->priv;
1084 struct carl9170_tsf_rsp tsf; 1085 struct carl9170_tsf_rsp tsf;
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 56fa3a3648c4..559bcd6688ec 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -3599,7 +3599,7 @@ static int b43_op_get_stats(struct ieee80211_hw *hw,
3599 return 0; 3599 return 0;
3600} 3600}
3601 3601
3602static u64 b43_op_get_tsf(struct ieee80211_hw *hw) 3602static u64 b43_op_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
3603{ 3603{
3604 struct b43_wl *wl = hw_to_b43_wl(hw); 3604 struct b43_wl *wl = hw_to_b43_wl(hw);
3605 struct b43_wldev *dev; 3605 struct b43_wldev *dev;
@@ -3618,7 +3618,8 @@ static u64 b43_op_get_tsf(struct ieee80211_hw *hw)
3618 return tsf; 3618 return tsf;
3619} 3619}
3620 3620
3621static void b43_op_set_tsf(struct ieee80211_hw *hw, u64 tsf) 3621static void b43_op_set_tsf(struct ieee80211_hw *hw,
3622 struct ieee80211_vif *vif, u64 tsf)
3622{ 3623{
3623 struct b43_wl *wl = hw_to_b43_wl(hw); 3624 struct b43_wl *wl = hw_to_b43_wl(hw);
3624 struct b43_wldev *dev; 3625 struct b43_wldev *dev;
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c
index 35cd2537e7fd..c4921911c6d1 100644
--- a/drivers/net/wireless/iwlegacy/iwl-core.c
+++ b/drivers/net/wireless/iwlegacy/iwl-core.c
@@ -2220,7 +2220,8 @@ out:
2220} 2220}
2221EXPORT_SYMBOL(iwl_legacy_mac_config); 2221EXPORT_SYMBOL(iwl_legacy_mac_config);
2222 2222
2223void iwl_legacy_mac_reset_tsf(struct ieee80211_hw *hw) 2223void iwl_legacy_mac_reset_tsf(struct ieee80211_hw *hw,
2224 struct ieee80211_vif *vif)
2224{ 2225{
2225 struct iwl_priv *priv = hw->priv; 2226 struct iwl_priv *priv = hw->priv;
2226 unsigned long flags; 2227 unsigned long flags;
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.h b/drivers/net/wireless/iwlegacy/iwl-core.h
index 84da79376ef8..b2df01c8f8f5 100644
--- a/drivers/net/wireless/iwlegacy/iwl-core.h
+++ b/drivers/net/wireless/iwlegacy/iwl-core.h
@@ -620,7 +620,8 @@ static inline const struct ieee80211_supported_band *iwl_get_hw_mode(
620 620
621/* mac80211 handlers */ 621/* mac80211 handlers */
622int iwl_legacy_mac_config(struct ieee80211_hw *hw, u32 changed); 622int iwl_legacy_mac_config(struct ieee80211_hw *hw, u32 changed);
623void iwl_legacy_mac_reset_tsf(struct ieee80211_hw *hw); 623void iwl_legacy_mac_reset_tsf(struct ieee80211_hw *hw,
624 struct ieee80211_vif *vif);
624void iwl_legacy_mac_bss_info_changed(struct ieee80211_hw *hw, 625void iwl_legacy_mac_bss_info_changed(struct ieee80211_hw *hw,
625 struct ieee80211_vif *vif, 626 struct ieee80211_vif *vif,
626 struct ieee80211_bss_conf *bss_conf, 627 struct ieee80211_bss_conf *bss_conf,
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index daa32fc9398b..7e9272b8f01d 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -1239,7 +1239,7 @@ static void rt2400pci_fill_rxdone(struct queue_entry *entry,
1239 * call, we must decrease the higher 32bits with 1 to get 1239 * call, we must decrease the higher 32bits with 1 to get
1240 * to correct value. 1240 * to correct value.
1241 */ 1241 */
1242 tsf = rt2x00dev->ops->hw->get_tsf(rt2x00dev->hw); 1242 tsf = rt2x00dev->ops->hw->get_tsf(rt2x00dev->hw, NULL);
1243 rx_low = rt2x00_get_field32(word4, RXD_W4_RX_END_TIME); 1243 rx_low = rt2x00_get_field32(word4, RXD_W4_RX_END_TIME);
1244 rx_high = upper_32_bits(tsf); 1244 rx_high = upper_32_bits(tsf);
1245 1245
@@ -1673,7 +1673,8 @@ static int rt2400pci_conf_tx(struct ieee80211_hw *hw, u16 queue,
1673 return 0; 1673 return 0;
1674} 1674}
1675 1675
1676static u64 rt2400pci_get_tsf(struct ieee80211_hw *hw) 1676static u64 rt2400pci_get_tsf(struct ieee80211_hw *hw,
1677 struct ieee80211_vif *vif)
1677{ 1678{
1678 struct rt2x00_dev *rt2x00dev = hw->priv; 1679 struct rt2x00_dev *rt2x00dev = hw->priv;
1679 u64 tsf; 1680 u64 tsf;
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index b46c3b8866fa..dcc0e1fcca77 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -1966,7 +1966,8 @@ static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev)
1966/* 1966/*
1967 * IEEE80211 stack callback functions. 1967 * IEEE80211 stack callback functions.
1968 */ 1968 */
1969static u64 rt2500pci_get_tsf(struct ieee80211_hw *hw) 1969static u64 rt2500pci_get_tsf(struct ieee80211_hw *hw,
1970 struct ieee80211_vif *vif)
1970{ 1971{
1971 struct rt2x00_dev *rt2x00dev = hw->priv; 1972 struct rt2x00_dev *rt2x00dev = hw->priv;
1972 u64 tsf; 1973 u64 tsf;
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 31c98509f7e6..9688dd0a7ebd 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -4466,7 +4466,7 @@ int rt2800_conf_tx(struct ieee80211_hw *hw, u16 queue_idx,
4466} 4466}
4467EXPORT_SYMBOL_GPL(rt2800_conf_tx); 4467EXPORT_SYMBOL_GPL(rt2800_conf_tx);
4468 4468
4469u64 rt2800_get_tsf(struct ieee80211_hw *hw) 4469u64 rt2800_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
4470{ 4470{
4471 struct rt2x00_dev *rt2x00dev = hw->priv; 4471 struct rt2x00_dev *rt2x00dev = hw->priv;
4472 u64 tsf; 4472 u64 tsf;
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.h b/drivers/net/wireless/rt2x00/rt2800lib.h
index 7a2511f6785c..6de128e9c612 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.h
+++ b/drivers/net/wireless/rt2x00/rt2800lib.h
@@ -199,7 +199,7 @@ void rt2800_get_tkip_seq(struct ieee80211_hw *hw, u8 hw_key_idx, u32 *iv32,
199int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u32 value); 199int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u32 value);
200int rt2800_conf_tx(struct ieee80211_hw *hw, u16 queue_idx, 200int rt2800_conf_tx(struct ieee80211_hw *hw, u16 queue_idx,
201 const struct ieee80211_tx_queue_params *params); 201 const struct ieee80211_tx_queue_params *params);
202u64 rt2800_get_tsf(struct ieee80211_hw *hw); 202u64 rt2800_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
203int rt2800_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 203int rt2800_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
204 enum ieee80211_ampdu_mlme_action action, 204 enum ieee80211_ampdu_mlme_action action,
205 struct ieee80211_sta *sta, u16 tid, u16 *ssn, 205 struct ieee80211_sta *sta, u16 tid, u16 *ssn,
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 058ef4b19d1d..6b6a8e2dcddc 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2940,7 +2940,7 @@ static int rt61pci_conf_tx(struct ieee80211_hw *hw, u16 queue_idx,
2940 return 0; 2940 return 0;
2941} 2941}
2942 2942
2943static u64 rt61pci_get_tsf(struct ieee80211_hw *hw) 2943static u64 rt61pci_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
2944{ 2944{
2945 struct rt2x00_dev *rt2x00dev = hw->priv; 2945 struct rt2x00_dev *rt2x00dev = hw->priv;
2946 u64 tsf; 2946 u64 tsf;
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 0baeb894f093..6f51e39f5595 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -2279,7 +2279,7 @@ static int rt73usb_conf_tx(struct ieee80211_hw *hw, u16 queue_idx,
2279 return 0; 2279 return 0;
2280} 2280}
2281 2281
2282static u64 rt73usb_get_tsf(struct ieee80211_hw *hw) 2282static u64 rt73usb_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
2283{ 2283{
2284 struct rt2x00_dev *rt2x00dev = hw->priv; 2284 struct rt2x00_dev *rt2x00dev = hw->priv;
2285 u64 tsf; 2285 u64 tsf;
diff --git a/drivers/net/wireless/rtl818x/rtl8180/dev.c b/drivers/net/wireless/rtl818x/rtl8180/dev.c
index 66b29dc07cc3..0082015ff664 100644
--- a/drivers/net/wireless/rtl818x/rtl8180/dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8180/dev.c
@@ -669,7 +669,8 @@ static void rtl8180_stop(struct ieee80211_hw *dev)
669 rtl8180_free_tx_ring(dev, i); 669 rtl8180_free_tx_ring(dev, i);
670} 670}
671 671
672static u64 rtl8180_get_tsf(struct ieee80211_hw *dev) 672static u64 rtl8180_get_tsf(struct ieee80211_hw *dev,
673 struct ieee80211_vif *vif)
673{ 674{
674 struct rtl8180_priv *priv = dev->priv; 675 struct rtl8180_priv *priv = dev->priv;
675 676
@@ -701,7 +702,7 @@ static void rtl8180_beacon_work(struct work_struct *work)
701 * TODO: make hardware update beacon timestamp 702 * TODO: make hardware update beacon timestamp
702 */ 703 */
703 mgmt = (struct ieee80211_mgmt *)skb->data; 704 mgmt = (struct ieee80211_mgmt *)skb->data;
704 mgmt->u.beacon.timestamp = cpu_to_le64(rtl8180_get_tsf(dev)); 705 mgmt->u.beacon.timestamp = cpu_to_le64(rtl8180_get_tsf(dev, vif));
705 706
706 /* TODO: use actual beacon queue */ 707 /* TODO: use actual beacon queue */
707 skb_set_queue_mapping(skb, 0); 708 skb_set_queue_mapping(skb, 0);
diff --git a/drivers/net/wireless/rtl818x/rtl8187/dev.c b/drivers/net/wireless/rtl818x/rtl8187/dev.c
index 1e0be14d10d4..f5afa155ce91 100644
--- a/drivers/net/wireless/rtl818x/rtl8187/dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c
@@ -1277,7 +1277,7 @@ static int rtl8187_conf_tx(struct ieee80211_hw *dev, u16 queue,
1277 return 0; 1277 return 0;
1278} 1278}
1279 1279
1280static u64 rtl8187_get_tsf(struct ieee80211_hw *dev) 1280static u64 rtl8187_get_tsf(struct ieee80211_hw *dev, struct ieee80211_vif *vif)
1281{ 1281{
1282 struct rtl8187_priv *priv = dev->priv; 1282 struct rtl8187_priv *priv = dev->priv;
1283 1283
diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c
index 04c4e9eb6ee6..21e40f62a8d7 100644
--- a/drivers/net/wireless/rtlwifi/core.c
+++ b/drivers/net/wireless/rtlwifi/core.c
@@ -775,7 +775,7 @@ out:
775 mutex_unlock(&rtlpriv->locks.conf_mutex); 775 mutex_unlock(&rtlpriv->locks.conf_mutex);
776} 776}
777 777
778static u64 rtl_op_get_tsf(struct ieee80211_hw *hw) 778static u64 rtl_op_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
779{ 779{
780 struct rtl_priv *rtlpriv = rtl_priv(hw); 780 struct rtl_priv *rtlpriv = rtl_priv(hw);
781 u64 tsf; 781 u64 tsf;
@@ -784,7 +784,8 @@ static u64 rtl_op_get_tsf(struct ieee80211_hw *hw)
784 return tsf; 784 return tsf;
785} 785}
786 786
787static void rtl_op_set_tsf(struct ieee80211_hw *hw, u64 tsf) 787static void rtl_op_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
788 u64 tsf)
788{ 789{
789 struct rtl_priv *rtlpriv = rtl_priv(hw); 790 struct rtl_priv *rtlpriv = rtl_priv(hw);
790 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 791 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
@@ -794,7 +795,8 @@ static void rtl_op_set_tsf(struct ieee80211_hw *hw, u64 tsf)
794 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_CORRECT_TSF, (u8 *) (&bibss)); 795 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_CORRECT_TSF, (u8 *) (&bibss));
795} 796}
796 797
797static void rtl_op_reset_tsf(struct ieee80211_hw *hw) 798static void rtl_op_reset_tsf(struct ieee80211_hw *hw,
799 struct ieee80211_vif *vif)
798{ 800{
799 struct rtl_priv *rtlpriv = rtl_priv(hw); 801 struct rtl_priv *rtlpriv = rtl_priv(hw);
800 u8 tmp = 0; 802 u8 tmp = 0;
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index a51dd0ed6d2d..7d409b0f3357 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -3815,7 +3815,8 @@ out:
3815 return ret; 3815 return ret;
3816} 3816}
3817 3817
3818static u64 wl1271_op_get_tsf(struct ieee80211_hw *hw) 3818static u64 wl1271_op_get_tsf(struct ieee80211_hw *hw,
3819 struct ieee80211_vif *vif)
3819{ 3820{
3820 3821
3821 struct wl1271 *wl = hw->priv; 3822 struct wl1271 *wl = hw->priv;
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index cabfae1e70b1..0a70149df3fc 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -1332,7 +1332,7 @@ static void zd_op_bss_info_changed(struct ieee80211_hw *hw,
1332 } 1332 }
1333} 1333}
1334 1334
1335static u64 zd_op_get_tsf(struct ieee80211_hw *hw) 1335static u64 zd_op_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
1336{ 1336{
1337 struct zd_mac *mac = zd_hw_mac(hw); 1337 struct zd_mac *mac = zd_hw_mac(hw);
1338 return zd_chip_get_tsf(&mac->chip); 1338 return zd_chip_get_tsf(&mac->chip);
diff --git a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
index d6de44e430d3..315dd91800b6 100644
--- a/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/staging/brcm80211/brcmsmac/mac80211_if.c
@@ -133,7 +133,8 @@ static int brcms_ops_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
133 bool set); 133 bool set);
134static void brcms_ops_sw_scan_start(struct ieee80211_hw *hw); 134static void brcms_ops_sw_scan_start(struct ieee80211_hw *hw);
135static void brcms_ops_sw_scan_complete(struct ieee80211_hw *hw); 135static void brcms_ops_sw_scan_complete(struct ieee80211_hw *hw);
136static void brcms_ops_set_tsf(struct ieee80211_hw *hw, u64 tsf); 136static void brcms_ops_set_tsf(struct ieee80211_hw *hw,
137 struct ieee80211_vif *vif, u64 tsf);
137static int brcms_ops_get_stats(struct ieee80211_hw *hw, 138static int brcms_ops_get_stats(struct ieee80211_hw *hw,
138 struct ieee80211_low_level_stats *stats); 139 struct ieee80211_low_level_stats *stats);
139static void brcms_ops_sta_notify(struct ieee80211_hw *hw, 140static void brcms_ops_sta_notify(struct ieee80211_hw *hw,
@@ -142,7 +143,8 @@ static void brcms_ops_sta_notify(struct ieee80211_hw *hw,
142 struct ieee80211_sta *sta); 143 struct ieee80211_sta *sta);
143static int brcms_ops_conf_tx(struct ieee80211_hw *hw, u16 queue, 144static int brcms_ops_conf_tx(struct ieee80211_hw *hw, u16 queue,
144 const struct ieee80211_tx_queue_params *params); 145 const struct ieee80211_tx_queue_params *params);
145static u64 brcms_ops_get_tsf(struct ieee80211_hw *hw); 146static u64 brcms_ops_get_tsf(struct ieee80211_hw *hw,
147 struct ieee80211_vif *vif);
146static int brcms_ops_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 148static int brcms_ops_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
147 struct ieee80211_sta *sta); 149 struct ieee80211_sta *sta);
148static int brcms_ops_sta_remove(struct ieee80211_hw *hw, 150static int brcms_ops_sta_remove(struct ieee80211_hw *hw,
@@ -516,7 +518,8 @@ static void brcms_ops_sw_scan_complete(struct ieee80211_hw *hw)
516 return; 518 return;
517} 519}
518 520
519static void brcms_ops_set_tsf(struct ieee80211_hw *hw, u64 tsf) 521static void brcms_ops_set_tsf(struct ieee80211_hw *hw,
522 struct ieee80211_vif *vif, u64 tsf)
520{ 523{
521 wiphy_err(hw->wiphy, "%s: Enter\n", __func__); 524 wiphy_err(hw->wiphy, "%s: Enter\n", __func__);
522 return; 525 return;
@@ -565,7 +568,8 @@ brcms_ops_conf_tx(struct ieee80211_hw *hw, u16 queue,
565 return 0; 568 return 0;
566} 569}
567 570
568static u64 brcms_ops_get_tsf(struct ieee80211_hw *hw) 571static u64 brcms_ops_get_tsf(struct ieee80211_hw *hw,
572 struct ieee80211_vif *vif)
569{ 573{
570 wiphy_err(hw->wiphy, "%s: Enter\n", __func__); 574 wiphy_err(hw->wiphy, "%s: Enter\n", __func__);
571 return 0; 575 return 0;
diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c
index 3724e1e67ec2..a2e8bd452ed9 100644
--- a/drivers/staging/winbond/wbusb.c
+++ b/drivers/staging/winbond/wbusb.c
@@ -277,7 +277,7 @@ static int wbsoft_config(struct ieee80211_hw *dev, u32 changed)
277 return 0; 277 return 0;
278} 278}
279 279
280static u64 wbsoft_get_tsf(struct ieee80211_hw *dev) 280static u64 wbsoft_get_tsf(struct ieee80211_hw *dev, struct ieee80211_vif *vif)
281{ 281{
282 printk("wbsoft_get_tsf called\n"); 282 printk("wbsoft_get_tsf called\n");
283 return 0; 283 return 0;
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index c0f63fd0c52b..90dfcc99b466 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2000,9 +2000,10 @@ struct ieee80211_ops {
2000 enum sta_notify_cmd, struct ieee80211_sta *sta); 2000 enum sta_notify_cmd, struct ieee80211_sta *sta);
2001 int (*conf_tx)(struct ieee80211_hw *hw, u16 queue, 2001 int (*conf_tx)(struct ieee80211_hw *hw, u16 queue,
2002 const struct ieee80211_tx_queue_params *params); 2002 const struct ieee80211_tx_queue_params *params);
2003 u64 (*get_tsf)(struct ieee80211_hw *hw); 2003 u64 (*get_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
2004 void (*set_tsf)(struct ieee80211_hw *hw, u64 tsf); 2004 void (*set_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2005 void (*reset_tsf)(struct ieee80211_hw *hw); 2005 u64 tsf);
2006 void (*reset_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
2006 int (*tx_last_beacon)(struct ieee80211_hw *hw); 2007 int (*tx_last_beacon)(struct ieee80211_hw *hw);
2007 int (*ampdu_action)(struct ieee80211_hw *hw, 2008 int (*ampdu_action)(struct ieee80211_hw *hw,
2008 struct ieee80211_vif *vif, 2009 struct ieee80211_vif *vif,
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index c9141168fd43..883996b2f99f 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -78,57 +78,6 @@ DEBUGFS_READONLY_FILE(wep_iv, "%#08x",
78DEBUGFS_READONLY_FILE(rate_ctrl_alg, "%s", 78DEBUGFS_READONLY_FILE(rate_ctrl_alg, "%s",
79 local->rate_ctrl ? local->rate_ctrl->ops->name : "hw/driver"); 79 local->rate_ctrl ? local->rate_ctrl->ops->name : "hw/driver");
80 80
81static ssize_t tsf_read(struct file *file, char __user *user_buf,
82 size_t count, loff_t *ppos)
83{
84 struct ieee80211_local *local = file->private_data;
85 u64 tsf;
86
87 tsf = drv_get_tsf(local);
88
89 return mac80211_format_buffer(user_buf, count, ppos, "0x%016llx\n",
90 (unsigned long long) tsf);
91}
92
93static ssize_t tsf_write(struct file *file,
94 const char __user *user_buf,
95 size_t count, loff_t *ppos)
96{
97 struct ieee80211_local *local = file->private_data;
98 unsigned long long tsf;
99 char buf[100];
100 size_t len;
101
102 len = min(count, sizeof(buf) - 1);
103 if (copy_from_user(buf, user_buf, len))
104 return -EFAULT;
105 buf[len] = '\0';
106
107 if (strncmp(buf, "reset", 5) == 0) {
108 if (local->ops->reset_tsf) {
109 drv_reset_tsf(local);
110 wiphy_info(local->hw.wiphy, "debugfs reset TSF\n");
111 }
112 } else {
113 tsf = simple_strtoul(buf, NULL, 0);
114 if (local->ops->set_tsf) {
115 drv_set_tsf(local, tsf);
116 wiphy_info(local->hw.wiphy,
117 "debugfs set TSF to %#018llx\n", tsf);
118
119 }
120 }
121
122 return count;
123}
124
125static const struct file_operations tsf_ops = {
126 .read = tsf_read,
127 .write = tsf_write,
128 .open = mac80211_open_file_generic,
129 .llseek = default_llseek,
130};
131
132static ssize_t reset_write(struct file *file, const char __user *user_buf, 81static ssize_t reset_write(struct file *file, const char __user *user_buf,
133 size_t count, loff_t *ppos) 82 size_t count, loff_t *ppos)
134{ 83{
@@ -447,7 +396,6 @@ void debugfs_hw_add(struct ieee80211_local *local)
447 DEBUGFS_ADD(frequency); 396 DEBUGFS_ADD(frequency);
448 DEBUGFS_ADD(total_ps_buffered); 397 DEBUGFS_ADD(total_ps_buffered);
449 DEBUGFS_ADD(wep_iv); 398 DEBUGFS_ADD(wep_iv);
450 DEBUGFS_ADD(tsf);
451 DEBUGFS_ADD(queues); 399 DEBUGFS_ADD(queues);
452 DEBUGFS_ADD_MODE(reset, 0200); 400 DEBUGFS_ADD_MODE(reset, 0200);
453 DEBUGFS_ADD(noack); 401 DEBUGFS_ADD(noack);
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index dd0462917518..9352819a986b 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -21,6 +21,7 @@
21#include "rate.h" 21#include "rate.h"
22#include "debugfs.h" 22#include "debugfs.h"
23#include "debugfs_netdev.h" 23#include "debugfs_netdev.h"
24#include "driver-ops.h"
24 25
25static ssize_t ieee80211_if_read( 26static ssize_t ieee80211_if_read(
26 struct ieee80211_sub_if_data *sdata, 27 struct ieee80211_sub_if_data *sdata,
@@ -331,6 +332,46 @@ static ssize_t ieee80211_if_fmt_num_buffered_multicast(
331} 332}
332__IEEE80211_IF_FILE(num_buffered_multicast, NULL); 333__IEEE80211_IF_FILE(num_buffered_multicast, NULL);
333 334
335/* IBSS attributes */
336static ssize_t ieee80211_if_fmt_tsf(
337 const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
338{
339 struct ieee80211_local *local = sdata->local;
340 u64 tsf;
341
342 tsf = drv_get_tsf(local, (struct ieee80211_sub_if_data *)sdata);
343
344 return scnprintf(buf, buflen, "0x%016llx\n", (unsigned long long) tsf);
345}
346
347static ssize_t ieee80211_if_parse_tsf(
348 struct ieee80211_sub_if_data *sdata, const char *buf, int buflen)
349{
350 struct ieee80211_local *local = sdata->local;
351 unsigned long long tsf;
352 int ret;
353
354 if (strncmp(buf, "reset", 5) == 0) {
355 if (local->ops->reset_tsf) {
356 drv_reset_tsf(local, sdata);
357 wiphy_info(local->hw.wiphy, "debugfs reset TSF\n");
358 }
359 } else {
360 ret = kstrtoull(buf, 10, &tsf);
361 if (ret < 0)
362 return -EINVAL;
363 if (local->ops->set_tsf) {
364 drv_set_tsf(local, sdata, tsf);
365 wiphy_info(local->hw.wiphy,
366 "debugfs set TSF to %#018llx\n", tsf);
367 }
368 }
369
370 return buflen;
371}
372__IEEE80211_IF_FILE_W(tsf);
373
374
334/* WDS attributes */ 375/* WDS attributes */
335IEEE80211_IF_FILE(peer, u.wds.remote_addr, MAC); 376IEEE80211_IF_FILE(peer, u.wds.remote_addr, MAC);
336 377
@@ -421,6 +462,11 @@ static void add_ap_files(struct ieee80211_sub_if_data *sdata)
421 DEBUGFS_ADD_MODE(tkip_mic_test, 0200); 462 DEBUGFS_ADD_MODE(tkip_mic_test, 0200);
422} 463}
423 464
465static void add_ibss_files(struct ieee80211_sub_if_data *sdata)
466{
467 DEBUGFS_ADD_MODE(tsf, 0600);
468}
469
424static void add_wds_files(struct ieee80211_sub_if_data *sdata) 470static void add_wds_files(struct ieee80211_sub_if_data *sdata)
425{ 471{
426 DEBUGFS_ADD(drop_unencrypted); 472 DEBUGFS_ADD(drop_unencrypted);
@@ -515,7 +561,7 @@ static void add_files(struct ieee80211_sub_if_data *sdata)
515 add_sta_files(sdata); 561 add_sta_files(sdata);
516 break; 562 break;
517 case NL80211_IFTYPE_ADHOC: 563 case NL80211_IFTYPE_ADHOC:
518 /* XXX */ 564 add_ibss_files(sdata);
519 break; 565 break;
520 case NL80211_IFTYPE_AP: 566 case NL80211_IFTYPE_AP:
521 add_ap_files(sdata); 567 add_ap_files(sdata);
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 9001ff331f0a..5e5d97389bc9 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -427,36 +427,40 @@ static inline int drv_conf_tx(struct ieee80211_local *local, u16 queue,
427 return ret; 427 return ret;
428} 428}
429 429
430static inline u64 drv_get_tsf(struct ieee80211_local *local) 430static inline u64 drv_get_tsf(struct ieee80211_local *local,
431 struct ieee80211_sub_if_data *sdata)
431{ 432{
432 u64 ret = -1ULL; 433 u64 ret = -1ULL;
433 434
434 might_sleep(); 435 might_sleep();
435 436
436 trace_drv_get_tsf(local); 437 trace_drv_get_tsf(local, sdata);
437 if (local->ops->get_tsf) 438 if (local->ops->get_tsf)
438 ret = local->ops->get_tsf(&local->hw); 439 ret = local->ops->get_tsf(&local->hw, &sdata->vif);
439 trace_drv_return_u64(local, ret); 440 trace_drv_return_u64(local, ret);
440 return ret; 441 return ret;
441} 442}
442 443
443static inline void drv_set_tsf(struct ieee80211_local *local, u64 tsf) 444static inline void drv_set_tsf(struct ieee80211_local *local,
445 struct ieee80211_sub_if_data *sdata,
446 u64 tsf)
444{ 447{
445 might_sleep(); 448 might_sleep();
446 449
447 trace_drv_set_tsf(local, tsf); 450 trace_drv_set_tsf(local, sdata, tsf);
448 if (local->ops->set_tsf) 451 if (local->ops->set_tsf)
449 local->ops->set_tsf(&local->hw, tsf); 452 local->ops->set_tsf(&local->hw, &sdata->vif, tsf);
450 trace_drv_return_void(local); 453 trace_drv_return_void(local);
451} 454}
452 455
453static inline void drv_reset_tsf(struct ieee80211_local *local) 456static inline void drv_reset_tsf(struct ieee80211_local *local,
457 struct ieee80211_sub_if_data *sdata)
454{ 458{
455 might_sleep(); 459 might_sleep();
456 460
457 trace_drv_reset_tsf(local); 461 trace_drv_reset_tsf(local, sdata);
458 if (local->ops->reset_tsf) 462 if (local->ops->reset_tsf)
459 local->ops->reset_tsf(&local->hw); 463 local->ops->reset_tsf(&local->hw, &sdata->vif);
460 trace_drv_return_void(local); 464 trace_drv_return_void(local);
461} 465}
462 466
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h
index f47b00dc7afd..07d94ff55798 100644
--- a/net/mac80211/driver-trace.h
+++ b/net/mac80211/driver-trace.h
@@ -726,35 +726,41 @@ TRACE_EVENT(drv_conf_tx,
726 ) 726 )
727); 727);
728 728
729DEFINE_EVENT(local_only_evt, drv_get_tsf, 729DEFINE_EVENT(local_sdata_evt, drv_get_tsf,
730 TP_PROTO(struct ieee80211_local *local), 730 TP_PROTO(struct ieee80211_local *local,
731 TP_ARGS(local) 731 struct ieee80211_sub_if_data *sdata),
732 TP_ARGS(local, sdata)
732); 733);
733 734
734TRACE_EVENT(drv_set_tsf, 735TRACE_EVENT(drv_set_tsf,
735 TP_PROTO(struct ieee80211_local *local, u64 tsf), 736 TP_PROTO(struct ieee80211_local *local,
737 struct ieee80211_sub_if_data *sdata,
738 u64 tsf),
736 739
737 TP_ARGS(local, tsf), 740 TP_ARGS(local, sdata, tsf),
738 741
739 TP_STRUCT__entry( 742 TP_STRUCT__entry(
740 LOCAL_ENTRY 743 LOCAL_ENTRY
744 VIF_ENTRY
741 __field(u64, tsf) 745 __field(u64, tsf)
742 ), 746 ),
743 747
744 TP_fast_assign( 748 TP_fast_assign(
745 LOCAL_ASSIGN; 749 LOCAL_ASSIGN;
750 VIF_ASSIGN;
746 __entry->tsf = tsf; 751 __entry->tsf = tsf;
747 ), 752 ),
748 753
749 TP_printk( 754 TP_printk(
750 LOCAL_PR_FMT " tsf:%llu", 755 LOCAL_PR_FMT VIF_PR_FMT " tsf:%llu",
751 LOCAL_PR_ARG, (unsigned long long)__entry->tsf 756 LOCAL_PR_ARG, VIF_PR_ARG, (unsigned long long)__entry->tsf
752 ) 757 )
753); 758);
754 759
755DEFINE_EVENT(local_only_evt, drv_reset_tsf, 760DEFINE_EVENT(local_sdata_evt, drv_reset_tsf,
756 TP_PROTO(struct ieee80211_local *local), 761 TP_PROTO(struct ieee80211_local *local,
757 TP_ARGS(local) 762 struct ieee80211_sub_if_data *sdata),
763 TP_ARGS(local, sdata)
758); 764);
759 765
760DEFINE_EVENT(local_only_evt, drv_tx_last_beacon, 766DEFINE_EVENT(local_only_evt, drv_tx_last_beacon,
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 836b2752ecd6..7809895df8b0 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -81,7 +81,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
81 lockdep_assert_held(&ifibss->mtx); 81 lockdep_assert_held(&ifibss->mtx);
82 82
83 /* Reset own TSF to allow time synchronization work. */ 83 /* Reset own TSF to allow time synchronization work. */
84 drv_reset_tsf(local); 84 drv_reset_tsf(local, sdata);
85 85
86 skb = ifibss->skb; 86 skb = ifibss->skb;
87 rcu_assign_pointer(ifibss->presp, NULL); 87 rcu_assign_pointer(ifibss->presp, NULL);
@@ -382,7 +382,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
382 * second best option: get current TSF 382 * second best option: get current TSF
383 * (will return -1 if not supported) 383 * (will return -1 if not supported)
384 */ 384 */
385 rx_timestamp = drv_get_tsf(local); 385 rx_timestamp = drv_get_tsf(local, sdata);
386 } 386 }
387 387
388#ifdef CONFIG_MAC80211_IBSS_DEBUG 388#ifdef CONFIG_MAC80211_IBSS_DEBUG