1 // SPDX-License-Identifier: (GPL-2.0 OR MPL-1.1)
4 * Linux Kernel net device interface
6 * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
7 * --------------------------------------------------------------------
11 * --------------------------------------------------------------------
13 * Inquiries regarding the linux-wlan Open Source project can be
16 * AbsoluteValue Systems Inc.
18 * http://www.linux-wlan.com
20 * --------------------------------------------------------------------
22 * Portions of the development of this software were funded by
23 * Intersil Corporation as part of PRISM(R) chipset product development.
25 * --------------------------------------------------------------------
27 * The functions required for a Linux network device are defined here.
29 * --------------------------------------------------------------------
32 #include <linux/module.h>
33 #include <linux/kernel.h>
34 #include <linux/sched.h>
35 #include <linux/types.h>
36 #include <linux/skbuff.h>
37 #include <linux/slab.h>
38 #include <linux/proc_fs.h>
39 #include <linux/interrupt.h>
40 #include <linux/netdevice.h>
41 #include <linux/kmod.h>
42 #include <linux/if_arp.h>
43 #include <linux/wireless.h>
44 #include <linux/sockios.h>
45 #include <linux/etherdevice.h>
46 #include <linux/if_ether.h>
47 #include <linux/byteorder/generic.h>
48 #include <linux/bitops.h>
49 #include <linux/uaccess.h>
50 #include <asm/byteorder.h>
53 #include <linux/ethtool.h>
56 #include <net/iw_handler.h>
57 #include <net/net_namespace.h>
58 #include <net/cfg80211.h>
60 #include "p80211types.h"
61 #include "p80211hdr.h"
62 #include "p80211conv.h"
63 #include "p80211mgmt.h"
64 #include "p80211msg.h"
65 #include "p80211netdev.h"
66 #include "p80211ioctl.h"
67 #include "p80211req.h"
68 #include "p80211metastruct.h"
69 #include "p80211metadef.h"
73 /* netdevice method functions */
74 static int p80211knetdev_init(struct net_device *netdev);
75 static int p80211knetdev_open(struct net_device *netdev);
76 static int p80211knetdev_stop(struct net_device *netdev);
77 static netdev_tx_t p80211knetdev_hard_start_xmit(struct sk_buff *skb,
78 struct net_device *netdev);
79 static void p80211knetdev_set_multicast_list(struct net_device *dev);
80 static int p80211knetdev_siocdevprivate(struct net_device *dev, struct ifreq *ifr,
81 void __user *data, int cmd);
82 static int p80211knetdev_set_mac_address(struct net_device *dev, void *addr);
83 static void p80211knetdev_tx_timeout(struct net_device *netdev, unsigned int txqueue);
84 static int p80211_rx_typedrop(struct wlandevice *wlandev, u16 fc);
86 int wlan_watchdog = 5000;
87 module_param(wlan_watchdog, int, 0644);
88 MODULE_PARM_DESC(wlan_watchdog, "transmit timeout in milliseconds");
90 int wlan_wext_write = 1;
91 module_param(wlan_wext_write, int, 0644);
92 MODULE_PARM_DESC(wlan_wext_write, "enable write wireless extensions");
94 /*----------------------------------------------------------------
97 * Init method for a Linux netdevice. Called in response to
105 *----------------------------------------------------------------
107 static int p80211knetdev_init(struct net_device *netdev)
109 /* Called in response to register_netdev */
110 /* This is usually the probe function, but the probe has */
111 /* already been done by the MSD and the create_kdev */
112 /* function. All we do here is return success */
116 /*----------------------------------------------------------------
119 * Linux netdevice open method. Following a successful call here,
120 * the device is supposed to be ready for tx and rx. In our
121 * situation that may not be entirely true due to the state of the
125 * netdev Linux network device structure
128 * zero on success, non-zero otherwise
129 *----------------------------------------------------------------
131 static int p80211knetdev_open(struct net_device *netdev)
133 int result = 0; /* success */
134 struct wlandevice *wlandev = netdev->ml_priv;
136 /* Check to make sure the MSD is running */
137 if (wlandev->msdstate != WLAN_MSD_RUNNING)
140 /* Tell the MSD to open */
142 result = wlandev->open(wlandev);
144 netif_start_queue(wlandev->netdev);
145 wlandev->state = WLAN_DEVICE_OPEN;
154 /*----------------------------------------------------------------
157 * Linux netdevice stop (close) method. Following this call,
158 * no frames should go up or down through this interface.
161 * netdev Linux network device structure
164 * zero on success, non-zero otherwise
165 *----------------------------------------------------------------
167 static int p80211knetdev_stop(struct net_device *netdev)
170 struct wlandevice *wlandev = netdev->ml_priv;
173 result = wlandev->close(wlandev);
175 netif_stop_queue(wlandev->netdev);
176 wlandev->state = WLAN_DEVICE_CLOSED;
181 /*----------------------------------------------------------------
184 * Frame receive function called by the mac specific driver.
187 * wlandev WLAN network device structure
188 * skb skbuff containing a full 802.11 frame.
193 *----------------------------------------------------------------
195 void p80211netdev_rx(struct wlandevice *wlandev, struct sk_buff *skb)
197 /* Enqueue for post-irq processing */
198 skb_queue_tail(&wlandev->nsd_rxq, skb);
199 tasklet_schedule(&wlandev->rx_bh);
202 #define CONV_TO_ETHER_SKIPPED 0x01
203 #define CONV_TO_ETHER_FAILED 0x02
206 * p80211_convert_to_ether - conversion from 802.11 frame to ethernet frame
207 * @wlandev: pointer to WLAN device
208 * @skb: pointer to socket buffer
210 * Returns: 0 if conversion succeeded
211 * CONV_TO_ETHER_FAILED if conversion failed
212 * CONV_TO_ETHER_SKIPPED if frame is ignored
214 static int p80211_convert_to_ether(struct wlandevice *wlandev,
217 struct p80211_hdr *hdr;
219 hdr = (struct p80211_hdr *)skb->data;
220 if (p80211_rx_typedrop(wlandev, le16_to_cpu(hdr->frame_control)))
221 return CONV_TO_ETHER_SKIPPED;
223 /* perform mcast filtering: allow my local address through but reject
224 * anything else that isn't multicast
226 if (wlandev->netdev->flags & IFF_ALLMULTI) {
227 if (!ether_addr_equal_unaligned(wlandev->netdev->dev_addr,
229 if (!is_multicast_ether_addr(hdr->address1))
230 return CONV_TO_ETHER_SKIPPED;
234 if (skb_p80211_to_ether(wlandev, wlandev->ethconv, skb) == 0) {
235 wlandev->netdev->stats.rx_packets++;
236 wlandev->netdev->stats.rx_bytes += skb->len;
241 netdev_dbg(wlandev->netdev, "%s failed.\n", __func__);
242 return CONV_TO_ETHER_FAILED;
246 * p80211netdev_rx_bh - deferred processing of all received frames
248 * @t: pointer to the tasklet associated with this handler
250 static void p80211netdev_rx_bh(struct tasklet_struct *t)
252 struct wlandevice *wlandev = from_tasklet(wlandev, t, rx_bh);
253 struct sk_buff *skb = NULL;
254 struct net_device *dev = wlandev->netdev;
256 /* Let's empty our queue */
257 while ((skb = skb_dequeue(&wlandev->nsd_rxq))) {
258 if (wlandev->state == WLAN_DEVICE_OPEN) {
259 if (dev->type != ARPHRD_ETHER) {
260 /* RAW frame; we shouldn't convert it */
261 /* XXX Append the Prism Header here instead. */
263 /* set up various data fields */
265 skb_reset_mac_header(skb);
266 skb->ip_summed = CHECKSUM_NONE;
267 skb->pkt_type = PACKET_OTHERHOST;
268 skb->protocol = htons(ETH_P_80211_RAW);
270 dev->stats.rx_packets++;
271 dev->stats.rx_bytes += skb->len;
275 if (!p80211_convert_to_ether(wlandev, skb))
283 /*----------------------------------------------------------------
284 * p80211knetdev_hard_start_xmit
286 * Linux netdevice method for transmitting a frame.
289 * skb Linux sk_buff containing the frame.
290 * netdev Linux netdevice.
293 * If the lower layers report that buffers are full. netdev->tbusy
294 * will be set to prevent higher layers from sending more traffic.
296 * Note: If this function returns non-zero, higher layers retain
297 * ownership of the skb.
300 * zero on success, non-zero on failure.
301 *----------------------------------------------------------------
303 static netdev_tx_t p80211knetdev_hard_start_xmit(struct sk_buff *skb,
304 struct net_device *netdev)
308 struct wlandevice *wlandev = netdev->ml_priv;
309 struct p80211_hdr p80211_hdr;
310 struct p80211_metawep p80211_wep;
312 p80211_wep.data = NULL;
317 if (wlandev->state != WLAN_DEVICE_OPEN) {
322 memset(&p80211_hdr, 0, sizeof(p80211_hdr));
323 memset(&p80211_wep, 0, sizeof(p80211_wep));
325 if (netif_queue_stopped(netdev)) {
326 netdev_dbg(netdev, "called when queue stopped.\n");
331 netif_stop_queue(netdev);
333 /* Check to see that a valid mode is set */
334 switch (wlandev->macmode) {
335 case WLAN_MACMODE_IBSS_STA:
336 case WLAN_MACMODE_ESS_STA:
337 case WLAN_MACMODE_ESS_AP:
340 /* Mode isn't set yet, just drop the frame
341 * and return success .
342 * TODO: we need a saner way to handle this
344 if (be16_to_cpu(skb->protocol) != ETH_P_80211_RAW) {
345 netif_start_queue(wlandev->netdev);
346 netdev_notice(netdev, "Tx attempt prior to association, frame dropped.\n");
347 netdev->stats.tx_dropped++;
354 /* Check for raw transmits */
355 if (be16_to_cpu(skb->protocol) == ETH_P_80211_RAW) {
356 if (!capable(CAP_NET_ADMIN)) {
360 /* move the header over */
361 memcpy(&p80211_hdr, skb->data, sizeof(p80211_hdr));
362 skb_pull(skb, sizeof(p80211_hdr));
364 if (skb_ether_to_p80211
365 (wlandev, wlandev->ethconv, skb, &p80211_hdr,
368 netdev_dbg(netdev, "ether_to_80211(%d) failed.\n",
374 if (!wlandev->txframe) {
379 netif_trans_update(netdev);
381 netdev->stats.tx_packets++;
382 /* count only the packet payload */
383 netdev->stats.tx_bytes += skb->len;
385 txresult = wlandev->txframe(wlandev, skb, &p80211_hdr, &p80211_wep);
388 /* success and more buf */
389 /* avail, re: hw_txdata */
390 netif_wake_queue(wlandev->netdev);
391 result = NETDEV_TX_OK;
392 } else if (txresult == 1) {
393 /* success, no more avail */
394 netdev_dbg(netdev, "txframe success, no more bufs\n");
395 /* netdev->tbusy = 1; don't set here, irqhdlr */
396 /* may have already cleared it */
397 result = NETDEV_TX_OK;
398 } else if (txresult == 2) {
399 /* alloc failure, drop frame */
400 netdev_dbg(netdev, "txframe returned alloc_fail\n");
401 result = NETDEV_TX_BUSY;
403 /* buffer full or queue busy, drop frame. */
404 netdev_dbg(netdev, "txframe returned full or busy\n");
405 result = NETDEV_TX_BUSY;
409 /* Free up the WEP buffer if it's not the same as the skb */
410 if ((p80211_wep.data) && (p80211_wep.data != skb->data))
411 kfree_sensitive(p80211_wep.data);
413 /* we always free the skb here, never in a lower level. */
420 /*----------------------------------------------------------------
421 * p80211knetdev_set_multicast_list
423 * Called from higher layers whenever there's a need to set/clear
424 * promiscuous mode or rewrite the multicast list.
431 *----------------------------------------------------------------
433 static void p80211knetdev_set_multicast_list(struct net_device *dev)
435 struct wlandevice *wlandev = dev->ml_priv;
437 /* TODO: real multicast support as well */
439 if (wlandev->set_multicast_list)
440 wlandev->set_multicast_list(wlandev, dev);
443 /*----------------------------------------------------------------
444 * p80211knetdev_siocdevprivate
446 * Handle an ioctl call on one of our devices. Everything Linux
447 * ioctl specific is done here. Then we pass the contents of the
448 * ifr->data to the request message handler.
451 * dev Linux kernel netdevice
452 * ifr Our private ioctl request structure, typed for the
453 * generic struct ifreq so we can use ptr to func
457 * zero on success, a negative errno on failure. Possible values:
458 * -ENETDOWN Device isn't up.
459 * -EBUSY cmd already in progress
460 * -ETIME p80211 cmd timed out (MSD may have its own timers)
461 * -EFAULT memory fault copying msg from user buffer
462 * -ENOMEM unable to allocate kernel msg buffer
463 * -EINVAL bad magic, it the cmd really for us?
464 * -EintR sleeping on cmd, awakened by signal, cmd cancelled.
467 * Process thread (ioctl caller). TODO: SMP support may require
469 *----------------------------------------------------------------
471 static int p80211knetdev_siocdevprivate(struct net_device *dev,
473 void __user *data, int cmd)
476 struct p80211ioctl_req *req = (struct p80211ioctl_req *)ifr;
477 struct wlandevice *wlandev = dev->ml_priv;
480 netdev_dbg(dev, "rx'd ioctl, cmd=%d, len=%d\n", cmd, req->len);
482 if (in_compat_syscall())
485 /* Test the magic, assume ifr is good if it's there */
486 if (req->magic != P80211_IOCTL_MAGIC) {
491 if (cmd == P80211_IFTEST) {
494 } else if (cmd != P80211_IFREQ) {
499 msgbuf = memdup_user(data, req->len);
500 if (IS_ERR(msgbuf)) {
501 result = PTR_ERR(msgbuf);
505 result = p80211req_dorequest(wlandev, msgbuf);
508 if (copy_to_user(data, msgbuf, req->len))
514 /* If allocate,copyfrom or copyto fails, return errno */
518 /*----------------------------------------------------------------
519 * p80211knetdev_set_mac_address
521 * Handles the ioctl for changing the MACAddress of a netdevice
523 * references: linux/netdevice.h and drivers/net/net_init.c
525 * NOTE: [MSM] We only prevent address changes when the netdev is
526 * up. We don't control anything based on dot11 state. If the
527 * address is changed on a STA that's currently associated, you
528 * will probably lose the ability to send and receive data frames.
529 * Just be aware. Therefore, this should usually only be done
530 * prior to scan/join/auth/assoc.
533 * dev netdevice struct
534 * addr the new MACAddress (a struct)
537 * zero on success, a negative errno on failure. Possible values:
538 * -EBUSY device is bussy (cmd not possible)
539 * -and errors returned by: p80211req_dorequest(..)
541 * by: Collin R. Mulliner <collin@mulliner.org>
542 *----------------------------------------------------------------
544 static int p80211knetdev_set_mac_address(struct net_device *dev, void *addr)
546 struct sockaddr *new_addr = addr;
547 struct p80211msg_dot11req_mibset dot11req;
548 struct p80211item_unk392 *mibattr;
549 struct p80211item_pstr6 *macaddr;
550 struct p80211item_uint32 *resultcode;
553 /* If we're running, we don't allow MAC address changes */
554 if (netif_running(dev))
557 /* Set up some convenience pointers. */
558 mibattr = &dot11req.mibattribute;
559 macaddr = (struct p80211item_pstr6 *)&mibattr->data;
560 resultcode = &dot11req.resultcode;
562 /* Set up a dot11req_mibset */
563 memset(&dot11req, 0, sizeof(dot11req));
564 dot11req.msgcode = DIDMSG_DOT11REQ_MIBSET;
565 dot11req.msglen = sizeof(dot11req);
566 memcpy(dot11req.devname,
567 ((struct wlandevice *)dev->ml_priv)->name,
568 WLAN_DEVNAMELEN_MAX - 1);
570 /* Set up the mibattribute argument */
571 mibattr->did = DIDMSG_DOT11REQ_MIBSET_MIBATTRIBUTE;
572 mibattr->status = P80211ENUM_msgitem_status_data_ok;
573 mibattr->len = sizeof(mibattr->data);
575 macaddr->did = DIDMIB_DOT11MAC_OPERATIONTABLE_MACADDRESS;
576 macaddr->status = P80211ENUM_msgitem_status_data_ok;
577 macaddr->len = sizeof(macaddr->data);
578 macaddr->data.len = ETH_ALEN;
579 memcpy(&macaddr->data.data, new_addr->sa_data, ETH_ALEN);
581 /* Set up the resultcode argument */
582 resultcode->did = DIDMSG_DOT11REQ_MIBSET_RESULTCODE;
583 resultcode->status = P80211ENUM_msgitem_status_no_value;
584 resultcode->len = sizeof(resultcode->data);
585 resultcode->data = 0;
587 /* now fire the request */
588 result = p80211req_dorequest(dev->ml_priv, (u8 *)&dot11req);
590 /* If the request wasn't successful, report an error and don't
591 * change the netdev address
593 if (result != 0 || resultcode->data != P80211ENUM_resultcode_success) {
594 netdev_err(dev, "Low-level driver failed dot11req_mibset(dot11MACAddress).\n");
595 result = -EADDRNOTAVAIL;
597 /* everything's ok, change the addr in netdev */
598 eth_hw_addr_set(dev, new_addr->sa_data);
604 static const struct net_device_ops p80211_netdev_ops = {
605 .ndo_init = p80211knetdev_init,
606 .ndo_open = p80211knetdev_open,
607 .ndo_stop = p80211knetdev_stop,
608 .ndo_start_xmit = p80211knetdev_hard_start_xmit,
609 .ndo_set_rx_mode = p80211knetdev_set_multicast_list,
610 .ndo_siocdevprivate = p80211knetdev_siocdevprivate,
611 .ndo_set_mac_address = p80211knetdev_set_mac_address,
612 .ndo_tx_timeout = p80211knetdev_tx_timeout,
613 .ndo_validate_addr = eth_validate_addr,
616 /*----------------------------------------------------------------
619 * Roughly matches the functionality of ether_setup. Here
620 * we set up any members of the wlandevice structure that are common
621 * to all devices. Additionally, we allocate a linux 'struct device'
622 * and perform the same setup as ether_setup.
624 * Note: It's important that the caller have setup the wlandev->name
625 * ptr prior to calling this function.
628 * wlandev ptr to the wlandev structure for the
630 * physdev ptr to usb device
632 * zero on success, non-zero otherwise.
634 * Should be process thread. We'll assume it might be
635 * interrupt though. When we add support for statically
636 * compiled drivers, this function will be called in the
637 * context of the kernel startup code.
638 *----------------------------------------------------------------
640 int wlan_setup(struct wlandevice *wlandev, struct device *physdev)
643 struct net_device *netdev;
645 struct wireless_dev *wdev;
647 /* Set up the wlandev */
648 wlandev->state = WLAN_DEVICE_CLOSED;
649 wlandev->ethconv = WLAN_ETHCONV_8021h;
650 wlandev->macmode = WLAN_MACMODE_NONE;
652 /* Set up the rx queue */
653 skb_queue_head_init(&wlandev->nsd_rxq);
654 tasklet_setup(&wlandev->rx_bh, p80211netdev_rx_bh);
656 /* Allocate and initialize the wiphy struct */
657 wiphy = wlan_create_wiphy(physdev, wlandev);
659 dev_err(physdev, "Failed to alloc wiphy.\n");
663 /* Allocate and initialize the struct device */
664 netdev = alloc_netdev(sizeof(struct wireless_dev), "wlan%d",
665 NET_NAME_UNKNOWN, ether_setup);
667 dev_err(physdev, "Failed to alloc netdev.\n");
668 wlan_free_wiphy(wiphy);
671 wlandev->netdev = netdev;
672 netdev->ml_priv = wlandev;
673 netdev->netdev_ops = &p80211_netdev_ops;
674 wdev = netdev_priv(netdev);
676 wdev->iftype = NL80211_IFTYPE_STATION;
677 netdev->ieee80211_ptr = wdev;
678 netdev->min_mtu = 68;
679 /* 2312 is max 802.11 payload, 20 is overhead,
680 * (ether + llc + snap) and another 8 for wep.
682 netdev->max_mtu = (2312 - 20 - 8);
684 netif_stop_queue(netdev);
685 netif_carrier_off(netdev);
691 /*----------------------------------------------------------------
694 * This function is paired with the wlan_setup routine. It should
695 * be called after unregister_wlandev. Basically, all it does is
696 * free the 'struct device' that's associated with the wlandev.
697 * We do it here because the 'struct device' isn't allocated
698 * explicitly in the driver code, it's done in wlan_setup. To
699 * do the free in the driver might seem like 'magic'.
702 * wlandev ptr to the wlandev structure for the
705 * Should be process thread. We'll assume it might be
706 * interrupt though. When we add support for statically
707 * compiled drivers, this function will be called in the
708 * context of the kernel startup code.
709 *----------------------------------------------------------------
711 void wlan_unsetup(struct wlandevice *wlandev)
713 struct wireless_dev *wdev;
715 tasklet_kill(&wlandev->rx_bh);
717 if (wlandev->netdev) {
718 wdev = netdev_priv(wlandev->netdev);
720 wlan_free_wiphy(wdev->wiphy);
721 free_netdev(wlandev->netdev);
722 wlandev->netdev = NULL;
726 /*----------------------------------------------------------------
729 * Roughly matches the functionality of register_netdev. This function
730 * is called after the driver has successfully probed and set up the
731 * resources for the device. It's now ready to become a named device
732 * in the Linux system.
734 * First we allocate a name for the device (if not already set), then
735 * we call the Linux function register_netdevice.
738 * wlandev ptr to the wlandev structure for the
741 * zero on success, non-zero otherwise.
743 * Can be either interrupt or not.
744 *----------------------------------------------------------------
746 int register_wlandev(struct wlandevice *wlandev)
748 return register_netdev(wlandev->netdev);
751 /*----------------------------------------------------------------
754 * Roughly matches the functionality of unregister_netdev. This
755 * function is called to remove a named device from the system.
757 * First we tell linux that the device should no longer exist.
758 * Then we remove it from the list of known wlan devices.
761 * wlandev ptr to the wlandev structure for the
764 * zero on success, non-zero otherwise.
766 * Can be either interrupt or not.
767 *----------------------------------------------------------------
769 int unregister_wlandev(struct wlandevice *wlandev)
773 unregister_netdev(wlandev->netdev);
775 /* Now to clean out the rx queue */
776 while ((skb = skb_dequeue(&wlandev->nsd_rxq)))
782 /*----------------------------------------------------------------
783 * p80211netdev_hwremoved
785 * Hardware removed notification. This function should be called
786 * immediately after an MSD has detected that the underlying hardware
787 * has been yanked out from under us. The primary things we need
790 * - Prevent any further traffic from the knetdev i/f
791 * - Prevent any further requests from mgmt i/f
792 * - If there are any waitq'd mgmt requests or mgmt-frame exchanges,
794 * - Call the MSD hwremoved function.
796 * The remainder of the cleanup will be handled by unregister().
797 * Our primary goal here is to prevent as much tickling of the MSD
798 * as possible since the MSD is already in a 'wounded' state.
800 * TODO: As new features are added, this function should be
804 * wlandev WLAN network device structure
811 *----------------------------------------------------------------
813 void p80211netdev_hwremoved(struct wlandevice *wlandev)
815 wlandev->hwremoved = 1;
816 if (wlandev->state == WLAN_DEVICE_OPEN)
817 netif_stop_queue(wlandev->netdev);
819 netif_device_detach(wlandev->netdev);
822 /*----------------------------------------------------------------
825 * Classifies the frame, increments the appropriate counter, and
826 * returns 0|1|2 indicating whether the driver should handle, ignore, or
830 * wlandev wlan device structure
831 * fc frame control field
834 * zero if the frame should be handled by the driver,
835 * one if the frame should be ignored
836 * anything else means we drop it.
842 *----------------------------------------------------------------
844 static int p80211_rx_typedrop(struct wlandevice *wlandev, u16 fc)
849 /* Classify frame, increment counter */
850 ftype = WLAN_GET_FC_FTYPE(fc);
851 fstype = WLAN_GET_FC_FSTYPE(fc);
853 case WLAN_FTYPE_MGMT:
854 if ((wlandev->netdev->flags & IFF_PROMISC) ||
855 (wlandev->netdev->flags & IFF_ALLMULTI)) {
859 netdev_dbg(wlandev->netdev, "rx'd mgmt:\n");
862 case WLAN_FSTYPE_ASSOCREQ:
863 wlandev->rx.assocreq++;
865 case WLAN_FSTYPE_ASSOCRESP:
866 wlandev->rx.assocresp++;
868 case WLAN_FSTYPE_REASSOCREQ:
869 wlandev->rx.reassocreq++;
871 case WLAN_FSTYPE_REASSOCRESP:
872 wlandev->rx.reassocresp++;
874 case WLAN_FSTYPE_PROBEREQ:
875 wlandev->rx.probereq++;
877 case WLAN_FSTYPE_PROBERESP:
878 wlandev->rx.proberesp++;
880 case WLAN_FSTYPE_BEACON:
881 wlandev->rx.beacon++;
883 case WLAN_FSTYPE_ATIM:
886 case WLAN_FSTYPE_DISASSOC:
887 wlandev->rx.disassoc++;
889 case WLAN_FSTYPE_AUTHEN:
890 wlandev->rx.authen++;
892 case WLAN_FSTYPE_DEAUTHEN:
893 wlandev->rx.deauthen++;
896 wlandev->rx.mgmt_unknown++;
903 if ((wlandev->netdev->flags & IFF_PROMISC) ||
904 (wlandev->netdev->flags & IFF_ALLMULTI)) {
908 netdev_dbg(wlandev->netdev, "rx'd ctl:\n");
911 case WLAN_FSTYPE_PSPOLL:
912 wlandev->rx.pspoll++;
914 case WLAN_FSTYPE_RTS:
917 case WLAN_FSTYPE_CTS:
920 case WLAN_FSTYPE_ACK:
923 case WLAN_FSTYPE_CFEND:
926 case WLAN_FSTYPE_CFENDCFACK:
927 wlandev->rx.cfendcfack++;
930 wlandev->rx.ctl_unknown++;
936 case WLAN_FTYPE_DATA:
939 case WLAN_FSTYPE_DATAONLY:
940 wlandev->rx.dataonly++;
942 case WLAN_FSTYPE_DATA_CFACK:
943 wlandev->rx.data_cfack++;
945 case WLAN_FSTYPE_DATA_CFPOLL:
946 wlandev->rx.data_cfpoll++;
948 case WLAN_FSTYPE_DATA_CFACK_CFPOLL:
949 wlandev->rx.data__cfack_cfpoll++;
951 case WLAN_FSTYPE_NULL:
952 netdev_dbg(wlandev->netdev, "rx'd data:null\n");
955 case WLAN_FSTYPE_CFACK:
956 netdev_dbg(wlandev->netdev, "rx'd data:cfack\n");
959 case WLAN_FSTYPE_CFPOLL:
960 netdev_dbg(wlandev->netdev, "rx'd data:cfpoll\n");
961 wlandev->rx.cfpoll++;
963 case WLAN_FSTYPE_CFACK_CFPOLL:
964 netdev_dbg(wlandev->netdev, "rx'd data:cfack_cfpoll\n");
965 wlandev->rx.cfack_cfpoll++;
968 wlandev->rx.data_unknown++;
977 static void p80211knetdev_tx_timeout(struct net_device *netdev, unsigned int txqueue)
979 struct wlandevice *wlandev = netdev->ml_priv;
981 if (wlandev->tx_timeout) {
982 wlandev->tx_timeout(wlandev);
984 netdev_warn(netdev, "Implement tx_timeout for %s\n",
986 netif_wake_queue(wlandev->netdev);