Deleted Added
full compact
if_zyd.c (189452) if_zyd.c (190526)
1/* $OpenBSD: if_zyd.c,v 1.52 2007/02/11 00:08:04 jsg Exp $ */
2/* $NetBSD: if_zyd.c,v 1.7 2007/06/21 04:04:29 kiyohara Exp $ */
1/* $OpenBSD: if_zyd.c,v 1.52 2007/02/11 00:08:04 jsg Exp $ */
2/* $NetBSD: if_zyd.c,v 1.7 2007/06/21 04:04:29 kiyohara Exp $ */
3/* $FreeBSD: head/sys/dev/usb/wlan/if_zyd.c 189452 2009-03-06 17:04:47Z thompsa $ */
3/* $FreeBSD: head/sys/dev/usb/wlan/if_zyd.c 190526 2009-03-29 17:59:14Z sam $ */
4
5/*-
6 * Copyright (c) 2006 by Damien Bergamini <damien.bergamini@free.fr>
7 * Copyright (c) 2006 by Florian Stoehr <ich@florian-stoehr.de>
8 *
9 * Permission to use, copy, modify, and distribute this software for any
10 * purpose with or without fee is hereby granted, provided that the above
11 * copyright notice and this permission notice appear in all copies.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 */
21
22#include <sys/cdefs.h>
4
5/*-
6 * Copyright (c) 2006 by Damien Bergamini <damien.bergamini@free.fr>
7 * Copyright (c) 2006 by Florian Stoehr <ich@florian-stoehr.de>
8 *
9 * Permission to use, copy, modify, and distribute this software for any
10 * purpose with or without fee is hereby granted, provided that the above
11 * copyright notice and this permission notice appear in all copies.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 */
21
22#include <sys/cdefs.h>
23__FBSDID("$FreeBSD: head/sys/dev/usb/wlan/if_zyd.c 189452 2009-03-06 17:04:47Z thompsa $");
23__FBSDID("$FreeBSD: head/sys/dev/usb/wlan/if_zyd.c 190526 2009-03-29 17:59:14Z sam $");
24
25/*
26 * ZyDAS ZD1211/ZD1211B USB WLAN driver.
27 */
28
29#include "usbdevs.h"
30#include <dev/usb/usb.h>
31#include <dev/usb/usb_mfunc.h>

--- 359 unchanged lines hidden (view full) ---

391 ifp->if_start = zyd_start;
392 IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
393 IFQ_SET_READY(&ifp->if_snd);
394
395 ic = ifp->if_l2com;
396 ic->ic_ifp = ifp;
397 ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */
398 ic->ic_opmode = IEEE80211_M_STA;
24
25/*
26 * ZyDAS ZD1211/ZD1211B USB WLAN driver.
27 */
28
29#include "usbdevs.h"
30#include <dev/usb/usb.h>
31#include <dev/usb/usb_mfunc.h>

--- 359 unchanged lines hidden (view full) ---

391 ifp->if_start = zyd_start;
392 IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
393 IFQ_SET_READY(&ifp->if_snd);
394
395 ic = ifp->if_l2com;
396 ic->ic_ifp = ifp;
397 ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */
398 ic->ic_opmode = IEEE80211_M_STA;
399 IEEE80211_ADDR_COPY(ic->ic_myaddr, sc->sc_bssid);
400
401 /* set device capabilities */
402 ic->ic_caps =
403 IEEE80211_C_STA /* station mode */
404 | IEEE80211_C_MONITOR /* monitor mode */
405 | IEEE80211_C_SHPREAMBLE /* short preamble supported */
406 | IEEE80211_C_SHSLOT /* short slot time supported */
407 | IEEE80211_C_BGSCAN /* capable of bg scanning */
408 | IEEE80211_C_WPA /* 802.11i */
409 ;
410
411 bands = 0;
412 setbit(&bands, IEEE80211_MODE_11B);
413 setbit(&bands, IEEE80211_MODE_11G);
414 ieee80211_init_channels(ic, NULL, &bands);
415
399
400 /* set device capabilities */
401 ic->ic_caps =
402 IEEE80211_C_STA /* station mode */
403 | IEEE80211_C_MONITOR /* monitor mode */
404 | IEEE80211_C_SHPREAMBLE /* short preamble supported */
405 | IEEE80211_C_SHSLOT /* short slot time supported */
406 | IEEE80211_C_BGSCAN /* capable of bg scanning */
407 | IEEE80211_C_WPA /* 802.11i */
408 ;
409
410 bands = 0;
411 setbit(&bands, IEEE80211_MODE_11B);
412 setbit(&bands, IEEE80211_MODE_11G);
413 ieee80211_init_channels(ic, NULL, &bands);
414
416 ieee80211_ifattach(ic);
415 ieee80211_ifattach(ic, sc->sc_bssid);
417 ic->ic_newassoc = zyd_newassoc;
418 ic->ic_raw_xmit = zyd_raw_xmit;
419 ic->ic_node_alloc = zyd_node_alloc;
420 ic->ic_scan_start = zyd_scan_start;
421 ic->ic_scan_end = zyd_scan_end;
422 ic->ic_set_channel = zyd_set_channel;
423
424 ic->ic_vap_create = zyd_vap_create;

--- 2429 unchanged lines hidden (view full) ---

2854 zyd_write32_m(sc, ZYD_MAC_ENCRYPTION_TYPE, ZYD_ENC_SNIFFER);
2855
2856 sc->sc_flags |= ZYD_FLAG_INITONCE;
2857 }
2858
2859 if (ifp->if_drv_flags & IFF_DRV_RUNNING)
2860 zyd_stop_task(pm);
2861
416 ic->ic_newassoc = zyd_newassoc;
417 ic->ic_raw_xmit = zyd_raw_xmit;
418 ic->ic_node_alloc = zyd_node_alloc;
419 ic->ic_scan_start = zyd_scan_start;
420 ic->ic_scan_end = zyd_scan_end;
421 ic->ic_set_channel = zyd_set_channel;
422
423 ic->ic_vap_create = zyd_vap_create;

--- 2429 unchanged lines hidden (view full) ---

2853 zyd_write32_m(sc, ZYD_MAC_ENCRYPTION_TYPE, ZYD_ENC_SNIFFER);
2854
2855 sc->sc_flags |= ZYD_FLAG_INITONCE;
2856 }
2857
2858 if (ifp->if_drv_flags & IFF_DRV_RUNNING)
2859 zyd_stop_task(pm);
2860
2862 IEEE80211_ADDR_COPY(ic->ic_myaddr, IF_LLADDR(ifp));
2863 DPRINTF(sc, ZYD_DEBUG_INIT, "setting MAC address to %s\n",
2864 ether_sprintf(ic->ic_myaddr));
2865 error = zyd_set_macaddr(sc, ic->ic_myaddr);
2861 DPRINTF(sc, ZYD_DEBUG_INIT, "setting MAC address to %6D\n",
2862 IF_LLADDR(ifp), ":");
2863 error = zyd_set_macaddr(sc, IF_LLADDR(ifp));
2866 if (error != 0)
2867 return;
2868
2869 /* set basic rates */
2870 if (ic->ic_curmode == IEEE80211_MODE_11B)
2871 zyd_write32_m(sc, ZYD_MAC_BAS_RATE, 0x0003);
2872 else if (ic->ic_curmode == IEEE80211_MODE_11A)
2873 zyd_write32_m(sc, ZYD_MAC_BAS_RATE, 0x1500);

--- 309 unchanged lines hidden ---
2864 if (error != 0)
2865 return;
2866
2867 /* set basic rates */
2868 if (ic->ic_curmode == IEEE80211_MODE_11B)
2869 zyd_write32_m(sc, ZYD_MAC_BAS_RATE, 0x0003);
2870 else if (ic->ic_curmode == IEEE80211_MODE_11A)
2871 zyd_write32_m(sc, ZYD_MAC_BAS_RATE, 0x1500);

--- 309 unchanged lines hidden ---