aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ar9170
diff options
context:
space:
mode:
authorChristian Lamparter <chunkeey@web.de>2009-05-23 14:28:21 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-06-03 14:05:13 -0400
commit864cc02e7c0ed9a83be0c35c05df1941abcc792d (patch)
treea8480f206cd300447c1572d273285478737e7a2e /drivers/net/wireless/ath/ar9170
parent29ceff5d58afbb2c98bb748057788f02b8db20e5 (diff)
ar9170: use bitop macros for tx filter flags
This patch fixes a bug in configure_filter's (sub-)routines. We never really cleared the flags once we updated the hardware state, so we wasted our resources by applying already active settings. Signed-off-by: Christian Lamparter <chunkeey@web.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ar9170')
-rw-r--r--drivers/net/wireless/ath/ar9170/ar9170.h4
-rw-r--r--drivers/net/wireless/ath/ar9170/main.c24
2 files changed, 19 insertions, 9 deletions
diff --git a/drivers/net/wireless/ath/ar9170/ar9170.h b/drivers/net/wireless/ath/ar9170/ar9170.h
index 77dc64710273..1247dcb9081a 100644
--- a/drivers/net/wireless/ath/ar9170/ar9170.h
+++ b/drivers/net/wireless/ath/ar9170/ar9170.h
@@ -140,7 +140,7 @@ struct ar9170 {
140 struct work_struct filter_config_work; 140 struct work_struct filter_config_work;
141 u64 cur_mc_hash, want_mc_hash; 141 u64 cur_mc_hash, want_mc_hash;
142 u32 cur_filter, want_filter; 142 u32 cur_filter, want_filter;
143 unsigned int filter_changed; 143 unsigned long filter_changed;
144 unsigned int filter_state; 144 unsigned int filter_state;
145 bool sniffer_enabled; 145 bool sniffer_enabled;
146 146
@@ -195,7 +195,7 @@ struct ar9170_sta_info {
195#define IS_STARTED(a) (a->state >= AR9170_STARTED) 195#define IS_STARTED(a) (a->state >= AR9170_STARTED)
196#define IS_ACCEPTING_CMD(a) (a->state >= AR9170_IDLE) 196#define IS_ACCEPTING_CMD(a) (a->state >= AR9170_IDLE)
197 197
198#define AR9170_FILTER_CHANGED_PROMISC BIT(0) 198#define AR9170_FILTER_CHANGED_MODE BIT(0)
199#define AR9170_FILTER_CHANGED_MULTICAST BIT(1) 199#define AR9170_FILTER_CHANGED_MULTICAST BIT(1)
200#define AR9170_FILTER_CHANGED_FRAMEFILTER BIT(2) 200#define AR9170_FILTER_CHANGED_FRAMEFILTER BIT(2)
201 201
diff --git a/drivers/net/wireless/ath/ar9170/main.c b/drivers/net/wireless/ath/ar9170/main.c
index c54c42e5391f..201989ad0e25 100644
--- a/drivers/net/wireless/ath/ar9170/main.c
+++ b/drivers/net/wireless/ath/ar9170/main.c
@@ -957,6 +957,8 @@ static int ar9170_op_start(struct ieee80211_hw *hw)
957 957
958 mutex_lock(&ar->mutex); 958 mutex_lock(&ar->mutex);
959 959
960 ar->filter_changed = 0;
961
960 /* reinitialize queues statistics */ 962 /* reinitialize queues statistics */
961 memset(&ar->tx_stats, 0, sizeof(ar->tx_stats)); 963 memset(&ar->tx_stats, 0, sizeof(ar->tx_stats));
962 for (i = 0; i < ARRAY_SIZE(ar->tx_stats); i++) 964 for (i = 0; i < ARRAY_SIZE(ar->tx_stats); i++)
@@ -1376,20 +1378,26 @@ static void ar9170_set_filters(struct work_struct *work)
1376 return ; 1378 return ;
1377 1379
1378 mutex_lock(&ar->mutex); 1380 mutex_lock(&ar->mutex);
1379 if (ar->filter_changed & AR9170_FILTER_CHANGED_PROMISC) { 1381 if (test_and_clear_bit(AR9170_FILTER_CHANGED_MODE,
1382 &ar->filter_changed)) {
1380 err = ar9170_set_operating_mode(ar); 1383 err = ar9170_set_operating_mode(ar);
1381 if (err) 1384 if (err)
1382 goto unlock; 1385 goto unlock;
1383 } 1386 }
1384 1387
1385 if (ar->filter_changed & AR9170_FILTER_CHANGED_MULTICAST) { 1388 if (test_and_clear_bit(AR9170_FILTER_CHANGED_MULTICAST,
1389 &ar->filter_changed)) {
1386 err = ar9170_update_multicast(ar); 1390 err = ar9170_update_multicast(ar);
1387 if (err) 1391 if (err)
1388 goto unlock; 1392 goto unlock;
1389 } 1393 }
1390 1394
1391 if (ar->filter_changed & AR9170_FILTER_CHANGED_FRAMEFILTER) 1395 if (test_and_clear_bit(AR9170_FILTER_CHANGED_FRAMEFILTER,
1396 &ar->filter_changed)) {
1392 err = ar9170_update_frame_filter(ar); 1397 err = ar9170_update_frame_filter(ar);
1398 if (err)
1399 goto unlock;
1400 }
1393 1401
1394unlock: 1402unlock:
1395 mutex_unlock(&ar->mutex); 1403 mutex_unlock(&ar->mutex);
@@ -1419,7 +1427,7 @@ static void ar9170_op_configure_filter(struct ieee80211_hw *hw,
1419 int i; 1427 int i;
1420 1428
1421 /* always get broadcast frames */ 1429 /* always get broadcast frames */
1422 mchash = 1ULL << (0xff>>2); 1430 mchash = 1ULL << (0xff >> 2);
1423 1431
1424 for (i = 0; i < mc_count; i++) { 1432 for (i = 0; i < mc_count; i++) {
1425 if (WARN_ON(!mclist)) 1433 if (WARN_ON(!mclist))
@@ -1429,7 +1437,7 @@ static void ar9170_op_configure_filter(struct ieee80211_hw *hw,
1429 } 1437 }
1430 ar->want_mc_hash = mchash; 1438 ar->want_mc_hash = mchash;
1431 } 1439 }
1432 ar->filter_changed |= AR9170_FILTER_CHANGED_MULTICAST; 1440 set_bit(AR9170_FILTER_CHANGED_MULTICAST, &ar->filter_changed);
1433 } 1441 }
1434 1442
1435 if (changed_flags & FIF_CONTROL) { 1443 if (changed_flags & FIF_CONTROL) {
@@ -1445,12 +1453,14 @@ static void ar9170_op_configure_filter(struct ieee80211_hw *hw,
1445 else 1453 else
1446 ar->want_filter = ar->cur_filter & ~filter; 1454 ar->want_filter = ar->cur_filter & ~filter;
1447 1455
1448 ar->filter_changed |= AR9170_FILTER_CHANGED_FRAMEFILTER; 1456 set_bit(AR9170_FILTER_CHANGED_FRAMEFILTER,
1457 &ar->filter_changed);
1449 } 1458 }
1450 1459
1451 if (changed_flags & FIF_PROMISC_IN_BSS) { 1460 if (changed_flags & FIF_PROMISC_IN_BSS) {
1452 ar->sniffer_enabled = ((*new_flags) & FIF_PROMISC_IN_BSS) != 0; 1461 ar->sniffer_enabled = ((*new_flags) & FIF_PROMISC_IN_BSS) != 0;
1453 ar->filter_changed |= AR9170_FILTER_CHANGED_PROMISC; 1462 set_bit(AR9170_FILTER_CHANGED_MODE,
1463 &ar->filter_changed);
1454 } 1464 }
1455 1465
1456 if (likely(IS_STARTED(ar))) 1466 if (likely(IS_STARTED(ar)))