3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 #include <linux/netdevice.h>
19 #include <linux/etherdevice.h>
20 #include <linux/wireless.h>
21 #include <linux/usb.h>
22 #include <linux/jiffies.h>
23 #include <net/ieee80211_radiotap.h>
28 #include "zd_ieee80211.h"
29 #include "zd_netdev.h"
33 static void ieee_init(struct ieee80211_device
*ieee
);
34 static void softmac_init(struct ieee80211softmac_device
*sm
);
35 static void set_rts_cts_work(struct work_struct
*work
);
36 static void set_basic_rates_work(struct work_struct
*work
);
38 static void housekeeping_init(struct zd_mac
*mac
);
39 static void housekeeping_enable(struct zd_mac
*mac
);
40 static void housekeeping_disable(struct zd_mac
*mac
);
42 static void set_multicast_hash_handler(struct work_struct
*work
);
44 static void do_rx(unsigned long mac_ptr
);
46 int zd_mac_init(struct zd_mac
*mac
,
47 struct net_device
*netdev
,
48 struct usb_interface
*intf
)
50 struct ieee80211_device
*ieee
= zd_netdev_ieee80211(netdev
);
52 memset(mac
, 0, sizeof(*mac
));
53 spin_lock_init(&mac
->lock
);
55 INIT_DELAYED_WORK(&mac
->set_rts_cts_work
, set_rts_cts_work
);
56 INIT_DELAYED_WORK(&mac
->set_basic_rates_work
, set_basic_rates_work
);
58 skb_queue_head_init(&mac
->rx_queue
);
59 tasklet_init(&mac
->rx_tasklet
, do_rx
, (unsigned long)mac
);
60 tasklet_disable(&mac
->rx_tasklet
);
63 softmac_init(ieee80211_priv(netdev
));
64 zd_chip_init(&mac
->chip
, netdev
, intf
);
65 housekeeping_init(mac
);
66 INIT_WORK(&mac
->set_multicast_hash_work
, set_multicast_hash_handler
);
70 static int reset_channel(struct zd_mac
*mac
)
74 const struct channel_range
*range
;
76 spin_lock_irqsave(&mac
->lock
, flags
);
77 range
= zd_channel_range(mac
->regdomain
);
82 mac
->requested_channel
= range
->start
;
85 spin_unlock_irqrestore(&mac
->lock
, flags
);
89 int zd_mac_init_hw(struct zd_mac
*mac
, u8 device_type
)
92 struct zd_chip
*chip
= &mac
->chip
;
96 r
= zd_chip_enable_int(chip
);
99 r
= zd_chip_init_hw(chip
, device_type
);
103 zd_get_e2p_mac_addr(chip
, addr
);
104 r
= zd_write_mac_addr(chip
, addr
);
107 ZD_ASSERT(!irqs_disabled());
108 spin_lock_irq(&mac
->lock
);
109 memcpy(mac
->netdev
->dev_addr
, addr
, ETH_ALEN
);
110 spin_unlock_irq(&mac
->lock
);
112 r
= zd_read_regdomain(chip
, &default_regdomain
);
115 if (!zd_regdomain_supported(default_regdomain
)) {
116 /* The vendor driver overrides the regulatory domain and
117 * allowed channel registers and unconditionally restricts
118 * available channels to 1-11 everywhere. Match their
119 * questionable behaviour only for regdomains which we don't
121 dev_warn(zd_mac_dev(mac
), "Unrecognised regulatory domain: "
122 "%#04x. Defaulting to FCC.\n", default_regdomain
);
123 default_regdomain
= ZD_REGDOMAIN_FCC
;
125 spin_lock_irq(&mac
->lock
);
126 mac
->regdomain
= mac
->default_regdomain
= default_regdomain
;
127 spin_unlock_irq(&mac
->lock
);
128 r
= reset_channel(mac
);
132 /* We must inform the device that we are doing encryption/decryption in
133 * software at the moment. */
134 r
= zd_set_encryption_type(chip
, ENC_SNIFFER
);
138 r
= zd_geo_init(zd_mac_to_ieee80211(mac
), mac
->regdomain
);
144 zd_chip_disable_int(chip
);
149 void zd_mac_clear(struct zd_mac
*mac
)
151 flush_workqueue(zd_workqueue
);
152 skb_queue_purge(&mac
->rx_queue
);
153 tasklet_kill(&mac
->rx_tasklet
);
154 zd_chip_clear(&mac
->chip
);
155 ZD_ASSERT(!spin_is_locked(&mac
->lock
));
156 ZD_MEMCLEAR(mac
, sizeof(struct zd_mac
));
159 static int reset_mode(struct zd_mac
*mac
)
161 struct ieee80211_device
*ieee
= zd_mac_to_ieee80211(mac
);
162 u32 filter
= (ieee
->iw_mode
== IW_MODE_MONITOR
) ? ~0 : STA_RX_FILTER
;
163 return zd_iowrite32(&mac
->chip
, CR_RX_FILTER
, filter
);
166 int zd_mac_open(struct net_device
*netdev
)
168 struct zd_mac
*mac
= zd_netdev_mac(netdev
);
169 struct zd_chip
*chip
= &mac
->chip
;
172 tasklet_enable(&mac
->rx_tasklet
);
174 r
= zd_chip_enable_int(chip
);
178 r
= zd_chip_set_basic_rates(chip
, CR_RATES_80211B
| CR_RATES_80211G
);
184 r
= zd_chip_switch_radio_on(chip
);
187 r
= zd_chip_set_channel(chip
, mac
->requested_channel
);
190 r
= zd_chip_enable_rx(chip
);
193 r
= zd_chip_enable_hwint(chip
);
197 housekeeping_enable(mac
);
198 ieee80211softmac_start(netdev
);
201 zd_chip_disable_rx(chip
);
203 zd_chip_switch_radio_off(chip
);
205 zd_chip_disable_int(chip
);
210 int zd_mac_stop(struct net_device
*netdev
)
212 struct zd_mac
*mac
= zd_netdev_mac(netdev
);
213 struct zd_chip
*chip
= &mac
->chip
;
215 netif_stop_queue(netdev
);
218 * The order here deliberately is a little different from the open()
219 * method, since we need to make sure there is no opportunity for RX
220 * frames to be processed by softmac after we have stopped it.
223 zd_chip_disable_rx(chip
);
224 skb_queue_purge(&mac
->rx_queue
);
225 tasklet_disable(&mac
->rx_tasklet
);
226 housekeeping_disable(mac
);
227 ieee80211softmac_stop(netdev
);
229 /* Ensure no work items are running or queued from this point */
230 cancel_delayed_work(&mac
->set_rts_cts_work
);
231 cancel_delayed_work(&mac
->set_basic_rates_work
);
232 flush_workqueue(zd_workqueue
);
233 mac
->updating_rts_rate
= 0;
234 mac
->updating_basic_rates
= 0;
236 zd_chip_disable_hwint(chip
);
237 zd_chip_switch_radio_off(chip
);
238 zd_chip_disable_int(chip
);
243 int zd_mac_set_mac_address(struct net_device
*netdev
, void *p
)
247 struct sockaddr
*addr
= p
;
248 struct zd_mac
*mac
= zd_netdev_mac(netdev
);
249 struct zd_chip
*chip
= &mac
->chip
;
251 if (!is_valid_ether_addr(addr
->sa_data
))
252 return -EADDRNOTAVAIL
;
254 dev_dbg_f(zd_mac_dev(mac
),
255 "Setting MAC to " MAC_FMT
"\n", MAC_ARG(addr
->sa_data
));
257 r
= zd_write_mac_addr(chip
, addr
->sa_data
);
261 spin_lock_irqsave(&mac
->lock
, flags
);
262 memcpy(netdev
->dev_addr
, addr
->sa_data
, ETH_ALEN
);
263 spin_unlock_irqrestore(&mac
->lock
, flags
);
268 static void set_multicast_hash_handler(struct work_struct
*work
)
270 struct zd_mac
*mac
= container_of(work
, struct zd_mac
,
271 set_multicast_hash_work
);
272 struct zd_mc_hash hash
;
274 spin_lock_irq(&mac
->lock
);
275 hash
= mac
->multicast_hash
;
276 spin_unlock_irq(&mac
->lock
);
278 zd_chip_set_multicast_hash(&mac
->chip
, &hash
);
281 void zd_mac_set_multicast_list(struct net_device
*dev
)
283 struct zd_mc_hash hash
;
284 struct zd_mac
*mac
= zd_netdev_mac(dev
);
285 struct dev_mc_list
*mc
;
288 if (dev
->flags
& (IFF_PROMISC
|IFF_ALLMULTI
)) {
289 zd_mc_add_all(&hash
);
292 for (mc
= dev
->mc_list
; mc
; mc
= mc
->next
) {
293 dev_dbg_f(zd_mac_dev(mac
), "mc addr " MAC_FMT
"\n",
294 MAC_ARG(mc
->dmi_addr
));
295 zd_mc_add_addr(&hash
, mc
->dmi_addr
);
299 spin_lock_irqsave(&mac
->lock
, flags
);
300 mac
->multicast_hash
= hash
;
301 spin_unlock_irqrestore(&mac
->lock
, flags
);
302 queue_work(zd_workqueue
, &mac
->set_multicast_hash_work
);
305 int zd_mac_set_regdomain(struct zd_mac
*mac
, u8 regdomain
)
310 ZD_ASSERT(!irqs_disabled());
311 spin_lock_irq(&mac
->lock
);
312 if (regdomain
== 0) {
313 regdomain
= mac
->default_regdomain
;
315 if (!zd_regdomain_supported(regdomain
)) {
316 spin_unlock_irq(&mac
->lock
);
319 mac
->regdomain
= regdomain
;
320 channel
= mac
->requested_channel
;
321 spin_unlock_irq(&mac
->lock
);
323 r
= zd_geo_init(zd_mac_to_ieee80211(mac
), regdomain
);
326 if (!zd_regdomain_supports_channel(regdomain
, channel
)) {
327 r
= reset_channel(mac
);
335 u8
zd_mac_get_regdomain(struct zd_mac
*mac
)
340 spin_lock_irqsave(&mac
->lock
, flags
);
341 regdomain
= mac
->regdomain
;
342 spin_unlock_irqrestore(&mac
->lock
, flags
);
346 /* Fallback to lowest rate, if rate is unknown. */
347 static u8
rate_to_zd_rate(u8 rate
)
350 case IEEE80211_CCK_RATE_2MB
:
351 return ZD_CCK_RATE_2M
;
352 case IEEE80211_CCK_RATE_5MB
:
353 return ZD_CCK_RATE_5_5M
;
354 case IEEE80211_CCK_RATE_11MB
:
355 return ZD_CCK_RATE_11M
;
356 case IEEE80211_OFDM_RATE_6MB
:
357 return ZD_OFDM_RATE_6M
;
358 case IEEE80211_OFDM_RATE_9MB
:
359 return ZD_OFDM_RATE_9M
;
360 case IEEE80211_OFDM_RATE_12MB
:
361 return ZD_OFDM_RATE_12M
;
362 case IEEE80211_OFDM_RATE_18MB
:
363 return ZD_OFDM_RATE_18M
;
364 case IEEE80211_OFDM_RATE_24MB
:
365 return ZD_OFDM_RATE_24M
;
366 case IEEE80211_OFDM_RATE_36MB
:
367 return ZD_OFDM_RATE_36M
;
368 case IEEE80211_OFDM_RATE_48MB
:
369 return ZD_OFDM_RATE_48M
;
370 case IEEE80211_OFDM_RATE_54MB
:
371 return ZD_OFDM_RATE_54M
;
373 return ZD_CCK_RATE_1M
;
376 static u16
rate_to_cr_rate(u8 rate
)
379 case IEEE80211_CCK_RATE_2MB
:
381 case IEEE80211_CCK_RATE_5MB
:
383 case IEEE80211_CCK_RATE_11MB
:
385 case IEEE80211_OFDM_RATE_6MB
:
387 case IEEE80211_OFDM_RATE_9MB
:
389 case IEEE80211_OFDM_RATE_12MB
:
391 case IEEE80211_OFDM_RATE_18MB
:
393 case IEEE80211_OFDM_RATE_24MB
:
395 case IEEE80211_OFDM_RATE_36MB
:
397 case IEEE80211_OFDM_RATE_48MB
:
399 case IEEE80211_OFDM_RATE_54MB
:
405 static void try_enable_tx(struct zd_mac
*mac
)
409 spin_lock_irqsave(&mac
->lock
, flags
);
410 if (mac
->updating_rts_rate
== 0 && mac
->updating_basic_rates
== 0)
411 netif_wake_queue(mac
->netdev
);
412 spin_unlock_irqrestore(&mac
->lock
, flags
);
415 static void set_rts_cts_work(struct work_struct
*work
)
418 container_of(work
, struct zd_mac
, set_rts_cts_work
.work
);
421 unsigned int short_preamble
;
423 mutex_lock(&mac
->chip
.mutex
);
425 spin_lock_irqsave(&mac
->lock
, flags
);
426 mac
->updating_rts_rate
= 0;
427 rts_rate
= mac
->rts_rate
;
428 short_preamble
= mac
->short_preamble
;
429 spin_unlock_irqrestore(&mac
->lock
, flags
);
431 zd_chip_set_rts_cts_rate_locked(&mac
->chip
, rts_rate
, short_preamble
);
432 mutex_unlock(&mac
->chip
.mutex
);
437 static void set_basic_rates_work(struct work_struct
*work
)
440 container_of(work
, struct zd_mac
, set_basic_rates_work
.work
);
444 mutex_lock(&mac
->chip
.mutex
);
446 spin_lock_irqsave(&mac
->lock
, flags
);
447 mac
->updating_basic_rates
= 0;
448 basic_rates
= mac
->basic_rates
;
449 spin_unlock_irqrestore(&mac
->lock
, flags
);
451 zd_chip_set_basic_rates_locked(&mac
->chip
, basic_rates
);
452 mutex_unlock(&mac
->chip
.mutex
);
457 static void bssinfo_change(struct net_device
*netdev
, u32 changes
)
459 struct zd_mac
*mac
= zd_netdev_mac(netdev
);
460 struct ieee80211softmac_device
*softmac
= ieee80211_priv(netdev
);
461 struct ieee80211softmac_bss_info
*bssinfo
= &softmac
->bssinfo
;
462 int need_set_rts_cts
= 0;
463 int need_set_rates
= 0;
467 dev_dbg_f(zd_mac_dev(mac
), "changes: %x\n", changes
);
469 if (changes
& IEEE80211SOFTMAC_BSSINFOCHG_SHORT_PREAMBLE
) {
470 spin_lock_irqsave(&mac
->lock
, flags
);
471 mac
->short_preamble
= bssinfo
->short_preamble
;
472 spin_unlock_irqrestore(&mac
->lock
, flags
);
473 need_set_rts_cts
= 1;
476 if (changes
& IEEE80211SOFTMAC_BSSINFOCHG_RATES
) {
477 /* Set RTS rate to highest available basic rate */
478 u8 hi_rate
= ieee80211softmac_highest_supported_rate(softmac
,
479 &bssinfo
->supported_rates
, 1);
480 hi_rate
= rate_to_zd_rate(hi_rate
);
482 spin_lock_irqsave(&mac
->lock
, flags
);
483 if (hi_rate
!= mac
->rts_rate
) {
484 mac
->rts_rate
= hi_rate
;
485 need_set_rts_cts
= 1;
487 spin_unlock_irqrestore(&mac
->lock
, flags
);
489 /* Set basic rates */
491 if (bssinfo
->supported_rates
.count
== 0) {
492 /* Allow the device to be flexible */
493 basic_rates
= CR_RATES_80211B
| CR_RATES_80211G
;
498 for (i
= 0; i
< bssinfo
->supported_rates
.count
; i
++) {
499 u16 rate
= bssinfo
->supported_rates
.rates
[i
];
500 if ((rate
& IEEE80211_BASIC_RATE_MASK
) == 0)
503 rate
&= ~IEEE80211_BASIC_RATE_MASK
;
504 basic_rates
|= rate_to_cr_rate(rate
);
507 spin_lock_irqsave(&mac
->lock
, flags
);
508 mac
->basic_rates
= basic_rates
;
509 spin_unlock_irqrestore(&mac
->lock
, flags
);
512 /* Schedule any changes we made above */
514 spin_lock_irqsave(&mac
->lock
, flags
);
515 if (need_set_rts_cts
&& !mac
->updating_rts_rate
) {
516 mac
->updating_rts_rate
= 1;
517 netif_stop_queue(mac
->netdev
);
518 queue_delayed_work(zd_workqueue
, &mac
->set_rts_cts_work
, 0);
520 if (need_set_rates
&& !mac
->updating_basic_rates
) {
521 mac
->updating_basic_rates
= 1;
522 netif_stop_queue(mac
->netdev
);
523 queue_delayed_work(zd_workqueue
, &mac
->set_basic_rates_work
,
526 spin_unlock_irqrestore(&mac
->lock
, flags
);
529 static void set_channel(struct net_device
*netdev
, u8 channel
)
531 struct zd_mac
*mac
= zd_netdev_mac(netdev
);
533 dev_dbg_f(zd_mac_dev(mac
), "channel %d\n", channel
);
535 zd_chip_set_channel(&mac
->chip
, channel
);
538 int zd_mac_request_channel(struct zd_mac
*mac
, u8 channel
)
540 unsigned long lock_flags
;
541 struct ieee80211_device
*ieee
= zd_mac_to_ieee80211(mac
);
543 if (ieee
->iw_mode
== IW_MODE_INFRA
)
546 spin_lock_irqsave(&mac
->lock
, lock_flags
);
547 if (!zd_regdomain_supports_channel(mac
->regdomain
, channel
)) {
548 spin_unlock_irqrestore(&mac
->lock
, lock_flags
);
551 mac
->requested_channel
= channel
;
552 spin_unlock_irqrestore(&mac
->lock
, lock_flags
);
553 if (netif_running(mac
->netdev
))
554 return zd_chip_set_channel(&mac
->chip
, channel
);
559 u8
zd_mac_get_channel(struct zd_mac
*mac
)
561 u8 channel
= zd_chip_get_channel(&mac
->chip
);
563 dev_dbg_f(zd_mac_dev(mac
), "channel %u\n", channel
);
567 /* If wrong rate is given, we are falling back to the slowest rate: 1MBit/s */
568 static u8
zd_rate_typed(u8 zd_rate
)
570 static const u8 typed_rates
[16] = {
571 [ZD_CCK_RATE_1M
] = ZD_CS_CCK
|ZD_CCK_RATE_1M
,
572 [ZD_CCK_RATE_2M
] = ZD_CS_CCK
|ZD_CCK_RATE_2M
,
573 [ZD_CCK_RATE_5_5M
] = ZD_CS_CCK
|ZD_CCK_RATE_5_5M
,
574 [ZD_CCK_RATE_11M
] = ZD_CS_CCK
|ZD_CCK_RATE_11M
,
575 [ZD_OFDM_RATE_6M
] = ZD_CS_OFDM
|ZD_OFDM_RATE_6M
,
576 [ZD_OFDM_RATE_9M
] = ZD_CS_OFDM
|ZD_OFDM_RATE_9M
,
577 [ZD_OFDM_RATE_12M
] = ZD_CS_OFDM
|ZD_OFDM_RATE_12M
,
578 [ZD_OFDM_RATE_18M
] = ZD_CS_OFDM
|ZD_OFDM_RATE_18M
,
579 [ZD_OFDM_RATE_24M
] = ZD_CS_OFDM
|ZD_OFDM_RATE_24M
,
580 [ZD_OFDM_RATE_36M
] = ZD_CS_OFDM
|ZD_OFDM_RATE_36M
,
581 [ZD_OFDM_RATE_48M
] = ZD_CS_OFDM
|ZD_OFDM_RATE_48M
,
582 [ZD_OFDM_RATE_54M
] = ZD_CS_OFDM
|ZD_OFDM_RATE_54M
,
585 ZD_ASSERT(ZD_CS_RATE_MASK
== 0x0f);
586 return typed_rates
[zd_rate
& ZD_CS_RATE_MASK
];
589 int zd_mac_set_mode(struct zd_mac
*mac
, u32 mode
)
591 struct ieee80211_device
*ieee
;
597 mac
->netdev
->type
= ARPHRD_ETHER
;
599 case IW_MODE_MONITOR
:
600 mac
->netdev
->type
= ARPHRD_IEEE80211_RADIOTAP
;
603 dev_dbg_f(zd_mac_dev(mac
), "wrong mode %u\n", mode
);
607 ieee
= zd_mac_to_ieee80211(mac
);
608 ZD_ASSERT(!irqs_disabled());
609 spin_lock_irq(&ieee
->lock
);
610 ieee
->iw_mode
= mode
;
611 spin_unlock_irq(&ieee
->lock
);
613 if (netif_running(mac
->netdev
))
614 return reset_mode(mac
);
619 int zd_mac_get_mode(struct zd_mac
*mac
, u32
*mode
)
622 struct ieee80211_device
*ieee
;
624 ieee
= zd_mac_to_ieee80211(mac
);
625 spin_lock_irqsave(&ieee
->lock
, flags
);
626 *mode
= ieee
->iw_mode
;
627 spin_unlock_irqrestore(&ieee
->lock
, flags
);
631 int zd_mac_get_range(struct zd_mac
*mac
, struct iw_range
*range
)
634 const struct channel_range
*channel_range
;
637 memset(range
, 0, sizeof(*range
));
639 /* FIXME: Not so important and depends on the mode. For 802.11g
640 * usually this value is used. It seems to be that Bit/s number is
643 range
->throughput
= 27 * 1000 * 1000;
645 range
->max_qual
.qual
= 100;
646 range
->max_qual
.level
= 100;
648 /* FIXME: Needs still to be tuned. */
649 range
->avg_qual
.qual
= 71;
650 range
->avg_qual
.level
= 80;
652 /* FIXME: depends on standard? */
653 range
->min_rts
= 256;
654 range
->max_rts
= 2346;
656 range
->min_frag
= MIN_FRAG_THRESHOLD
;
657 range
->max_frag
= MAX_FRAG_THRESHOLD
;
659 range
->max_encoding_tokens
= WEP_KEYS
;
660 range
->num_encoding_sizes
= 2;
661 range
->encoding_size
[0] = 5;
662 range
->encoding_size
[1] = WEP_KEY_LEN
;
664 range
->we_version_compiled
= WIRELESS_EXT
;
665 range
->we_version_source
= 20;
667 range
->enc_capa
= IW_ENC_CAPA_WPA
| IW_ENC_CAPA_WPA2
|
668 IW_ENC_CAPA_CIPHER_TKIP
| IW_ENC_CAPA_CIPHER_CCMP
;
670 ZD_ASSERT(!irqs_disabled());
671 spin_lock_irq(&mac
->lock
);
672 regdomain
= mac
->regdomain
;
673 spin_unlock_irq(&mac
->lock
);
674 channel_range
= zd_channel_range(regdomain
);
676 range
->num_channels
= channel_range
->end
- channel_range
->start
;
677 range
->old_num_channels
= range
->num_channels
;
678 range
->num_frequency
= range
->num_channels
;
679 range
->old_num_frequency
= range
->num_frequency
;
681 for (i
= 0; i
< range
->num_frequency
; i
++) {
682 struct iw_freq
*freq
= &range
->freq
[i
];
683 freq
->i
= channel_range
->start
+ i
;
684 zd_channel_to_freq(freq
, freq
->i
);
690 static int zd_calc_tx_length_us(u8
*service
, u8 zd_rate
, u16 tx_length
)
692 static const u8 rate_divisor
[] = {
693 [ZD_CCK_RATE_1M
] = 1,
694 [ZD_CCK_RATE_2M
] = 2,
695 [ZD_CCK_RATE_5_5M
] = 11, /* bits must be doubled */
696 [ZD_CCK_RATE_11M
] = 11,
697 [ZD_OFDM_RATE_6M
] = 6,
698 [ZD_OFDM_RATE_9M
] = 9,
699 [ZD_OFDM_RATE_12M
] = 12,
700 [ZD_OFDM_RATE_18M
] = 18,
701 [ZD_OFDM_RATE_24M
] = 24,
702 [ZD_OFDM_RATE_36M
] = 36,
703 [ZD_OFDM_RATE_48M
] = 48,
704 [ZD_OFDM_RATE_54M
] = 54,
707 u32 bits
= (u32
)tx_length
* 8;
710 divisor
= rate_divisor
[zd_rate
];
715 case ZD_CCK_RATE_5_5M
:
716 bits
= (2*bits
) + 10; /* round up to the next integer */
718 case ZD_CCK_RATE_11M
:
721 *service
&= ~ZD_PLCP_SERVICE_LENGTH_EXTENSION
;
722 if (0 < t
&& t
<= 3) {
723 *service
|= ZD_PLCP_SERVICE_LENGTH_EXTENSION
;
726 bits
+= 10; /* round up to the next integer */
734 R2M_SHORT_PREAMBLE
= 0x01,
738 static u8
zd_rate_to_modulation(u8 zd_rate
, int flags
)
742 modulation
= zd_rate_typed(zd_rate
);
743 if (flags
& R2M_SHORT_PREAMBLE
) {
744 switch (ZD_CS_RATE(modulation
)) {
746 case ZD_CCK_RATE_5_5M
:
747 case ZD_CCK_RATE_11M
:
748 modulation
|= ZD_CS_CCK_PREA_SHORT
;
752 if (flags
& R2M_11A
) {
753 if (ZD_CS_TYPE(modulation
) == ZD_CS_OFDM
)
754 modulation
|= ZD_CS_OFDM_MODE_11A
;
759 static void cs_set_modulation(struct zd_mac
*mac
, struct zd_ctrlset
*cs
,
760 struct ieee80211_hdr_4addr
*hdr
)
762 struct ieee80211softmac_device
*softmac
= ieee80211_priv(mac
->netdev
);
763 u16 ftype
= WLAN_FC_GET_TYPE(le16_to_cpu(hdr
->frame_ctl
));
765 int is_mgt
= (ftype
== IEEE80211_FTYPE_MGMT
) != 0;
766 int is_multicast
= is_multicast_ether_addr(hdr
->addr1
);
767 int short_preamble
= ieee80211softmac_short_preamble_ok(softmac
,
768 is_multicast
, is_mgt
);
771 /* FIXME: 802.11a? */
772 rate
= ieee80211softmac_suggest_txrate(softmac
, is_multicast
, is_mgt
);
775 flags
|= R2M_SHORT_PREAMBLE
;
777 zd_rate
= rate_to_zd_rate(rate
);
778 cs
->modulation
= zd_rate_to_modulation(zd_rate
, flags
);
781 static void cs_set_control(struct zd_mac
*mac
, struct zd_ctrlset
*cs
,
782 struct ieee80211_hdr_4addr
*header
)
784 struct ieee80211softmac_device
*softmac
= ieee80211_priv(mac
->netdev
);
785 unsigned int tx_length
= le16_to_cpu(cs
->tx_length
);
786 u16 fctl
= le16_to_cpu(header
->frame_ctl
);
787 u16 ftype
= WLAN_FC_GET_TYPE(fctl
);
788 u16 stype
= WLAN_FC_GET_STYPE(fctl
);
792 * - if backoff needed, enable bit 0
793 * - if burst (backoff not needed) disable bit 0
799 if (WLAN_GET_SEQ_FRAG(le16_to_cpu(header
->seq_ctl
)) == 0)
800 cs
->control
|= ZD_CS_NEED_RANDOM_BACKOFF
;
803 if (is_multicast_ether_addr(header
->addr1
))
804 cs
->control
|= ZD_CS_MULTICAST
;
807 if (stype
== IEEE80211_STYPE_PSPOLL
)
808 cs
->control
|= ZD_CS_PS_POLL_FRAME
;
810 /* Unicast data frames over the threshold should have RTS */
811 if (!is_multicast_ether_addr(header
->addr1
) &&
812 ftype
!= IEEE80211_FTYPE_MGMT
&&
813 tx_length
> zd_netdev_ieee80211(mac
->netdev
)->rts
)
814 cs
->control
|= ZD_CS_RTS
;
816 /* Use CTS-to-self protection if required */
817 if (ZD_CS_TYPE(cs
->modulation
) == ZD_CS_OFDM
&&
818 ieee80211softmac_protection_needed(softmac
)) {
819 /* FIXME: avoid sending RTS *and* self-CTS, is that correct? */
820 cs
->control
&= ~ZD_CS_RTS
;
821 cs
->control
|= ZD_CS_SELF_CTS
;
824 /* FIXME: Management frame? */
827 static int fill_ctrlset(struct zd_mac
*mac
,
828 struct ieee80211_txb
*txb
,
832 struct sk_buff
*skb
= txb
->fragments
[frag_num
];
833 struct ieee80211_hdr_4addr
*hdr
=
834 (struct ieee80211_hdr_4addr
*) skb
->data
;
835 unsigned int frag_len
= skb
->len
+ IEEE80211_FCS_LEN
;
836 unsigned int next_frag_len
;
837 unsigned int packet_length
;
838 struct zd_ctrlset
*cs
= (struct zd_ctrlset
*)
839 skb_push(skb
, sizeof(struct zd_ctrlset
));
841 if (frag_num
+1 < txb
->nr_frags
) {
842 next_frag_len
= txb
->fragments
[frag_num
+1]->len
+
847 ZD_ASSERT(frag_len
<= 0xffff);
848 ZD_ASSERT(next_frag_len
<= 0xffff);
850 cs_set_modulation(mac
, cs
, hdr
);
852 cs
->tx_length
= cpu_to_le16(frag_len
);
854 cs_set_control(mac
, cs
, hdr
);
856 packet_length
= frag_len
+ sizeof(struct zd_ctrlset
) + 10;
857 ZD_ASSERT(packet_length
<= 0xffff);
858 /* ZD1211B: Computing the length difference this way, gives us
859 * flexibility to compute the packet length.
861 cs
->packet_length
= cpu_to_le16(mac
->chip
.is_zd1211b
?
862 packet_length
- frag_len
: packet_length
);
866 * - transmit frame length in microseconds
867 * - seems to be derived from frame length
868 * - see Cal_Us_Service() in zdinlinef.h
869 * - if macp->bTxBurstEnable is enabled, then multiply by 4
870 * - bTxBurstEnable is never set in the vendor driver
873 * - "for PLCP configuration"
874 * - always 0 except in some situations at 802.11b 11M
875 * - see line 53 of zdinlinef.h
878 r
= zd_calc_tx_length_us(&cs
->service
, ZD_CS_RATE(cs
->modulation
),
879 le16_to_cpu(cs
->tx_length
));
882 cs
->current_length
= cpu_to_le16(r
);
884 if (next_frag_len
== 0) {
885 cs
->next_frame_length
= 0;
887 r
= zd_calc_tx_length_us(NULL
, ZD_CS_RATE(cs
->modulation
),
891 cs
->next_frame_length
= cpu_to_le16(r
);
897 static int zd_mac_tx(struct zd_mac
*mac
, struct ieee80211_txb
*txb
, int pri
)
900 struct ieee80211_device
*ieee
= zd_mac_to_ieee80211(mac
);
902 for (i
= 0; i
< txb
->nr_frags
; i
++) {
903 struct sk_buff
*skb
= txb
->fragments
[i
];
905 r
= fill_ctrlset(mac
, txb
, i
);
907 ieee
->stats
.tx_dropped
++;
910 r
= zd_usb_tx(&mac
->chip
.usb
, skb
->data
, skb
->len
);
912 ieee
->stats
.tx_dropped
++;
917 /* FIXME: shouldn't this be handled by the upper layers? */
918 mac
->netdev
->trans_start
= jiffies
;
920 ieee80211_txb_free(txb
);
925 struct ieee80211_radiotap_header rt_hdr
;
930 } __attribute__((packed
));
932 static void fill_rt_header(void *buffer
, struct zd_mac
*mac
,
933 const struct ieee80211_rx_stats
*stats
,
934 const struct rx_status
*status
)
936 struct zd_rt_hdr
*hdr
= buffer
;
938 hdr
->rt_hdr
.it_version
= PKTHDR_RADIOTAP_VERSION
;
939 hdr
->rt_hdr
.it_pad
= 0;
940 hdr
->rt_hdr
.it_len
= cpu_to_le16(sizeof(struct zd_rt_hdr
));
941 hdr
->rt_hdr
.it_present
= cpu_to_le32((1 << IEEE80211_RADIOTAP_FLAGS
) |
942 (1 << IEEE80211_RADIOTAP_CHANNEL
) |
943 (1 << IEEE80211_RADIOTAP_RATE
));
946 if (status
->decryption_type
& (ZD_RX_WEP64
|ZD_RX_WEP128
|ZD_RX_WEP256
))
947 hdr
->rt_flags
|= IEEE80211_RADIOTAP_F_WEP
;
949 hdr
->rt_rate
= stats
->rate
/ 5;
952 hdr
->rt_channel
= cpu_to_le16(ieee80211chan2mhz(
953 _zd_chip_get_channel(&mac
->chip
)));
954 hdr
->rt_chbitmask
= cpu_to_le16(IEEE80211_CHAN_2GHZ
|
955 ((status
->frame_status
& ZD_RX_FRAME_MODULATION_MASK
) ==
956 ZD_RX_OFDM
? IEEE80211_CHAN_OFDM
: IEEE80211_CHAN_CCK
));
959 /* Returns 1 if the data packet is for us and 0 otherwise. */
960 static int is_data_packet_for_us(struct ieee80211_device
*ieee
,
961 struct ieee80211_hdr_4addr
*hdr
)
963 struct net_device
*netdev
= ieee
->dev
;
964 u16 fc
= le16_to_cpu(hdr
->frame_ctl
);
966 ZD_ASSERT(WLAN_FC_GET_TYPE(fc
) == IEEE80211_FTYPE_DATA
);
968 switch (ieee
->iw_mode
) {
970 if ((fc
& (IEEE80211_FCTL_TODS
|IEEE80211_FCTL_FROMDS
)) != 0 ||
971 compare_ether_addr(hdr
->addr3
, ieee
->bssid
) != 0)
976 if ((fc
& (IEEE80211_FCTL_TODS
|IEEE80211_FCTL_FROMDS
)) !=
977 IEEE80211_FCTL_FROMDS
||
978 compare_ether_addr(hdr
->addr2
, ieee
->bssid
) != 0)
982 ZD_ASSERT(ieee
->iw_mode
!= IW_MODE_MONITOR
);
986 return compare_ether_addr(hdr
->addr1
, netdev
->dev_addr
) == 0 ||
987 (is_multicast_ether_addr(hdr
->addr1
) &&
988 compare_ether_addr(hdr
->addr3
, netdev
->dev_addr
) != 0) ||
989 (netdev
->flags
& IFF_PROMISC
);
992 /* Filters received packets. The function returns 1 if the packet should be
993 * forwarded to ieee80211_rx(). If the packet should be ignored the function
994 * returns 0. If an invalid packet is found the function returns -EINVAL.
996 * The function calls ieee80211_rx_mgt() directly.
998 * It has been based on ieee80211_rx_any.
1000 static int filter_rx(struct ieee80211_device
*ieee
,
1001 const u8
*buffer
, unsigned int length
,
1002 struct ieee80211_rx_stats
*stats
)
1004 struct ieee80211_hdr_4addr
*hdr
;
1007 if (ieee
->iw_mode
== IW_MODE_MONITOR
)
1010 hdr
= (struct ieee80211_hdr_4addr
*)buffer
;
1011 fc
= le16_to_cpu(hdr
->frame_ctl
);
1012 if ((fc
& IEEE80211_FCTL_VERS
) != 0)
1015 switch (WLAN_FC_GET_TYPE(fc
)) {
1016 case IEEE80211_FTYPE_MGMT
:
1017 if (length
< sizeof(struct ieee80211_hdr_3addr
))
1019 ieee80211_rx_mgt(ieee
, hdr
, stats
);
1021 case IEEE80211_FTYPE_CTL
:
1023 case IEEE80211_FTYPE_DATA
:
1024 /* Ignore invalid short buffers */
1025 if (length
< sizeof(struct ieee80211_hdr_3addr
))
1027 return is_data_packet_for_us(ieee
, hdr
);
1033 static void update_qual_rssi(struct zd_mac
*mac
,
1034 const u8
*buffer
, unsigned int length
,
1035 u8 qual_percent
, u8 rssi_percent
)
1037 unsigned long flags
;
1038 struct ieee80211_hdr_3addr
*hdr
;
1041 hdr
= (struct ieee80211_hdr_3addr
*)buffer
;
1042 if (length
< offsetof(struct ieee80211_hdr_3addr
, addr3
))
1044 if (compare_ether_addr(hdr
->addr2
, zd_mac_to_ieee80211(mac
)->bssid
) != 0)
1047 spin_lock_irqsave(&mac
->lock
, flags
);
1048 i
= mac
->stats_count
% ZD_MAC_STATS_BUFFER_SIZE
;
1049 mac
->qual_buffer
[i
] = qual_percent
;
1050 mac
->rssi_buffer
[i
] = rssi_percent
;
1052 spin_unlock_irqrestore(&mac
->lock
, flags
);
1055 static int fill_rx_stats(struct ieee80211_rx_stats
*stats
,
1056 const struct rx_status
**pstatus
,
1058 const u8
*buffer
, unsigned int length
)
1060 const struct rx_status
*status
;
1062 *pstatus
= status
= zd_tail(buffer
, length
, sizeof(struct rx_status
));
1063 if (status
->frame_status
& ZD_RX_ERROR
) {
1064 struct ieee80211_device
*ieee
= zd_mac_to_ieee80211(mac
);
1065 ieee
->stats
.rx_errors
++;
1066 if (status
->frame_status
& ZD_RX_TIMEOUT_ERROR
)
1067 ieee
->stats
.rx_missed_errors
++;
1068 else if (status
->frame_status
& ZD_RX_FIFO_OVERRUN_ERROR
)
1069 ieee
->stats
.rx_fifo_errors
++;
1070 else if (status
->frame_status
& ZD_RX_DECRYPTION_ERROR
)
1071 ieee
->ieee_stats
.rx_discards_undecryptable
++;
1072 else if (status
->frame_status
& ZD_RX_CRC32_ERROR
) {
1073 ieee
->stats
.rx_crc_errors
++;
1074 ieee
->ieee_stats
.rx_fcs_errors
++;
1076 else if (status
->frame_status
& ZD_RX_CRC16_ERROR
)
1077 ieee
->stats
.rx_crc_errors
++;
1081 memset(stats
, 0, sizeof(struct ieee80211_rx_stats
));
1082 stats
->len
= length
- (ZD_PLCP_HEADER_SIZE
+ IEEE80211_FCS_LEN
+
1083 + sizeof(struct rx_status
));
1084 /* FIXME: 802.11a */
1085 stats
->freq
= IEEE80211_24GHZ_BAND
;
1086 stats
->received_channel
= _zd_chip_get_channel(&mac
->chip
);
1087 stats
->rssi
= zd_rx_strength_percent(status
->signal_strength
);
1088 stats
->signal
= zd_rx_qual_percent(buffer
,
1089 length
- sizeof(struct rx_status
),
1091 stats
->mask
= IEEE80211_STATMASK_RSSI
| IEEE80211_STATMASK_SIGNAL
;
1092 stats
->rate
= zd_rx_rate(buffer
, status
);
1094 stats
->mask
|= IEEE80211_STATMASK_RATE
;
1099 static void zd_mac_rx(struct zd_mac
*mac
, struct sk_buff
*skb
)
1102 struct ieee80211_device
*ieee
= zd_mac_to_ieee80211(mac
);
1103 struct ieee80211_rx_stats stats
;
1104 const struct rx_status
*status
;
1106 if (skb
->len
< ZD_PLCP_HEADER_SIZE
+ IEEE80211_1ADDR_LEN
+
1107 IEEE80211_FCS_LEN
+ sizeof(struct rx_status
))
1109 ieee
->stats
.rx_errors
++;
1110 ieee
->stats
.rx_length_errors
++;
1114 r
= fill_rx_stats(&stats
, &status
, mac
, skb
->data
, skb
->len
);
1116 /* Only packets with rx errors are included here.
1117 * The error stats have already been set in fill_rx_stats.
1122 __skb_pull(skb
, ZD_PLCP_HEADER_SIZE
);
1123 __skb_trim(skb
, skb
->len
-
1124 (IEEE80211_FCS_LEN
+ sizeof(struct rx_status
)));
1126 update_qual_rssi(mac
, skb
->data
, skb
->len
, stats
.signal
,
1127 status
->signal_strength
);
1129 r
= filter_rx(ieee
, skb
->data
, skb
->len
, &stats
);
1132 ieee
->stats
.rx_errors
++;
1133 dev_dbg_f(zd_mac_dev(mac
), "Error in packet.\n");
1138 if (ieee
->iw_mode
== IW_MODE_MONITOR
)
1139 fill_rt_header(skb_push(skb
, sizeof(struct zd_rt_hdr
)), mac
,
1142 r
= ieee80211_rx(ieee
, skb
, &stats
);
1146 /* We are always in a soft irq. */
1150 static void do_rx(unsigned long mac_ptr
)
1152 struct zd_mac
*mac
= (struct zd_mac
*)mac_ptr
;
1153 struct sk_buff
*skb
;
1155 while ((skb
= skb_dequeue(&mac
->rx_queue
)) != NULL
)
1156 zd_mac_rx(mac
, skb
);
1159 int zd_mac_rx_irq(struct zd_mac
*mac
, const u8
*buffer
, unsigned int length
)
1161 struct sk_buff
*skb
;
1163 skb
= dev_alloc_skb(sizeof(struct zd_rt_hdr
) + length
);
1165 struct ieee80211_device
*ieee
= zd_mac_to_ieee80211(mac
);
1166 dev_warn(zd_mac_dev(mac
), "Could not allocate skb.\n");
1167 ieee
->stats
.rx_dropped
++;
1170 skb_reserve(skb
, sizeof(struct zd_rt_hdr
));
1171 memcpy(__skb_put(skb
, length
), buffer
, length
);
1172 skb_queue_tail(&mac
->rx_queue
, skb
);
1173 tasklet_schedule(&mac
->rx_tasklet
);
1177 static int netdev_tx(struct ieee80211_txb
*txb
, struct net_device
*netdev
,
1180 return zd_mac_tx(zd_netdev_mac(netdev
), txb
, pri
);
1183 static void set_security(struct net_device
*netdev
,
1184 struct ieee80211_security
*sec
)
1186 struct ieee80211_device
*ieee
= zd_netdev_ieee80211(netdev
);
1187 struct ieee80211_security
*secinfo
= &ieee
->sec
;
1190 dev_dbg_f(zd_mac_dev(zd_netdev_mac(netdev
)), "\n");
1192 for (keyidx
= 0; keyidx
<WEP_KEYS
; keyidx
++)
1193 if (sec
->flags
& (1<<keyidx
)) {
1194 secinfo
->encode_alg
[keyidx
] = sec
->encode_alg
[keyidx
];
1195 secinfo
->key_sizes
[keyidx
] = sec
->key_sizes
[keyidx
];
1196 memcpy(secinfo
->keys
[keyidx
], sec
->keys
[keyidx
],
1200 if (sec
->flags
& SEC_ACTIVE_KEY
) {
1201 secinfo
->active_key
= sec
->active_key
;
1202 dev_dbg_f(zd_mac_dev(zd_netdev_mac(netdev
)),
1203 " .active_key = %d\n", sec
->active_key
);
1205 if (sec
->flags
& SEC_UNICAST_GROUP
) {
1206 secinfo
->unicast_uses_group
= sec
->unicast_uses_group
;
1207 dev_dbg_f(zd_mac_dev(zd_netdev_mac(netdev
)),
1208 " .unicast_uses_group = %d\n",
1209 sec
->unicast_uses_group
);
1211 if (sec
->flags
& SEC_LEVEL
) {
1212 secinfo
->level
= sec
->level
;
1213 dev_dbg_f(zd_mac_dev(zd_netdev_mac(netdev
)),
1214 " .level = %d\n", sec
->level
);
1216 if (sec
->flags
& SEC_ENABLED
) {
1217 secinfo
->enabled
= sec
->enabled
;
1218 dev_dbg_f(zd_mac_dev(zd_netdev_mac(netdev
)),
1219 " .enabled = %d\n", sec
->enabled
);
1221 if (sec
->flags
& SEC_ENCRYPT
) {
1222 secinfo
->encrypt
= sec
->encrypt
;
1223 dev_dbg_f(zd_mac_dev(zd_netdev_mac(netdev
)),
1224 " .encrypt = %d\n", sec
->encrypt
);
1226 if (sec
->flags
& SEC_AUTH_MODE
) {
1227 secinfo
->auth_mode
= sec
->auth_mode
;
1228 dev_dbg_f(zd_mac_dev(zd_netdev_mac(netdev
)),
1229 " .auth_mode = %d\n", sec
->auth_mode
);
1233 static void ieee_init(struct ieee80211_device
*ieee
)
1235 ieee
->mode
= IEEE_B
| IEEE_G
;
1236 ieee
->freq_band
= IEEE80211_24GHZ_BAND
;
1237 ieee
->modulation
= IEEE80211_OFDM_MODULATION
| IEEE80211_CCK_MODULATION
;
1238 ieee
->tx_headroom
= sizeof(struct zd_ctrlset
);
1239 ieee
->set_security
= set_security
;
1240 ieee
->hard_start_xmit
= netdev_tx
;
1242 /* Software encryption/decryption for now */
1243 ieee
->host_build_iv
= 0;
1244 ieee
->host_encrypt
= 1;
1245 ieee
->host_decrypt
= 1;
1247 /* FIXME: default to managed mode, until ieee80211 and zd1211rw can
1248 * correctly support AUTO */
1249 ieee
->iw_mode
= IW_MODE_INFRA
;
1252 static void softmac_init(struct ieee80211softmac_device
*sm
)
1254 sm
->set_channel
= set_channel
;
1255 sm
->bssinfo_change
= bssinfo_change
;
1258 struct iw_statistics
*zd_mac_get_wireless_stats(struct net_device
*ndev
)
1260 struct zd_mac
*mac
= zd_netdev_mac(ndev
);
1261 struct iw_statistics
*iw_stats
= &mac
->iw_stats
;
1262 unsigned int i
, count
, qual_total
, rssi_total
;
1264 memset(iw_stats
, 0, sizeof(struct iw_statistics
));
1265 /* We are not setting the status, because ieee->state is not updated
1266 * at all and this driver doesn't track authentication state.
1268 spin_lock_irq(&mac
->lock
);
1269 count
= mac
->stats_count
< ZD_MAC_STATS_BUFFER_SIZE
?
1270 mac
->stats_count
: ZD_MAC_STATS_BUFFER_SIZE
;
1271 qual_total
= rssi_total
= 0;
1272 for (i
= 0; i
< count
; i
++) {
1273 qual_total
+= mac
->qual_buffer
[i
];
1274 rssi_total
+= mac
->rssi_buffer
[i
];
1276 spin_unlock_irq(&mac
->lock
);
1277 iw_stats
->qual
.updated
= IW_QUAL_NOISE_INVALID
;
1279 iw_stats
->qual
.qual
= qual_total
/ count
;
1280 iw_stats
->qual
.level
= rssi_total
/ count
;
1281 iw_stats
->qual
.updated
|=
1282 IW_QUAL_QUAL_UPDATED
|IW_QUAL_LEVEL_UPDATED
;
1284 iw_stats
->qual
.updated
|=
1285 IW_QUAL_QUAL_INVALID
|IW_QUAL_LEVEL_INVALID
;
1287 /* TODO: update counter */
1291 #define LINK_LED_WORK_DELAY HZ
1293 static void link_led_handler(struct work_struct
*work
)
1295 struct zd_mac
*mac
=
1296 container_of(work
, struct zd_mac
, housekeeping
.link_led_work
.work
);
1297 struct zd_chip
*chip
= &mac
->chip
;
1298 struct ieee80211softmac_device
*sm
= ieee80211_priv(mac
->netdev
);
1302 spin_lock_irq(&mac
->lock
);
1303 is_associated
= sm
->associnfo
.associated
!= 0;
1304 spin_unlock_irq(&mac
->lock
);
1306 r
= zd_chip_control_leds(chip
,
1307 is_associated
? LED_ASSOCIATED
: LED_SCANNING
);
1309 dev_err(zd_mac_dev(mac
), "zd_chip_control_leds error %d\n", r
);
1311 queue_delayed_work(zd_workqueue
, &mac
->housekeeping
.link_led_work
,
1312 LINK_LED_WORK_DELAY
);
1315 static void housekeeping_init(struct zd_mac
*mac
)
1317 INIT_DELAYED_WORK(&mac
->housekeeping
.link_led_work
, link_led_handler
);
1320 static void housekeeping_enable(struct zd_mac
*mac
)
1322 dev_dbg_f(zd_mac_dev(mac
), "\n");
1323 queue_delayed_work(zd_workqueue
, &mac
->housekeeping
.link_led_work
,
1327 static void housekeeping_disable(struct zd_mac
*mac
)
1329 dev_dbg_f(zd_mac_dev(mac
), "\n");
1330 cancel_rearming_delayed_workqueue(zd_workqueue
,
1331 &mac
->housekeeping
.link_led_work
);
1332 zd_chip_control_leds(&mac
->chip
, LED_OFF
);