aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt61pci.c
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2008-03-25 09:13:18 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-03-25 16:42:00 -0400
commit3a643d244f09fa1fdd25d48a56a073c1a69583ee (patch)
tree3cd8423f72f37d66fdd2738409f72779da3911fc /drivers/net/wireless/rt2x00/rt61pci.c
parent866a05038481d77cac6fc0186250b4c44e691b42 (diff)
rt2x00: Fix in_atomic() usage
rt73usb and rt2500usb used in_atomic to determine if a configuration step should be rescheduled or not. Since in_atomic() is not a valid method to determine if sleeping is allowed we should fix the way this is handled by adding a new flag to rt2x00. In addition mark LED class support for the drivers broken since that also uses the broken in_atomic() method but so far no solution exists to have LED triggers work only in scheduled context. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt61pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c105
1 files changed, 35 insertions, 70 deletions
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 6e643c8db42e..0d2e6f7dd692 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -321,6 +321,37 @@ static void rt61pci_led_brightness(struct led_classdev *led_cdev,
321/* 321/*
322 * Configuration handlers. 322 * Configuration handlers.
323 */ 323 */
324static void rt61pci_config_filter(struct rt2x00_dev *rt2x00dev,
325 const unsigned int filter_flags)
326{
327 u32 reg;
328
329 /*
330 * Start configuration steps.
331 * Note that the version error will always be dropped
332 * and broadcast frames will always be accepted since
333 * there is no filter for it at this time.
334 */
335 rt2x00pci_register_read(rt2x00dev, TXRX_CSR0, &reg);
336 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CRC,
337 !(filter_flags & FIF_FCSFAIL));
338 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_PHYSICAL,
339 !(filter_flags & FIF_PLCPFAIL));
340 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL,
341 !(filter_flags & FIF_CONTROL));
342 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME,
343 !(filter_flags & FIF_PROMISC_IN_BSS));
344 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS,
345 !(filter_flags & FIF_PROMISC_IN_BSS));
346 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1);
347 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
348 !(filter_flags & FIF_ALLMULTI));
349 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_BROADCAST, 0);
350 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_ACK_CTS,
351 !(filter_flags & FIF_CONTROL));
352 rt2x00pci_register_write(rt2x00dev, TXRX_CSR0, reg);
353}
354
324static void rt61pci_config_intf(struct rt2x00_dev *rt2x00dev, 355static void rt61pci_config_intf(struct rt2x00_dev *rt2x00dev,
325 struct rt2x00_intf *intf, 356 struct rt2x00_intf *intf,
326 struct rt2x00intf_conf *conf, 357 struct rt2x00intf_conf *conf,
@@ -368,8 +399,8 @@ static void rt61pci_config_intf(struct rt2x00_dev *rt2x00dev,
368 } 399 }
369} 400}
370 401
371static int rt61pci_config_erp(struct rt2x00_dev *rt2x00dev, 402static void rt61pci_config_erp(struct rt2x00_dev *rt2x00dev,
372 struct rt2x00lib_erp *erp) 403 struct rt2x00lib_erp *erp)
373{ 404{
374 u32 reg; 405 u32 reg;
375 406
@@ -381,8 +412,6 @@ static int rt61pci_config_erp(struct rt2x00_dev *rt2x00dev,
381 rt2x00_set_field32(&reg, TXRX_CSR4_AUTORESPOND_PREAMBLE, 412 rt2x00_set_field32(&reg, TXRX_CSR4_AUTORESPOND_PREAMBLE,
382 !!erp->short_preamble); 413 !!erp->short_preamble);
383 rt2x00pci_register_write(rt2x00dev, TXRX_CSR4, reg); 414 rt2x00pci_register_write(rt2x00dev, TXRX_CSR4, reg);
384
385 return 0;
386} 415}
387 416
388static void rt61pci_config_phymode(struct rt2x00_dev *rt2x00dev, 417static void rt61pci_config_phymode(struct rt2x00_dev *rt2x00dev,
@@ -2284,71 +2313,6 @@ static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev)
2284/* 2313/*
2285 * IEEE80211 stack callback functions. 2314 * IEEE80211 stack callback functions.
2286 */ 2315 */
2287static void rt61pci_configure_filter(struct ieee80211_hw *hw,
2288 unsigned int changed_flags,
2289 unsigned int *total_flags,
2290 int mc_count,
2291 struct dev_addr_list *mc_list)
2292{
2293 struct rt2x00_dev *rt2x00dev = hw->priv;
2294 u32 reg;
2295
2296 /*
2297 * Mask off any flags we are going to ignore from
2298 * the total_flags field.
2299 */
2300 *total_flags &=
2301 FIF_ALLMULTI |
2302 FIF_FCSFAIL |
2303 FIF_PLCPFAIL |
2304 FIF_CONTROL |
2305 FIF_OTHER_BSS |
2306 FIF_PROMISC_IN_BSS;
2307
2308 /*
2309 * Apply some rules to the filters:
2310 * - Some filters imply different filters to be set.
2311 * - Some things we can't filter out at all.
2312 * - Multicast filter seems to kill broadcast traffic so never use it.
2313 */
2314 *total_flags |= FIF_ALLMULTI;
2315 if (*total_flags & FIF_OTHER_BSS ||
2316 *total_flags & FIF_PROMISC_IN_BSS)
2317 *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
2318
2319 /*
2320 * Check if there is any work left for us.
2321 */
2322 if (rt2x00dev->packet_filter == *total_flags)
2323 return;
2324 rt2x00dev->packet_filter = *total_flags;
2325
2326 /*
2327 * Start configuration steps.
2328 * Note that the version error will always be dropped
2329 * and broadcast frames will always be accepted since
2330 * there is no filter for it at this time.
2331 */
2332 rt2x00pci_register_read(rt2x00dev, TXRX_CSR0, &reg);
2333 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CRC,
2334 !(*total_flags & FIF_FCSFAIL));
2335 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_PHYSICAL,
2336 !(*total_flags & FIF_PLCPFAIL));
2337 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL,
2338 !(*total_flags & FIF_CONTROL));
2339 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME,
2340 !(*total_flags & FIF_PROMISC_IN_BSS));
2341 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS,
2342 !(*total_flags & FIF_PROMISC_IN_BSS));
2343 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1);
2344 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
2345 !(*total_flags & FIF_ALLMULTI));
2346 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_BROADCAST, 0);
2347 rt2x00_set_field32(&reg, TXRX_CSR0_DROP_ACK_CTS,
2348 !(*total_flags & FIF_CONTROL));
2349 rt2x00pci_register_write(rt2x00dev, TXRX_CSR0, reg);
2350}
2351
2352static int rt61pci_set_retry_limit(struct ieee80211_hw *hw, 2316static int rt61pci_set_retry_limit(struct ieee80211_hw *hw,
2353 u32 short_retry, u32 long_retry) 2317 u32 short_retry, u32 long_retry)
2354{ 2318{
@@ -2457,7 +2421,7 @@ static const struct ieee80211_ops rt61pci_mac80211_ops = {
2457 .remove_interface = rt2x00mac_remove_interface, 2421 .remove_interface = rt2x00mac_remove_interface,
2458 .config = rt2x00mac_config, 2422 .config = rt2x00mac_config,
2459 .config_interface = rt2x00mac_config_interface, 2423 .config_interface = rt2x00mac_config_interface,
2460 .configure_filter = rt61pci_configure_filter, 2424 .configure_filter = rt2x00mac_configure_filter,
2461 .get_stats = rt2x00mac_get_stats, 2425 .get_stats = rt2x00mac_get_stats,
2462 .set_retry_limit = rt61pci_set_retry_limit, 2426 .set_retry_limit = rt61pci_set_retry_limit,
2463 .bss_info_changed = rt2x00mac_bss_info_changed, 2427 .bss_info_changed = rt2x00mac_bss_info_changed,
@@ -2487,6 +2451,7 @@ static const struct rt2x00lib_ops rt61pci_rt2x00_ops = {
2487 .write_tx_data = rt2x00pci_write_tx_data, 2451 .write_tx_data = rt2x00pci_write_tx_data,
2488 .kick_tx_queue = rt61pci_kick_tx_queue, 2452 .kick_tx_queue = rt61pci_kick_tx_queue,
2489 .fill_rxdone = rt61pci_fill_rxdone, 2453 .fill_rxdone = rt61pci_fill_rxdone,
2454 .config_filter = rt61pci_config_filter,
2490 .config_intf = rt61pci_config_intf, 2455 .config_intf = rt61pci_config_intf,
2491 .config_erp = rt61pci_config_erp, 2456 .config_erp = rt61pci_config_erp,
2492 .config = rt61pci_config, 2457 .config = rt61pci_config,