diff options
author | Alina Friedrichsen <x-alina@gmx.net> | 2009-01-25 09:28:28 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-01-29 16:01:46 -0500 |
commit | 08e87a833f5e77ff33b64c9ac27cb7fb9ecd4a48 (patch) | |
tree | 838a60f6de3c6b058ba7ab0caeee5edfda012a6d /drivers/net | |
parent | 3b5d665b51cda73ef1a774b515afd879a38e3674 (diff) |
b43: Accessing the TSF via mac80211
This allows the mac80211 high level code to access the TSF. This is e.g. needed for BSSID merges in the IBSS mode.
The second version adds locking and removes the now unnecessary debugfs entries.
Thanks to Michael Buesch! :)
Signed-off-by: Alina Friedrichsen <x-alina@gmx.net>
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/b43/debugfs.c | 31 | ||||
-rw-r--r-- | drivers/net/wireless/b43/debugfs.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/b43/main.c | 39 |
3 files changed, 39 insertions, 32 deletions
diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c index e04fc91f569e..7ed0eeeddeaa 100644 --- a/drivers/net/wireless/b43/debugfs.c +++ b/drivers/net/wireless/b43/debugfs.c | |||
@@ -367,34 +367,6 @@ static int mmio32write__write_file(struct b43_wldev *dev, | |||
367 | return 0; | 367 | return 0; |
368 | } | 368 | } |
369 | 369 | ||
370 | /* wl->irq_lock is locked */ | ||
371 | static ssize_t tsf_read_file(struct b43_wldev *dev, | ||
372 | char *buf, size_t bufsize) | ||
373 | { | ||
374 | ssize_t count = 0; | ||
375 | u64 tsf; | ||
376 | |||
377 | b43_tsf_read(dev, &tsf); | ||
378 | fappend("0x%08x%08x\n", | ||
379 | (unsigned int)((tsf & 0xFFFFFFFF00000000ULL) >> 32), | ||
380 | (unsigned int)(tsf & 0xFFFFFFFFULL)); | ||
381 | |||
382 | return count; | ||
383 | } | ||
384 | |||
385 | /* wl->irq_lock is locked */ | ||
386 | static int tsf_write_file(struct b43_wldev *dev, | ||
387 | const char *buf, size_t count) | ||
388 | { | ||
389 | u64 tsf; | ||
390 | |||
391 | if (sscanf(buf, "%llu", (unsigned long long *)(&tsf)) != 1) | ||
392 | return -EINVAL; | ||
393 | b43_tsf_write(dev, tsf); | ||
394 | |||
395 | return 0; | ||
396 | } | ||
397 | |||
398 | static ssize_t txstat_read_file(struct b43_wldev *dev, | 370 | static ssize_t txstat_read_file(struct b43_wldev *dev, |
399 | char *buf, size_t bufsize) | 371 | char *buf, size_t bufsize) |
400 | { | 372 | { |
@@ -691,7 +663,6 @@ B43_DEBUGFS_FOPS(mmio16read, mmio16read__read_file, mmio16read__write_file, 1); | |||
691 | B43_DEBUGFS_FOPS(mmio16write, NULL, mmio16write__write_file, 1); | 663 | B43_DEBUGFS_FOPS(mmio16write, NULL, mmio16write__write_file, 1); |
692 | B43_DEBUGFS_FOPS(mmio32read, mmio32read__read_file, mmio32read__write_file, 1); | 664 | B43_DEBUGFS_FOPS(mmio32read, mmio32read__read_file, mmio32read__write_file, 1); |
693 | B43_DEBUGFS_FOPS(mmio32write, NULL, mmio32write__write_file, 1); | 665 | B43_DEBUGFS_FOPS(mmio32write, NULL, mmio32write__write_file, 1); |
694 | B43_DEBUGFS_FOPS(tsf, tsf_read_file, tsf_write_file, 1); | ||
695 | B43_DEBUGFS_FOPS(txstat, txstat_read_file, NULL, 0); | 666 | B43_DEBUGFS_FOPS(txstat, txstat_read_file, NULL, 0); |
696 | B43_DEBUGFS_FOPS(restart, NULL, restart_write_file, 1); | 667 | B43_DEBUGFS_FOPS(restart, NULL, restart_write_file, 1); |
697 | B43_DEBUGFS_FOPS(loctls, loctls_read_file, NULL, 0); | 668 | B43_DEBUGFS_FOPS(loctls, loctls_read_file, NULL, 0); |
@@ -805,7 +776,6 @@ void b43_debugfs_add_device(struct b43_wldev *dev) | |||
805 | ADD_FILE(mmio16write, 0200); | 776 | ADD_FILE(mmio16write, 0200); |
806 | ADD_FILE(mmio32read, 0600); | 777 | ADD_FILE(mmio32read, 0600); |
807 | ADD_FILE(mmio32write, 0200); | 778 | ADD_FILE(mmio32write, 0200); |
808 | ADD_FILE(tsf, 0600); | ||
809 | ADD_FILE(txstat, 0400); | 779 | ADD_FILE(txstat, 0400); |
810 | ADD_FILE(restart, 0200); | 780 | ADD_FILE(restart, 0200); |
811 | ADD_FILE(loctls, 0400); | 781 | ADD_FILE(loctls, 0400); |
@@ -834,7 +804,6 @@ void b43_debugfs_remove_device(struct b43_wldev *dev) | |||
834 | debugfs_remove(e->file_mmio16write.dentry); | 804 | debugfs_remove(e->file_mmio16write.dentry); |
835 | debugfs_remove(e->file_mmio32read.dentry); | 805 | debugfs_remove(e->file_mmio32read.dentry); |
836 | debugfs_remove(e->file_mmio32write.dentry); | 806 | debugfs_remove(e->file_mmio32write.dentry); |
837 | debugfs_remove(e->file_tsf.dentry); | ||
838 | debugfs_remove(e->file_txstat.dentry); | 807 | debugfs_remove(e->file_txstat.dentry); |
839 | debugfs_remove(e->file_restart.dentry); | 808 | debugfs_remove(e->file_restart.dentry); |
840 | debugfs_remove(e->file_loctls.dentry); | 809 | debugfs_remove(e->file_loctls.dentry); |
diff --git a/drivers/net/wireless/b43/debugfs.h b/drivers/net/wireless/b43/debugfs.h index 7886cbe2d1d1..91a2f2918a2e 100644 --- a/drivers/net/wireless/b43/debugfs.h +++ b/drivers/net/wireless/b43/debugfs.h | |||
@@ -46,7 +46,6 @@ struct b43_dfsentry { | |||
46 | struct b43_dfs_file file_mmio16write; | 46 | struct b43_dfs_file file_mmio16write; |
47 | struct b43_dfs_file file_mmio32read; | 47 | struct b43_dfs_file file_mmio32read; |
48 | struct b43_dfs_file file_mmio32write; | 48 | struct b43_dfs_file file_mmio32write; |
49 | struct b43_dfs_file file_tsf; | ||
50 | struct b43_dfs_file file_txstat; | 49 | struct b43_dfs_file file_txstat; |
51 | struct b43_dfs_file file_txpower_g; | 50 | struct b43_dfs_file file_txpower_g; |
52 | struct b43_dfs_file file_restart; | 51 | struct b43_dfs_file file_restart; |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index cbb3d45f6fc9..e41c10fd31d3 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -3245,6 +3245,43 @@ static int b43_op_get_stats(struct ieee80211_hw *hw, | |||
3245 | return 0; | 3245 | return 0; |
3246 | } | 3246 | } |
3247 | 3247 | ||
3248 | static u64 b43_op_get_tsf(struct ieee80211_hw *hw) | ||
3249 | { | ||
3250 | struct b43_wl *wl = hw_to_b43_wl(hw); | ||
3251 | struct b43_wldev *dev; | ||
3252 | u64 tsf; | ||
3253 | |||
3254 | mutex_lock(&wl->mutex); | ||
3255 | spin_lock_irq(&wl->irq_lock); | ||
3256 | dev = wl->current_dev; | ||
3257 | |||
3258 | if (dev && (b43_status(dev) >= B43_STAT_INITIALIZED)) | ||
3259 | b43_tsf_read(dev, &tsf); | ||
3260 | else | ||
3261 | tsf = 0; | ||
3262 | |||
3263 | spin_unlock_irq(&wl->irq_lock); | ||
3264 | mutex_unlock(&wl->mutex); | ||
3265 | |||
3266 | return tsf; | ||
3267 | } | ||
3268 | |||
3269 | static void b43_op_set_tsf(struct ieee80211_hw *hw, u64 tsf) | ||
3270 | { | ||
3271 | struct b43_wl *wl = hw_to_b43_wl(hw); | ||
3272 | struct b43_wldev *dev; | ||
3273 | |||
3274 | mutex_lock(&wl->mutex); | ||
3275 | spin_lock_irq(&wl->irq_lock); | ||
3276 | dev = wl->current_dev; | ||
3277 | |||
3278 | if (dev && (b43_status(dev) >= B43_STAT_INITIALIZED)) | ||
3279 | b43_tsf_write(dev, tsf); | ||
3280 | |||
3281 | spin_unlock_irq(&wl->irq_lock); | ||
3282 | mutex_unlock(&wl->mutex); | ||
3283 | } | ||
3284 | |||
3248 | static void b43_put_phy_into_reset(struct b43_wldev *dev) | 3285 | static void b43_put_phy_into_reset(struct b43_wldev *dev) |
3249 | { | 3286 | { |
3250 | struct ssb_device *sdev = dev->dev; | 3287 | struct ssb_device *sdev = dev->dev; |
@@ -4364,6 +4401,8 @@ static const struct ieee80211_ops b43_hw_ops = { | |||
4364 | .set_key = b43_op_set_key, | 4401 | .set_key = b43_op_set_key, |
4365 | .get_stats = b43_op_get_stats, | 4402 | .get_stats = b43_op_get_stats, |
4366 | .get_tx_stats = b43_op_get_tx_stats, | 4403 | .get_tx_stats = b43_op_get_tx_stats, |
4404 | .get_tsf = b43_op_get_tsf, | ||
4405 | .set_tsf = b43_op_set_tsf, | ||
4367 | .start = b43_op_start, | 4406 | .start = b43_op_start, |
4368 | .stop = b43_op_stop, | 4407 | .stop = b43_op_stop, |
4369 | .set_tim = b43_op_beacon_set_tim, | 4408 | .set_tim = b43_op_beacon_set_tim, |