• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500-V1.0.1.40_1.0.68/src/linux/linux-2.6/drivers/net/wireless/

Lines Matching defs:zd

117 	struct zd1201 *zd = urb->context;
127 dev_warn(&zd->usb->dev, "%s: urb failed: %d\n",
128 zd->dev->name, urb->status);
146 static int zd1201_docmd(struct zd1201 *zd, int cmd, int parm0,
168 usb_fill_bulk_urb(urb, zd->usb, usb_sndbulkpipe(zd->usb, zd->endp_out2),
169 command, 16, zd1201_usbfree, zd);
182 struct zd1201 *zd = urb->context;
183 netif_wake_queue(zd->dev);
190 struct zd1201 *zd = urb->context;
196 if (!zd)
207 dev_warn(&zd->usb->dev, "%s: rx urb failed: %d\n",
208 zd->dev->name, urb->status);
218 memcpy(zd->rxdata, data, urb->actual_length);
219 zd->rxlen = urb->actual_length;
220 zd->rxdatas = 1;
221 wake_up(&zd->rxdataq);
236 netif_carrier_on(zd->dev);
239 netif_carrier_off(zd->dev);
242 netif_carrier_off(zd->dev);
245 netif_carrier_on(zd->dev);
248 netif_carrier_off(zd->dev);
272 wireless_send_event(zd->dev, event, &wrqu, NULL);
285 wireless_send_event(zd->dev, IWEVEXPIRED, &wrqu, NULL);
289 zd->rxlen = 0;
293 if (copylen+zd->rxlen > sizeof(zd->rxdata))
295 memcpy(zd->rxdata+zd->rxlen, data+i+4, copylen);
296 zd->rxlen += copylen;
300 zd->rxdatas = 1;
301 wake_up(&zd->rxdataq);
317 if (zd->monitor) {
331 skb->protocol = eth_type_trans(skb, zd->dev);
332 zd->stats.rx_packets++;
333 zd->stats.rx_bytes += skb->len;
360 hlist_add_head(&frag->fnode, &zd->fraglist);
363 hlist_for_each_entry(frag, node, &zd->fraglist, fnode)
388 skb->protocol = eth_type_trans(skb, zd->dev);
389 zd->stats.rx_packets++;
390 zd->stats.rx_bytes += skb->len;
397 urb->dev = zd->usb;
403 zd->rxlen = 0;
404 zd->rxdatas = 1;
405 wake_up(&zd->rxdataq);
411 static int zd1201_getconfig(struct zd1201 *zd, int rid, void *riddata,
421 zd->rxdatas = 0;
422 err = zd1201_docmd(zd, ZD1201_CMDCODE_ACCESS, rid, 0, 0);
426 wait_event_interruptible(zd->rxdataq, zd->rxdatas);
427 if (!zd->rxlen)
430 code = le16_to_cpu(*(__le16*)(&zd->rxdata[4]));
431 rid_fid = le16_to_cpu(*(__le16*)(&zd->rxdata[6]));
432 length = le16_to_cpu(*(__le16*)(&zd->rxdata[8]));
433 if (length > zd->rxlen)
434 length = zd->rxlen-6;
442 dev_dbg(&zd->usb->dev, "riddatalen mismatches, expected=%u, (packet=%u) length=%u, rid=0x%04X, rid_fid=0x%04X\n",
443 riddatalen, zd->rxlen, length, rid, rid_fid);
447 zd->rxdatas = 0;
449 err = zd1201_docmd(zd, ZD1201_CMDCODE_SETRXRID, rid, 0, length);
454 wait_event_interruptible(zd->rxdataq, zd->rxdatas);
455 if (!zd->rxlen)
458 if (zd->rxdata[zd->rxlen - 1] != ZD1201_PACKET_RESOURCE) {
459 dev_dbg(&zd->usb->dev, "Packet type mismatch: 0x%x not 0x3\n",
460 zd->rxdata[zd->rxlen-1]);
465 pdata = zd->rxdata;
466 length = zd->rxlen;
474 dev_dbg(&zd->usb->dev, "Rx Resource packet type error: %02X\n",
511 static int zd1201_setconfig(struct zd1201 *zd, int rid, void *buf, int len, int wait)
522 zd->rxdatas = 0;
523 zd->rxlen = 0;
552 usb_fill_bulk_urb(urb, zd->usb, usb_sndbulkpipe(zd->usb,
553 zd->endp_out2), request, 16, zd1201_usbfree, zd);
573 usb_fill_bulk_urb(urb, zd->usb, usb_sndbulkpipe(zd->usb, zd->endp_out2),
574 request, 16, zd1201_usbfree, zd);
580 wait_event_interruptible(zd->rxdataq, zd->rxdatas);
581 if (!zd->rxlen || le16_to_cpu(*(__le16*)&zd->rxdata[6]) != rid) {
582 dev_dbg(&zd->usb->dev, "wrong or no RID received\n");
593 static inline int zd1201_getconfig16(struct zd1201 *zd, int rid, short *val)
598 err = zd1201_getconfig(zd, rid, &zdval, sizeof(__le16));
605 static inline int zd1201_setconfig16(struct zd1201 *zd, int rid, short val)
608 return (zd1201_setconfig(zd, rid, &zdval, sizeof(__le16), 1));
611 static int zd1201_drvr_start(struct zd1201 *zd)
622 usb_fill_bulk_urb(zd->rx_urb, zd->usb,
623 usb_rcvbulkpipe(zd->usb, zd->endp_in), buffer, ZD1201_RXSIZE,
624 zd1201_usbrx, zd);
626 err = usb_submit_urb(zd->rx_urb, GFP_KERNEL);
630 err = zd1201_docmd(zd, ZD1201_CMDCODE_INIT, 0, 0, 0);
634 err = zd1201_getconfig(zd, ZD1201_RID_CNFMAXTXBUFFERNUMBER, &zdmax,
641 err = zd1201_docmd(zd, ZD1201_CMDCODE_ALLOC, 1514, 0, 0);
649 usb_kill_urb(zd->rx_urb);
661 static int zd1201_enable(struct zd1201 *zd)
665 if (zd->mac_enabled)
668 err = zd1201_docmd(zd, ZD1201_CMDCODE_ENABLE, 0, 0, 0);
670 zd->mac_enabled = 1;
672 if (zd->monitor)
673 err = zd1201_setconfig16(zd, ZD1201_RID_PROMISCUOUSMODE, 1);
678 static int zd1201_disable(struct zd1201 *zd)
682 if (!zd->mac_enabled)
684 if (zd->monitor) {
685 err = zd1201_setconfig16(zd, ZD1201_RID_PROMISCUOUSMODE, 0);
690 err = zd1201_docmd(zd, ZD1201_CMDCODE_DISABLE, 0, 0, 0);
692 zd->mac_enabled = 0;
696 static int zd1201_mac_reset(struct zd1201 *zd)
698 if (!zd->mac_enabled)
700 zd1201_disable(zd);
701 return zd1201_enable(zd);
704 static int zd1201_join(struct zd1201 *zd, char *essid, int essidlen)
709 err = zd1201_disable(zd);
715 err = zd1201_setconfig16(zd, ZD1201_RID_CNFAUTHENTICATION, val);
721 if (!zd->ap) { /* Normal station */
722 err = zd1201_setconfig(zd, ZD1201_RID_CNFDESIREDSSID, buf,
727 err = zd1201_setconfig(zd, ZD1201_RID_CNFOWNSSID, buf,
733 err = zd1201_setconfig(zd, ZD1201_RID_CNFOWNMACADDR,
734 zd->dev->dev_addr, zd->dev->addr_len, 1);
738 err = zd1201_enable(zd);
748 struct zd1201 *zd = (struct zd1201 *)dev->priv;
751 if (!zd->mac_enabled)
752 zd1201_join(zd, zd->essid, zd->essidlen);
782 zd 1 null byte, zd1201 packet type
786 struct zd1201 *zd = (struct zd1201 *)dev->priv;
787 unsigned char *txbuf = zd->txdata;
789 struct urb *urb = zd->tx_urb;
791 if (!zd->mac_enabled || zd->monitor) {
792 zd->stats.tx_dropped++;
817 usb_fill_bulk_urb(urb, zd->usb, usb_sndbulkpipe(zd->usb, zd->endp_out),
818 txbuf, txbuflen, zd1201_usbtx, zd);
820 err = usb_submit_urb(zd->tx_urb, GFP_ATOMIC);
822 zd->stats.tx_errors++;
826 zd->stats.tx_packets++;
827 zd->stats.tx_bytes += skb->len;
836 struct zd1201 *zd = (struct zd1201 *)dev->priv;
838 if (!zd)
840 dev_warn(&zd->usb->dev, "%s: TX timeout, shooting down urb\n",
842 usb_unlink_urb(zd->tx_urb);
843 zd->stats.tx_errors++;
851 struct zd1201 *zd = (struct zd1201 *)dev->priv;
854 if (!zd)
857 err = zd1201_setconfig(zd, ZD1201_RID_CNFOWNMACADDR,
863 return zd1201_mac_reset(zd);
868 struct zd1201 *zd = (struct zd1201 *)dev->priv;
870 return &zd->stats;
875 struct zd1201 *zd = (struct zd1201 *)dev->priv;
877 return &zd->iwstats;
882 struct zd1201 *zd = (struct zd1201 *)dev->priv;
894 zd1201_setconfig(zd, ZD1201_RID_CNFGROUPADDRESS, reqbuf,
902 struct zd1201 *zd = (struct zd1201 *)dev->priv;
904 return zd1201_mac_reset(zd);
917 struct zd1201 *zd = (struct zd1201 *)dev->priv;
930 err = zd1201_setconfig16(zd, ZD1201_RID_CNFOWNCHANNEL, channel);
934 zd1201_mac_reset(zd);
942 struct zd1201 *zd = (struct zd1201 *)dev->priv;
946 err = zd1201_getconfig16(zd, ZD1201_RID_CNFOWNCHANNEL, &channel);
958 struct zd1201 *zd = (struct zd1201 *)dev->priv;
963 if (zd->ap) {
969 err = zd1201_setconfig16(zd, ZD1201_RID_PROMISCUOUSMODE, 0);
972 zd->dev->type = ARPHRD_ETHER;
976 zd->dev->type = ARPHRD_IEEE80211;
981 zd1201_join(zd, "\0-*#\0", 5);
996 err = zd1201_setconfig16(zd, ZD1201_RID_CNFPORTTYPE, porttype);
999 if (zd->monitor && !monitor) {
1000 zd1201_disable(zd);
1001 *(__le16 *)buffer = cpu_to_le16(zd->essidlen);
1002 memcpy(buffer+2, zd->essid, zd->essidlen);
1003 err = zd1201_setconfig(zd, ZD1201_RID_CNFDESIREDSSID,
1008 zd->monitor = monitor;
1012 zd1201_mac_reset(zd);
1020 struct zd1201 *zd = (struct zd1201 *)dev->priv;
1024 err = zd1201_getconfig16(zd, ZD1201_RID_CNFPORTTYPE, &porttype);
1044 dev_dbg(&zd->usb->dev, "Unknown porttype: %d\n",
1048 if (zd->monitor)
1096 struct zd1201 *zd = (struct zd1201 *)dev->priv;
1099 if (!zd1201_getconfig(zd, ZD1201_RID_COMMSQUALITY, buffer, 6)) {
1105 /*zd->iwstats.qual.qual = le16_to_cpu(((__le16 *)buffer)[0]);*/
1106 zd->iwstats.qual.level = le16_to_cpu(((__le16 *)buffer)[1]);
1107 /*zd->iwstats.qual.noise = le16_to_cpu(((__le16 *)buffer)[2]);*/
1108 zd->iwstats.qual.updated = 2;
1111 return zd1201_getconfig(zd, ZD1201_RID_CURRENTBSSID, ap_addr->sa_data, 6);
1124 struct zd1201 *zd = (struct zd1201 *)dev->priv;
1131 if (zd->ap)
1135 enabled_save = zd->mac_enabled;
1136 zd1201_enable(zd);
1138 zd->rxdatas = 0;
1139 err = zd1201_docmd(zd, ZD1201_CMDCODE_INQUIRE,
1144 wait_event_interruptible(zd->rxdataq, zd->rxdatas);
1145 if (!zd->rxlen)
1148 if (le16_to_cpu(*(__le16*)&zd->rxdata[2]) != ZD1201_INQ_SCANRESULTS)
1151 for(i=8; i<zd->rxlen; i+=62) {
1154 memcpy(iwe.u.ap_addr.sa_data, zd->rxdata+i+6, 6);
1158 iwe.u.data.length = zd->rxdata[i+16];
1160 cev = iwe_stream_add_point(cev, end_buf, &iwe, zd->rxdata+i+18);
1163 if (zd->rxdata[i+14]&0x01)
1170 iwe.u.freq.m = zd->rxdata[i+0];
1177 for (j=0; j<10; j++) if (zd->rxdata[i+50+j]) {
1178 iwe.u.bitrate.value = (zd->rxdata[i+50+j]&0x7f)*500000;
1185 if (zd->rxdata[i+14]&0x10)
1192 iwe.u.qual.qual = zd->rxdata[i+4];
1193 iwe.u.qual.noise= zd->rxdata[i+2]/10-100;
1194 iwe.u.qual.level = (256+zd->rxdata[i+4]*100)/255-100;
1200 zd1201_disable(zd);
1211 struct zd1201 *zd = (struct zd1201 *)dev->priv;
1217 zd->essidlen = data->length;
1218 memset(zd->essid, 0, IW_ESSID_MAX_SIZE+1);
1219 memcpy(zd->essid, essid, data->length);
1220 return zd1201_join(zd, zd->essid, zd->essidlen);
1226 struct zd1201 *zd = (struct zd1201 *)dev->priv;
1228 memcpy(essid, zd->essid, zd->essidlen);
1230 data->length = zd->essidlen;
1247 struct zd1201 *zd = (struct zd1201 *)dev->priv;
1270 err = zd1201_setconfig16(zd, ZD1201_RID_TXRATECNTL, rate);
1274 return zd1201_mac_reset(zd);
1280 struct zd1201 *zd = (struct zd1201 *)dev->priv;
1284 err = zd1201_getconfig16(zd, ZD1201_RID_CURRENTTXRATE, &rate);
1313 struct zd1201 *zd = (struct zd1201 *)dev->priv;
1324 err = zd1201_setconfig16(zd, ZD1201_RID_CNFRTSTHRESHOLD, val);
1327 return zd1201_mac_reset(zd);
1333 struct zd1201 *zd = (struct zd1201 *)dev->priv;
1337 err = zd1201_getconfig16(zd, ZD1201_RID_CNFRTSTHRESHOLD, &rtst);
1350 struct zd1201 *zd = (struct zd1201 *)dev->priv;
1362 err = zd1201_setconfig16(zd, ZD1201_RID_CNFFRAGTHRESHOLD, val);
1365 return zd1201_mac_reset(zd);
1371 struct zd1201 *zd = (struct zd1201 *)dev->priv;
1375 err = zd1201_getconfig16(zd, ZD1201_RID_CNFFRAGTHRESHOLD, &fragt);
1400 struct zd1201 *zd = (struct zd1201 *)dev->priv;
1409 err = zd1201_getconfig16(zd,ZD1201_RID_CNFDEFAULTKEYID,&i);
1413 err = zd1201_setconfig16(zd, ZD1201_RID_CNFDEFAULTKEYID, i);
1422 err = zd1201_setconfig(zd, rid, key, erq->length, 1);
1425 zd->encode_keylen[i] = erq->length;
1426 memcpy(zd->encode_keys[i], key, erq->length);
1431 zd->encode_enabled = 1;
1433 zd->encode_enabled = 0;
1436 zd->encode_restricted = 1;
1438 zd->encode_restricted = 0;
1439 err = zd1201_setconfig16(zd, ZD1201_RID_CNFWEBFLAGS, i);
1443 if (zd->encode_enabled)
1447 err = zd1201_setconfig16(zd, ZD1201_RID_CNFAUTHENTICATION, i);
1451 return zd1201_mac_reset(zd);
1457 struct zd1201 *zd = (struct zd1201 *)dev->priv;
1461 if (zd->encode_enabled)
1465 if (zd->encode_restricted)
1472 err = zd1201_getconfig16(zd, ZD1201_RID_CNFDEFAULTKEYID, &i);
1481 erq->length = zd->encode_keylen[i];
1482 memcpy(key, zd->encode_keys[i], erq->length);
1490 struct zd1201 *zd = (struct zd1201 *)dev->priv;
1498 err = zd1201_setconfig16(zd,
1505 err = zd1201_getconfig16(zd,
1514 err = zd1201_setconfig16(zd, ZD1201_RID_CNFPMEPS,
1523 return zd1201_setconfig16(zd, ZD1201_RID_CNFPMENABLED, enabled);
1529 struct zd1201 *zd = (struct zd1201 *)dev->priv;
1533 err = zd1201_getconfig16(zd, ZD1201_RID_CNFPMENABLED, &enabled);
1536 err = zd1201_getconfig16(zd, ZD1201_RID_CNFPMEPS, &level);
1539 err = zd1201_getconfig16(zd, ZD1201_RID_CNFMAXSLEEPDURATION, &duration);
1616 struct zd1201 *zd = (struct zd1201 *)dev->priv;
1618 if (!zd->ap)
1621 return zd1201_setconfig16(zd, ZD1201_RID_CNFHOSTAUTH, rrq->value);
1627 struct zd1201 *zd = (struct zd1201 *)dev->priv;
1631 if (!zd->ap)
1634 err = zd1201_getconfig16(zd, ZD1201_RID_CNFHOSTAUTH, &hostauth);
1646 struct zd1201 *zd = (struct zd1201 *)dev->priv;
1649 if (!zd->ap)
1656 return zd1201_setconfig(zd, ZD1201_RID_AUTHENTICATESTA, buffer, 10, 1);
1662 struct zd1201 *zd = (struct zd1201 *)dev->priv;
1665 if (!zd->ap)
1668 err = zd1201_setconfig16(zd, ZD1201_RID_CNFMAXASSOCSTATIONS, rrq->value);
1677 struct zd1201 *zd = (struct zd1201 *)dev->priv;
1681 if (!zd->ap)
1684 err = zd1201_getconfig16(zd, ZD1201_RID_CNFMAXASSOCSTATIONS, &maxassoc);
1728 struct zd1201 *zd;
1736 zd = kzalloc(sizeof(struct zd1201), GFP_KERNEL);
1737 if (!zd)
1739 zd->ap = ap;
1740 zd->usb = usb;
1741 zd->removed = 0;
1742 init_waitqueue_head(&zd->rxdataq);
1743 INIT_HLIST_HEAD(&zd->fraglist);
1745 err = zd1201_fw_upload(usb, zd->ap);
1751 zd->endp_in = 1;
1752 zd->endp_out = 1;
1753 zd->endp_out2 = 2;
1754 zd->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
1755 zd->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
1756 if (!zd->rx_urb || !zd->tx_urb)
1760 err = zd1201_drvr_start(zd);
1764 err = zd1201_setconfig16(zd, ZD1201_RID_CNFMAXDATALEN, 2312);
1768 err = zd1201_setconfig16(zd, ZD1201_RID_TXRATECNTL,
1773 zd->dev = alloc_etherdev(0);
1774 if (!zd->dev)
1777 zd->dev->priv = zd;
1778 zd->dev->open = zd1201_net_open;
1779 zd->dev->stop = zd1201_net_stop;
1780 zd->dev->get_stats = zd1201_get_stats;
1781 zd->dev->wireless_handlers =
1783 zd->dev->hard_start_xmit = zd1201_hard_start_xmit;
1784 zd->dev->watchdog_timeo = ZD1201_TX_TIMEOUT;
1785 zd->dev->tx_timeout = zd1201_tx_timeout;
1786 zd->dev->set_multicast_list = zd1201_set_multicast;
1787 zd->dev->set_mac_address = zd1201_set_mac_address;
1788 strcpy(zd->dev->name, "wlan%d");
1790 err = zd1201_getconfig(zd, ZD1201_RID_CNFOWNMACADDR,
1791 zd->dev->dev_addr, zd->dev->addr_len);
1795 /* Set wildcard essid to match zd->essid */
1797 err = zd1201_setconfig(zd, ZD1201_RID_CNFDESIREDSSID, buf,
1802 if (zd->ap)
1806 err = zd1201_setconfig16(zd, ZD1201_RID_CNFPORTTYPE, porttype);
1810 SET_NETDEV_DEV(zd->dev, &usb->dev);
1812 err = register_netdev(zd->dev);
1816 zd->dev->name);
1818 usb_set_intfdata(interface, zd);
1819 zd1201_enable(zd); /* zd1201 likes to startup enabled, */
1820 zd1201_disable(zd); /* interfering with all the wifis in range */
1824 free_netdev(zd->dev);
1827 zd1201_docmd(zd, ZD1201_CMDCODE_INIT, 0, 0, 0);
1829 usb_free_urb(zd->tx_urb);
1830 usb_free_urb(zd->rx_urb);
1831 kfree(zd);
1837 struct zd1201 *zd=(struct zd1201 *)usb_get_intfdata(interface);
1841 if (!zd)
1844 if (zd->dev) {
1845 unregister_netdev(zd->dev);
1846 free_netdev(zd->dev);
1849 hlist_for_each_entry_safe(frag, node, node2, &zd->fraglist, fnode) {
1855 if (zd->tx_urb) {
1856 usb_kill_urb(zd->tx_urb);
1857 usb_free_urb(zd->tx_urb);
1859 if (zd->rx_urb) {
1860 usb_kill_urb(zd->rx_urb);
1861 usb_free_urb(zd->rx_urb);
1863 kfree(zd);
1871 struct zd1201 *zd = usb_get_intfdata(interface);
1873 netif_device_detach(zd->dev);
1875 zd->was_enabled = zd->mac_enabled;
1877 if (zd->was_enabled)
1878 return zd1201_disable(zd);
1885 struct zd1201 *zd = usb_get_intfdata(interface);
1887 if (!zd || !zd->dev)
1890 netif_device_attach(zd->dev);
1892 if (zd->was_enabled)
1893 return zd1201_enable(zd);