Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v2.6.35-rc2 1143 lines 36 kB view raw
1/* 2 * Copyright (c) 2007-2008 Atheros Communications Inc. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16/* Module Name : usbdrv.c */ 17/* */ 18/* Abstract */ 19/* This module contains network interface up/down related functions.*/ 20/* */ 21/* NOTES */ 22/* Platform dependent. */ 23/* */ 24/************************************************************************/ 25 26/* src/usbdrv.c */ 27 28#define ZM_PIBSS_MODE 0 29#define ZM_AP_MODE 0 30#define ZM_CHANNEL 11 31#define ZM_WEP_MOME 0 32#define ZM_SHARE_AUTH 0 33#define ZM_DISABLE_XMIT 0 34 35#include "usbdrv.h" 36#include "oal_dt.h" 37#include "80211core/pub_zfi.h" 38 39#include "linux/netlink.h" 40#include "linux/rtnetlink.h" 41#include "linux/slab.h" 42 43#include <net/iw_handler.h> 44 45#ifdef ZM_HOSTAPD_SUPPORT 46#include "athr_common.h" 47#endif 48 49extern void zfDumpDescriptor(zdev_t* dev, u16_t type); 50//extern void zfiWlanQueryMacAddress(zdev_t* dev, u8_t* addr); 51 52// ISR handler 53irqreturn_t usbdrv_intr(int, void *, struct pt_regs *); 54 55// Network Device interface related function 56int usbdrv_open(struct net_device *); 57int usbdrv_close(struct net_device *); 58int usbdrv_change_mtu(struct net_device *, int); 59int usbdrv_set_mac(struct net_device *, void *); 60int usbdrv_xmit_frame(struct sk_buff *, struct net_device *); 61void usbdrv_set_multi(struct net_device *); 62struct net_device_stats *usbdrv_get_stats(struct net_device *); 63 64//wireless extension helper functions 65int usbdrv_ioctl_setessid(struct net_device *dev, struct iw_point *erq); 66int usbdrv_ioctl_getessid(struct net_device *dev, struct iw_point *erq); 67int usbdrv_ioctl_setrts(struct net_device *dev, struct iw_param *rrq); 68/* Wireless Extension Handler functions */ 69int usbdrvwext_giwmode(struct net_device *dev, struct iw_request_info* info, 70 __u32 *mode, char *extra); 71int zfLnxPrivateIoctl(struct usbdrv_private *macp, struct zdap_ioctl *zdreq); 72 73void zfLnx10msTimer(struct net_device* dev); 74int zfUnregisterWdsDev(struct net_device* parentDev, u16_t wdsId); 75int zfRegisterWdsDev(struct net_device* parentDev, u16_t wdsId); 76int zfWdsOpen(struct net_device *dev); 77int zfWdsClose(struct net_device *dev); 78int zfLnxVapOpen(struct net_device *dev); 79int zfLnxVapClose(struct net_device *dev); 80int zfLnxVapXmitFrame(struct sk_buff *skb, struct net_device *dev); 81int zfLnxRegisterVapDev(struct net_device* parentDev, u16_t vapId); 82int usbdrv_wpa_ioctl(struct net_device *dev, struct athr_wlan_param *zdparm); 83extern u16_t zfLnxGetVapId(zdev_t* dev); 84extern u16_t zfLnxCheckTxBufferCnt(zdev_t *dev); 85extern UsbTxQ_t *zfLnxGetUsbTxBuffer(zdev_t *dev); 86 87extern u16_t zfLnxAuthNotify(zdev_t* dev, u16_t* macAddr); 88extern u16_t zfLnxAsocNotify(zdev_t* dev, u16_t* macAddr, u8_t* body, u16_t bodySize, u16_t port); 89extern u16_t zfLnxDisAsocNotify(zdev_t* dev, u8_t* macAddr, u16_t port); 90extern u16_t zfLnxApConnectNotify(zdev_t* dev, u8_t* macAddr, u16_t port); 91extern void zfLnxConnectNotify(zdev_t* dev, u16_t status, u16_t* bssid); 92extern void zfLnxScanNotify(zdev_t* dev, struct zsScanResult* result); 93extern void zfLnxStatisticsNotify(zdev_t* dev, struct zsStastics* result); 94extern void zfLnxMicFailureNotify(zdev_t* dev, u16_t* addr, u16_t status); 95extern void zfLnxApMicFailureNotify(zdev_t* dev, u8_t* addr, zbuf_t* buf); 96extern void zfLnxIbssPartnerNotify(zdev_t* dev, u16_t status, struct zsPartnerNotifyEvent *event); 97extern void zfLnxMacAddressNotify(zdev_t* dev, u8_t* addr); 98extern void zfLnxSendCompleteIndication(zdev_t* dev, zbuf_t* buf); 99extern void zfLnxRecvEth(zdev_t* dev, zbuf_t* buf, u16_t port); 100extern void zfLnxRestoreBufData(zdev_t* dev, zbuf_t* buf); 101#ifdef ZM_ENABLE_CENC 102extern u16_t zfLnxCencAsocNotify(zdev_t* dev, u16_t* macAddr, u8_t* body, u16_t bodySize, u16_t port); 103#endif //ZM_ENABLE_CENC 104extern void zfLnxWatchDogNotify(zdev_t* dev); 105extern void zfLnxRecv80211(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* addInfo); 106extern u8_t zfLnxCreateThread(zdev_t *dev); 107 108/****************************************************************************** 109* P U B L I C D A T A 110******************************************************************************* 111*/ 112 113/* Definition of Wireless Extension */ 114 115/* wireless extension helper functions */ 116extern int usbdrv_ioctl_setessid(struct net_device *dev, struct iw_point *erq); 117extern int usbdrv_ioctl_setrts(struct net_device *dev, struct iw_param *rrq); 118/* Wireless Extension Handler functions */ 119extern int usbdrvwext_giwname(struct net_device *dev, struct iw_request_info *info, 120 union iwreq_data *wrq, char *extra); 121extern int usbdrvwext_siwfreq(struct net_device *dev, struct iw_request_info *info, 122 struct iw_freq *freq, char *extra); 123extern int usbdrvwext_giwfreq(struct net_device *dev, struct iw_request_info *info, 124 struct iw_freq *freq, char *extra); 125extern int usbdrvwext_siwmode(struct net_device *dev, struct iw_request_info *info, 126 union iwreq_data *wrq, char *extra); 127extern int usbdrvwext_giwmode(struct net_device *dev, struct iw_request_info *info, 128 __u32 *mode, char *extra); 129extern int usbdrvwext_siwsens(struct net_device *dev, struct iw_request_info *info, 130 struct iw_param *sens, char *extra); 131extern int usbdrvwext_giwsens(struct net_device *dev, struct iw_request_info *info, 132 struct iw_param *sens, char *extra); 133extern int usbdrvwext_giwrange(struct net_device *dev, struct iw_request_info *info, 134 struct iw_point *data, char *extra); 135extern int usbdrvwext_siwap(struct net_device *dev, struct iw_request_info *info, 136 struct sockaddr *MacAddr, char *extra); 137extern int usbdrvwext_giwap(struct net_device *dev, struct iw_request_info *info, 138 struct sockaddr *MacAddr, char *extra); 139extern int usbdrvwext_iwaplist(struct net_device *dev, struct iw_request_info *info, 140 struct iw_point *data, char *extra); 141extern int usbdrvwext_siwscan(struct net_device *dev, struct iw_request_info *info, 142 struct iw_point *data, char *extra); 143extern int usbdrvwext_giwscan(struct net_device *dev, struct iw_request_info *info, 144 struct iw_point *data, char *extra); 145extern int usbdrvwext_siwessid(struct net_device *dev, struct iw_request_info *info, 146 struct iw_point *essid, char *extra); 147extern int usbdrvwext_giwessid(struct net_device *dev, struct iw_request_info *info, 148 struct iw_point *essid, char *extra); 149extern int usbdrvwext_siwnickn(struct net_device *dev, struct iw_request_info *info, 150 struct iw_point *data, char *nickname); 151extern int usbdrvwext_giwnickn(struct net_device *dev, struct iw_request_info *info, 152 struct iw_point *data, char *nickname); 153extern int usbdrvwext_siwrate(struct net_device *dev, struct iw_request_info *info, 154 struct iw_param *frq, char *extra); 155extern int usbdrvwext_giwrate(struct net_device *dev, struct iw_request_info *info, 156 struct iw_param *frq, char *extra); 157extern int usbdrvwext_siwrts(struct net_device *dev, struct iw_request_info *info, 158 struct iw_param *rts, char *extra); 159extern int usbdrvwext_giwrts(struct net_device *dev, struct iw_request_info *info, 160 struct iw_param *rts, char *extra); 161extern int usbdrvwext_siwfrag(struct net_device *dev, struct iw_request_info *info, 162 struct iw_param *frag, char *extra); 163extern int usbdrvwext_giwfrag(struct net_device *dev, struct iw_request_info *info, 164 struct iw_param *frag, char *extra); 165extern int usbdrvwext_siwtxpow(struct net_device *dev, struct iw_request_info *info, 166 struct iw_param *rrq, char *extra); 167extern int usbdrvwext_giwtxpow(struct net_device *dev, struct iw_request_info *info, 168 struct iw_param *rrq, char *extra); 169extern int usbdrvwext_siwretry(struct net_device *dev, struct iw_request_info *info, 170 struct iw_param *rrq, char *extra); 171extern int usbdrvwext_giwretry(struct net_device *dev, struct iw_request_info *info, 172 struct iw_param *rrq, char *extra); 173extern int usbdrvwext_siwencode(struct net_device *dev, struct iw_request_info *info, 174 struct iw_point *erq, char *key); 175extern int usbdrvwext_giwencode(struct net_device *dev, struct iw_request_info *info, 176 struct iw_point *erq, char *key); 177extern int usbdrvwext_siwpower(struct net_device *dev, struct iw_request_info *info, 178 struct iw_param *frq, char *extra); 179extern int usbdrvwext_giwpower(struct net_device *dev, struct iw_request_info *info, 180 struct iw_param *frq, char *extra); 181extern int usbdrv_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); 182/* 183 * Structures to export the Wireless Handlers 184 */ 185 186struct iw_priv_args usbdrv_private_args[] = { 187// { SIOCIWFIRSTPRIV + 0x0, 0, 0, "list_bss" }, 188// { SIOCIWFIRSTPRIV + 0x1, 0, 0, "card_reset" }, 189 { SIOCIWFIRSTPRIV + 0x2, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_auth" }, /* 0 - open, 1 - shared key */ 190 { SIOCIWFIRSTPRIV + 0x3, 0, IW_PRIV_TYPE_CHAR | 12, "get_auth" }, 191// { SIOCIWFIRSTPRIV + 0x4, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_preamble" }, /* 0 - long, 1 - short */ 192// { SIOCIWFIRSTPRIV + 0x5, 0, IW_PRIV_TYPE_CHAR | 6, "get_preamble" }, 193// { SIOCIWFIRSTPRIV + 0x6, 0, 0, "cnt" }, 194// { SIOCIWFIRSTPRIV + 0x7, 0, 0, "regs" }, 195// { SIOCIWFIRSTPRIV + 0x8, 0, 0, "probe" }, 196// { SIOCIWFIRSTPRIV + 0x9, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "dbg_flag" }, 197// { SIOCIWFIRSTPRIV + 0xA, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "connect" }, 198// { SIOCIWFIRSTPRIV + 0xB, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_mac_mode" }, 199// { SIOCIWFIRSTPRIV + 0xC, 0, IW_PRIV_TYPE_CHAR | 12, "get_mac_mode" }, 200}; 201 202static iw_handler usbdrvwext_handler[] = { 203 (iw_handler) NULL, /* SIOCSIWCOMMIT */ 204 (iw_handler) usbdrvwext_giwname, /* SIOCGIWNAME */ 205 (iw_handler) NULL, /* SIOCSIWNWID */ 206 (iw_handler) NULL, /* SIOCGIWNWID */ 207 (iw_handler) usbdrvwext_siwfreq, /* SIOCSIWFREQ */ 208 (iw_handler) usbdrvwext_giwfreq, /* SIOCGIWFREQ */ 209 (iw_handler) usbdrvwext_siwmode, /* SIOCSIWMODE */ 210 (iw_handler) usbdrvwext_giwmode, /* SIOCGIWMODE */ 211 (iw_handler) usbdrvwext_siwsens, /* SIOCSIWSENS */ 212 (iw_handler) usbdrvwext_giwsens, /* SIOCGIWSENS */ 213 (iw_handler) NULL, /* not used */ /* SIOCSIWRANGE */ 214 (iw_handler) usbdrvwext_giwrange, /* SIOCGIWRANGE */ 215 (iw_handler) NULL, /* not used */ /* SIOCSIWPRIV */ 216 (iw_handler) NULL, /* kernel code */ /* SIOCGIWPRIV */ 217 (iw_handler) NULL, /* not used */ /* SIOCSIWSTATS */ 218 (iw_handler) NULL, /* kernel code */ /* SIOCGIWSTATS */ 219 (iw_handler) NULL, /* SIOCSIWSPY */ 220 (iw_handler) NULL, /* SIOCGIWSPY */ 221 (iw_handler) NULL, /* -- hole -- */ 222 (iw_handler) NULL, /* -- hole -- */ 223 (iw_handler) usbdrvwext_siwap, /* SIOCSIWAP */ 224 (iw_handler) usbdrvwext_giwap, /* SIOCGIWAP */ 225 (iw_handler) NULL, /* -- hole -- */ 226 (iw_handler) usbdrvwext_iwaplist, /* SIOCGIWAPLIST */ 227 (iw_handler) usbdrvwext_siwscan, /* SIOCSIWSCAN */ 228 (iw_handler) usbdrvwext_giwscan, /* SIOCGIWSCAN */ 229 (iw_handler) usbdrvwext_siwessid, /* SIOCSIWESSID */ 230 (iw_handler) usbdrvwext_giwessid, /* SIOCGIWESSID */ 231 232 (iw_handler) usbdrvwext_siwnickn, /* SIOCSIWNICKN */ 233 (iw_handler) usbdrvwext_giwnickn, /* SIOCGIWNICKN */ 234 (iw_handler) NULL, /* -- hole -- */ 235 (iw_handler) NULL, /* -- hole -- */ 236 (iw_handler) usbdrvwext_siwrate, /* SIOCSIWRATE */ 237 (iw_handler) usbdrvwext_giwrate, /* SIOCGIWRATE */ 238 (iw_handler) usbdrvwext_siwrts, /* SIOCSIWRTS */ 239 (iw_handler) usbdrvwext_giwrts, /* SIOCGIWRTS */ 240 (iw_handler) usbdrvwext_siwfrag, /* SIOCSIWFRAG */ 241 (iw_handler) usbdrvwext_giwfrag, /* SIOCGIWFRAG */ 242 (iw_handler) usbdrvwext_siwtxpow, /* SIOCSIWTXPOW */ 243 (iw_handler) usbdrvwext_giwtxpow, /* SIOCGIWTXPOW */ 244 (iw_handler) usbdrvwext_siwretry, /* SIOCSIWRETRY */ 245 (iw_handler) usbdrvwext_giwretry, /* SIOCGIWRETRY */ 246 (iw_handler) usbdrvwext_siwencode, /* SIOCSIWENCODE */ 247 (iw_handler) usbdrvwext_giwencode, /* SIOCGIWENCODE */ 248 (iw_handler) usbdrvwext_siwpower, /* SIOCSIWPOWER */ 249 (iw_handler) usbdrvwext_giwpower, /* SIOCGIWPOWER */ 250}; 251 252static const iw_handler usbdrv_private_handler[] = 253{ 254 //(iw_handler) usbdrvwext_setparam, /* SIOCWFIRSTPRIV+0 */ 255 //(iw_handler) usbdrvwext_getparam, /* SIOCWFIRSTPRIV+1 */ 256 //(iw_handler) usbdrvwext_setkey, /* SIOCWFIRSTPRIV+2 */ 257 //(iw_handler) usbdrvwext_setwmmparams, /* SIOCWFIRSTPRIV+3 */ 258 //(iw_handler) usbdrvwext_delkey, /* SIOCWFIRSTPRIV+4 */ 259 //(iw_handler) usbdrvwext_getwmmparams, /* SIOCWFIRSTPRIV+5 */ 260 //(iw_handler) usbdrvwext_setmlme, /* SIOCWFIRSTPRIV+6 */ 261 //(iw_handler) usbdrvwext_getchaninfo, /* SIOCWFIRSTPRIV+7 */ 262 //(iw_handler) usbdrvwext_setoptie, /* SIOCWFIRSTPRIV+8 */ 263 //(iw_handler) usbdrvwext_getoptie, /* SIOCWFIRSTPRIV+9 */ 264 //(iw_handler) usbdrvwext_addmac, /* SIOCWFIRSTPRIV+10 */ 265 //(iw_handler) usbdrvwext_getscanresults, /* SIOCWFIRSTPRIV+11 */ 266 //(iw_handler) usbdrvwext_delmac, /* SIOCWFIRSTPRIV+12 */ 267 //(iw_handler) usbdrvwext_getchanlist, /* SIOCWFIRSTPRIV+13 */ 268 //(iw_handler) usbdrvwext_setchanlist, /* SIOCWFIRSTPRIV+14 */ 269 //(iw_handler) NULL, /* SIOCWFIRSTPRIV+15 */ 270 //(iw_handler) usbdrvwext_chanswitch, /* SIOCWFIRSTPRIV+16 */ 271 //(iw_handler) usbdrvwext_setmode, /* SIOCWFIRSTPRIV+17 */ 272 //(iw_handler) usbdrvwext_getmode, /* SIOCWFIRSTPRIV+18 */ 273 NULL, /* SIOCIWFIRSTPRIV */ 274}; 275 276static struct iw_handler_def p80211wext_handler_def = { 277 .num_standard = sizeof(usbdrvwext_handler) / sizeof(iw_handler), 278 .num_private = sizeof(usbdrv_private_handler)/sizeof(iw_handler), 279 .num_private_args = sizeof(usbdrv_private_args)/sizeof(struct iw_priv_args), 280 .standard = usbdrvwext_handler, 281 .private = (iw_handler *) usbdrv_private_handler, 282 .private_args = (struct iw_priv_args *) usbdrv_private_args 283}; 284 285/* WDS */ 286/* struct zsWdsStruct wds[ZM_WDS_PORT_NUMBER]; */ 287/* void zfInitWdsStruct(void); */ 288 289/* VAP */ 290struct zsVapStruct vap[ZM_VAP_PORT_NUMBER]; 291void zfLnxInitVapStruct(void); 292 293 294/** 295 * usbdrv_intr - interrupt handler 296 * @irq: the IRQ number 297 * @dev_inst: the net_device struct 298 * @regs: registers (unused) 299 * 300 * This routine is the ISR for the usbdrv board. It services 301 * the RX & TX queues & starts the RU if it has stopped due 302 * to no resources. 303 */ 304irqreturn_t usbdrv_intr(int irq, void *dev_inst, struct pt_regs *regs) 305{ 306 struct net_device *dev; 307 struct usbdrv_private *macp; 308 309 dev = dev_inst; 310 macp = dev->ml_priv; 311 312 313 /* Read register error, card may be unpluged */ 314 if (0)//(intr_status == -1) 315 return IRQ_NONE; 316 317 /* the device is closed, don't continue or else bad things may happen. */ 318 if (!netif_running(dev)) 319 return IRQ_NONE; 320 321 if (macp->driver_isolated) 322 return IRQ_NONE; 323 324#if (WLAN_HOSTIF == WLAN_PCI) 325 //zfiIsrPci(dev); 326#endif 327 328 return IRQ_HANDLED; 329} 330 331int usbdrv_open(struct net_device *dev) 332{ 333 struct usbdrv_private *macp = dev->ml_priv; 334 int rc = 0; 335 u16_t size; 336 void* mem; 337 //unsigned char addr[6]; 338 struct zsCbFuncTbl cbFuncTbl; 339 340 printk("Enter open()\n"); 341 342/* 343 * #ifndef CONFIG_SMP 344 * read_lock(&(macp->isolate_lock)); 345 * #endif 346 */ 347 if (macp->driver_isolated) { 348 rc = -EBUSY; 349 goto exit; 350 } 351 352 size = zfiGlobalDataSize(dev); 353 mem = kmalloc(size, GFP_KERNEL); 354 if (mem == NULL) 355 { 356 rc = -EBUSY; 357 goto exit; 358 } 359 macp->wd = mem; 360 361 memset(&cbFuncTbl, 0, sizeof(struct zsCbFuncTbl)); 362 cbFuncTbl.zfcbAuthNotify = zfLnxAuthNotify; 363 cbFuncTbl.zfcbAuthNotify = zfLnxAuthNotify; 364 cbFuncTbl.zfcbAsocNotify = zfLnxAsocNotify; 365 cbFuncTbl.zfcbDisAsocNotify = zfLnxDisAsocNotify; 366 cbFuncTbl.zfcbApConnectNotify = zfLnxApConnectNotify; 367 cbFuncTbl.zfcbConnectNotify = zfLnxConnectNotify; 368 cbFuncTbl.zfcbScanNotify = zfLnxScanNotify; 369 cbFuncTbl.zfcbMicFailureNotify = zfLnxMicFailureNotify; 370 cbFuncTbl.zfcbApMicFailureNotify = zfLnxApMicFailureNotify; 371 cbFuncTbl.zfcbIbssPartnerNotify = zfLnxIbssPartnerNotify; 372 cbFuncTbl.zfcbMacAddressNotify = zfLnxMacAddressNotify; 373 cbFuncTbl.zfcbSendCompleteIndication = zfLnxSendCompleteIndication; 374 cbFuncTbl.zfcbRecvEth = zfLnxRecvEth; 375 cbFuncTbl.zfcbRecv80211 = zfLnxRecv80211; 376 cbFuncTbl.zfcbRestoreBufData = zfLnxRestoreBufData; 377#ifdef ZM_ENABLE_CENC 378 cbFuncTbl.zfcbCencAsocNotify = zfLnxCencAsocNotify; 379#endif //ZM_ENABLE_CENC 380 cbFuncTbl.zfcbHwWatchDogNotify = zfLnxWatchDogNotify; 381 zfiWlanOpen(dev, &cbFuncTbl); 382 383#if 0 384 { 385 //u16_t mac[3] = {0x1300, 0xb6d4, 0x5aaf}; 386 u16_t mac[3] = {0x8000, 0x00ab, 0x0000}; 387 //zfiWlanSetMacAddress(dev, mac); 388 } 389 /* MAC address */ 390 zfiWlanQueryMacAddress(dev, addr); 391 dev->dev_addr[0] = addr[0]; 392 dev->dev_addr[1] = addr[1]; 393 dev->dev_addr[2] = addr[2]; 394 dev->dev_addr[3] = addr[3]; 395 dev->dev_addr[4] = addr[4]; 396 dev->dev_addr[5] = addr[5]; 397#endif 398 /* zfwMacAddressNotify() will be called to setup dev->dev_addr[] */ 399 400 zfLnxCreateThread(dev); 401 402 mod_timer(&(macp->hbTimer10ms), jiffies + (1*HZ)/100); /* 10 ms */ 403 404 netif_carrier_on(dev); 405 406 netif_start_queue(dev); 407 408#if ZM_AP_MODE == 1 409 zfiWlanSetWlanMode(dev, ZM_MODE_AP); 410 zfiWlanSetBasicRate(dev, 0xf, 0, 0); 411 zfiWlanSetSSID(dev, "OTUS_CWY", 8); 412 zfiWlanSetDtimCount(dev, 3); 413 414 #if ZM_WEP_MOME == 1 415 { 416 u8_t key[16] = {0x12, 0x34, 0x56, 0x78, 0x90}; 417 struct zsKeyInfo keyInfo; 418 419 keyInfo.keyLength = 5; 420 keyInfo.keyIndex = 0; 421 keyInfo.flag = 0; 422 keyInfo.key = key; 423 zfiWlanSetKey(dev, keyInfo); 424 425 zfiWlanSetEncryMode(dev, ZM_WEP64); 426 } 427 428 #if ZM_SHARE_AUTH == 1 429 zfiWlanSetAuthenticationMode(dev, 1); 430 #endif /* #if ZM_SHARE_AUTH == 1 */ 431 #endif /* #if ZM_WEP_MOME == 1 */ 432 433#elif ZM_PIBSS_MODE == 1 434 zfiWlanSetWlanMode(dev, ZM_MODE_PSEUDO); 435#else 436 zfiWlanSetWlanMode(dev, ZM_MODE_INFRASTRUCTURE); 437#endif 438 /* zfiWlanSetChannel(dev, ZM_CHANNEL, FALSE); */ 439 zfiWlanSetFrequency(dev, 2462000, FALSE); 440 zfiWlanSetRtsThreshold(dev, 32767); 441 zfiWlanSetFragThreshold(dev, 0); 442 443 zfiWlanEnable(dev); 444 445#ifdef ZM_ENABLE_CENC 446 macp->netlink_sk = netlink_kernel_create(NETLINK_USERSOCK, 1, NULL, THIS_MODULE); 447 448 if (macp->netlink_sk == NULL) 449 { 450 printk(KERN_ERR "Can't create NETLINK socket\n"); 451 } 452#endif 453 454 macp->DeviceOpened = 1; 455exit: 456//#ifndef CONFIG_SMP 457// read_unlock(&(macp->isolate_lock)); 458//#endif 459 //zfRegisterWdsDev(dev, 0); 460 //zfLnxRegisterVapDev(dev, 0); 461 462 return rc; 463} 464 465 466 467 468/** 469 * usbdrv_get_stats - get driver statistics 470 * @dev: adapter's net_device struct 471 * 472 * This routine is called when the OS wants the adapter's stats returned. 473 * It returns the address of the net_device_stats stucture for the device. 474 * If the statistics are currently being updated, then they might be incorrect 475 * for a short while. However, since this cannot actually cause damage, no 476 * locking is used. 477 */ 478 479struct net_device_stats * usbdrv_get_stats(struct net_device *dev) 480{ 481 struct usbdrv_private *macp = dev->ml_priv; 482 483 macp->drv_stats.net_stats.tx_errors = 484 macp->drv_stats.net_stats.tx_carrier_errors + 485 macp->drv_stats.net_stats.tx_aborted_errors; 486 487 macp->drv_stats.net_stats.rx_errors = 488 macp->drv_stats.net_stats.rx_crc_errors + 489 macp->drv_stats.net_stats.rx_frame_errors + 490 macp->drv_stats.net_stats.rx_length_errors; 491 492 493 return &(macp->drv_stats.net_stats); 494} 495 496 497/** 498 * usbdrv_set_mac - set the MAC address 499 * @dev: adapter's net_device struct 500 * @addr: the new address 501 * 502 * This routine sets the ethernet address of the board 503 * Returns: 504 * 0 - if successful 505 * -1 - otherwise 506 */ 507 508int usbdrv_set_mac(struct net_device *dev, void *addr) 509{ 510 struct usbdrv_private *macp; 511 int rc = -1; 512 513 macp = dev->ml_priv; 514 read_lock(&(macp->isolate_lock)); 515 516 if (macp->driver_isolated) { 517 goto exit; 518 } 519 520 rc = 0; 521 522 523exit: 524 read_unlock(&(macp->isolate_lock)); 525 return rc; 526} 527 528 529 530void 531usbdrv_isolate_driver(struct usbdrv_private *macp) 532{ 533#ifndef CONFIG_SMP 534 write_lock_irq(&(macp->isolate_lock)); 535#endif 536 macp->driver_isolated = TRUE; 537#ifndef CONFIG_SMP 538 write_unlock_irq(&(macp->isolate_lock)); 539#endif 540 541 if (netif_running(macp->device)) 542 { 543 netif_carrier_off(macp->device); 544 netif_stop_queue(macp->device); 545 } 546} 547 548#define VLAN_SIZE 4 549int usbdrv_change_mtu(struct net_device *dev, int new_mtu) 550{ 551 if ((new_mtu < 68) || (new_mtu > (ETH_DATA_LEN + VLAN_SIZE))) 552 return -EINVAL; 553 554 dev->mtu = new_mtu; 555 return 0; 556} 557 558void zfLnxUnlinkAllUrbs(struct usbdrv_private *macp); 559 560int usbdrv_close(struct net_device *dev) 561{ 562extern void zfHpLedCtrl(struct net_device *dev, u16_t ledId, u8_t mode); 563 564 struct usbdrv_private *macp = dev->ml_priv; 565 566 printk(KERN_DEBUG "usbdrv_close\n"); 567 568 netif_carrier_off(macp->device); 569 570 del_timer_sync(&macp->hbTimer10ms); 571 572 printk(KERN_DEBUG "usbdrv_netif_carrier_off\n"); 573 574 usbdrv_isolate_driver(macp); 575 576 printk(KERN_DEBUG "usbdrv_isolate_driver\n"); 577 578 netif_carrier_off(macp->device); 579#ifdef ZM_ENABLE_CENC 580 /* CENC */ 581 if (macp->netlink_sk != NULL) 582 { 583 // sock_release(macp->netlink_sk); 584 printk(KERN_ERR "usbdrv close netlink socket\n"); 585 } 586#endif //ZM_ENABLE_CENC 587#if (WLAN_HOSTIF == WLAN_PCI) 588 //free_irq(dev->irq, dev); 589#endif 590 591 /* Turn off LED */ 592 zfHpLedCtrl(dev, 0, 0); 593 zfHpLedCtrl(dev, 1, 0); 594 595 /* Delay for a while */ 596 mdelay(10); 597 598 /* clear WPA/RSN IE */ 599 macp->supIe[1] = 0; 600 601 /* set the isolate flag to false, so usbdrv_open can be called */ 602 macp->driver_isolated = FALSE; 603 604 zfiWlanClose(dev); 605 kfree(macp->wd); 606 607 zfLnxUnlinkAllUrbs(macp); 608 609 return 0; 610} 611 612 613 614 615int usbdrv_xmit_frame(struct sk_buff *skb, struct net_device *dev) 616{ 617 int notify_stop = FALSE; 618 struct usbdrv_private *macp = dev->ml_priv; 619 620#if 0 621 /* Test code */ 622 { 623 struct sk_buff* s; 624 625 s = skb_copy_expand(skb, 8, 0, GFP_ATOMIC); 626 skb_push(s, 8); 627 s->data[0] = 'z'; 628 s->data[1] = 'y'; 629 s->data[2] = 'd'; 630 s->data[3] = 'a'; 631 s->data[4] = 's'; 632 printk("len1=%d, len2=%d", skb->len, s->len); 633 netlink_broadcast(rtnl, s, 0, RTMGRP_LINK, GFP_ATOMIC); 634 } 635#endif 636 637#if ZM_DISABLE_XMIT 638 dev_kfree_skb_irq(skb); 639#else 640 zfiTxSendEth(dev, skb, 0); 641#endif 642 macp->drv_stats.net_stats.tx_bytes += skb->len; 643 macp->drv_stats.net_stats.tx_packets++; 644 645 //dev_kfree_skb_irq(skb); 646 647 if (notify_stop) { 648 netif_carrier_off(dev); 649 netif_stop_queue(dev); 650 } 651 652 return NETDEV_TX_OK; 653} 654 655 656 657 658void usbdrv_set_multi(struct net_device *dev) 659{ 660 661 662 if (!(dev->flags & IFF_UP)) 663 return; 664 665 return; 666 667} 668 669 670 671/** 672 * usbdrv_clear_structs - free resources 673 674 * @dev: adapter's net_device struct 675 * 676 * Free all device specific structs, unmap i/o address, etc. 677 */ 678void usbdrv_clear_structs(struct net_device *dev) 679{ 680 struct usbdrv_private *macp = dev->ml_priv; 681 682 683#if (WLAN_HOSTIF == WLAN_PCI) 684 iounmap(macp->regp); 685 686 pci_release_regions(macp->pdev); 687 pci_disable_device(macp->pdev); 688 pci_set_drvdata(macp->pdev, NULL); 689#endif 690 691 kfree(macp); 692 693 kfree(dev); 694 695} 696 697void usbdrv_remove1(struct pci_dev *pcid) 698{ 699 struct net_device *dev; 700 struct usbdrv_private *macp; 701 702 dev = (struct net_device *)pci_get_drvdata(pcid); 703 if (!dev) 704 return; 705 706 macp = dev->ml_priv; 707 unregister_netdev(dev); 708 709 usbdrv_clear_structs(dev); 710} 711 712 713void zfLnx10msTimer(struct net_device* dev) 714{ 715 struct usbdrv_private *macp = dev->ml_priv; 716 717 mod_timer(&(macp->hbTimer10ms), jiffies + (1*HZ)/100); //10 ms 718 zfiHeartBeat(dev); 719 return; 720} 721 722void zfLnxInitVapStruct(void) 723{ 724 u16_t i; 725 726 for (i = 0; i < ZM_VAP_PORT_NUMBER; i++) 727 { 728 vap[i].dev = NULL; 729 vap[i].openFlag = 0; 730 } 731} 732 733int zfLnxVapOpen(struct net_device *dev) 734{ 735 u16_t vapId; 736 737 vapId = zfLnxGetVapId(dev); 738 739 if (vap[vapId].openFlag == 0) 740 { 741 vap[vapId].openFlag = 1; 742 printk("zfLnxVapOpen : device name=%s, vap ID=%d\n", dev->name, vapId); 743 zfiWlanSetSSID(dev, "vap1", 4); 744 zfiWlanEnable(dev); 745 netif_start_queue(dev); 746 } 747 else 748 { 749 printk("VAP opened error : vap ID=%d\n", vapId); 750 } 751 return 0; 752} 753 754int zfLnxVapClose(struct net_device *dev) 755{ 756 u16_t vapId; 757 758 vapId = zfLnxGetVapId(dev); 759 760 if (vapId != 0xffff) 761 { 762 if (vap[vapId].openFlag == 1) 763 { 764 printk("zfLnxVapClose: device name=%s, vap ID=%d\n", dev->name, vapId); 765 766 netif_stop_queue(dev); 767 vap[vapId].openFlag = 0; 768 } 769 else 770 { 771 printk("VAP port was not opened : vap ID=%d\n", vapId); 772 } 773 } 774 return 0; 775} 776 777int zfLnxVapXmitFrame(struct sk_buff *skb, struct net_device *dev) 778{ 779 int notify_stop = FALSE; 780 struct usbdrv_private *macp = dev->ml_priv; 781 u16_t vapId; 782 783 vapId = zfLnxGetVapId(dev); 784 //printk("zfLnxVapXmitFrame: vap ID=%d\n", vapId); 785 //printk("zfLnxVapXmitFrame(), skb=%lxh\n", (u32_t)skb); 786 787 if (vapId >= ZM_VAP_PORT_NUMBER) 788 { 789 dev_kfree_skb_irq(skb); 790 return NETDEV_TX_OK; 791 } 792#if 1 793 if (vap[vapId].openFlag == 0) 794 { 795 dev_kfree_skb_irq(skb); 796 return NETDEV_TX_OK; 797 } 798#endif 799 800 801 zfiTxSendEth(dev, skb, 0x1); 802 803 macp->drv_stats.net_stats.tx_bytes += skb->len; 804 macp->drv_stats.net_stats.tx_packets++; 805 806 //dev_kfree_skb_irq(skb); 807 808 if (notify_stop) { 809 netif_carrier_off(dev); 810 netif_stop_queue(dev); 811 } 812 813 return NETDEV_TX_OK; 814} 815 816static const struct net_device_ops vap_netdev_ops = { 817 .ndo_open = zfLnxVapOpen, 818 .ndo_stop = zfLnxVapClose, 819 .ndo_start_xmit = zfLnxVapXmitFrame, 820 .ndo_get_stats = usbdrv_get_stats, 821 .ndo_change_mtu = usbdrv_change_mtu, 822 .ndo_validate_addr = eth_validate_addr, 823 .ndo_set_mac_address = eth_mac_addr, 824#ifdef ZM_HOSTAPD_SUPPORT 825 .ndo_do_ioctl = usbdrv_ioctl, 826#else 827 .ndo_do_ioctl = NULL, 828#endif 829}; 830 831int zfLnxRegisterVapDev(struct net_device* parentDev, u16_t vapId) 832{ 833 /* Allocate net device structure */ 834 vap[vapId].dev = alloc_etherdev(0); 835 printk("Register vap dev=%p\n", vap[vapId].dev); 836 837 if(vap[vapId].dev == NULL) { 838 printk("alloc_etherdev fail\n"); 839 return -ENOMEM; 840 } 841 842 /* Setup the default settings */ 843 ether_setup(vap[vapId].dev); 844 845 /* MAC address */ 846 memcpy(vap[vapId].dev->dev_addr, parentDev->dev_addr, ETH_ALEN); 847 848 vap[vapId].dev->irq = parentDev->irq; 849 vap[vapId].dev->base_addr = parentDev->base_addr; 850 vap[vapId].dev->mem_start = parentDev->mem_start; 851 vap[vapId].dev->mem_end = parentDev->mem_end; 852 vap[vapId].dev->ml_priv = parentDev->ml_priv; 853 854 //dev->hard_start_xmit = &zd1212_wds_xmit_frame; 855 vap[vapId].dev->netdev_ops = &vap_netdev_ops; 856 vap[vapId].dev->destructor = free_netdev; 857 858 vap[vapId].dev->tx_queue_len = 0; 859 860 vap[vapId].dev->dev_addr[0] = parentDev->dev_addr[0]; 861 vap[vapId].dev->dev_addr[1] = parentDev->dev_addr[1]; 862 vap[vapId].dev->dev_addr[2] = parentDev->dev_addr[2]; 863 vap[vapId].dev->dev_addr[3] = parentDev->dev_addr[3]; 864 vap[vapId].dev->dev_addr[4] = parentDev->dev_addr[4]; 865 vap[vapId].dev->dev_addr[5] = parentDev->dev_addr[5] + (vapId+1); 866 867 /* Stop the network queue first */ 868 netif_stop_queue(vap[vapId].dev); 869 870 sprintf(vap[vapId].dev->name, "vap%d", vapId); 871 printk("Register VAP dev success : %s\n", vap[vapId].dev->name); 872 873 if(register_netdevice(vap[vapId].dev) != 0) { 874 printk("register VAP device fail\n"); 875 vap[vapId].dev = NULL; 876 return -EINVAL; 877 } 878 879 return 0; 880} 881 882int zfLnxUnregisterVapDev(struct net_device* parentDev, u16_t vapId) 883{ 884 int ret = 0; 885 886 printk("Unregister VAP dev : %s\n", vap[vapId].dev->name); 887 888 if(vap[vapId].dev != NULL) { 889 printk("Unregister vap dev=%p\n", vap[vapId].dev); 890 // 891 //unregister_netdevice(wds[wdsId].dev); 892 unregister_netdev(vap[vapId].dev); 893 894 printk("VAP unregister_netdevice\n"); 895 vap[vapId].dev = NULL; 896 } 897 else { 898 printk("unregister VAP device: %d fail\n", vapId); 899 ret = -EINVAL; 900 } 901 902 return ret; 903} 904 905 906 907# define SUBMIT_URB(u,f) usb_submit_urb(u,f) 908# define USB_ALLOC_URB(u,f) usb_alloc_urb(u,f) 909 910//extern void zfiWlanQueryMacAddress(zdev_t* dev, u8_t* addr); 911 912extern int usbdrv_open(struct net_device *dev); 913extern int usbdrv_close(struct net_device *dev); 914extern int usbdrv_xmit_frame(struct sk_buff *skb, struct net_device *dev); 915extern int usbdrv_xmit_frame(struct sk_buff *skb, struct net_device *dev); 916extern int usbdrv_change_mtu(struct net_device *dev, int new_mtu); 917extern void usbdrv_set_multi(struct net_device *dev); 918extern int usbdrv_set_mac(struct net_device *dev, void *addr); 919extern struct net_device_stats * usbdrv_get_stats(struct net_device *dev); 920extern int usbdrv_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); 921extern UsbTxQ_t *zfLnxGetUsbTxBuffer(struct net_device *dev); 922 923int zfLnxAllocAllUrbs(struct usbdrv_private *macp) 924{ 925 struct usb_interface *interface = macp->interface; 926 struct usb_host_interface *iface_desc = &interface->altsetting[0]; 927 928 struct usb_endpoint_descriptor *endpoint; 929 int i; 930 931 /* descriptor matches, let's find the endpoints needed */ 932 /* check out the endpoints */ 933 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) 934 { 935 endpoint = &iface_desc->endpoint[i].desc; 936 if (usb_endpoint_is_bulk_in(endpoint)) 937 { 938 /* we found a bulk in endpoint */ 939 printk(KERN_ERR "bulk in: wMaxPacketSize = %x\n", le16_to_cpu(endpoint->wMaxPacketSize)); 940 } 941 942 if (usb_endpoint_is_bulk_out(endpoint)) 943 { 944 /* we found a bulk out endpoint */ 945 printk(KERN_ERR "bulk out: wMaxPacketSize = %x\n", le16_to_cpu(endpoint->wMaxPacketSize)); 946 } 947 948 if (usb_endpoint_is_int_in(endpoint)) 949 { 950 /* we found a interrupt in endpoint */ 951 printk(KERN_ERR "interrupt in: wMaxPacketSize = %x\n", le16_to_cpu(endpoint->wMaxPacketSize)); 952 printk(KERN_ERR "interrupt in: int_interval = %d\n", endpoint->bInterval); 953 } 954 955 if (usb_endpoint_is_int_out(endpoint)) 956 { 957 /* we found a interrupt out endpoint */ 958 printk(KERN_ERR "interrupt out: wMaxPacketSize = %x\n", le16_to_cpu(endpoint->wMaxPacketSize)); 959 printk(KERN_ERR "interrupt out: int_interval = %d\n", endpoint->bInterval); 960 } 961 } 962 963 /* Allocate all Tx URBs */ 964 for (i = 0; i < ZM_MAX_TX_URB_NUM; i++) 965 { 966 macp->WlanTxDataUrb[i] = USB_ALLOC_URB(0, GFP_KERNEL); 967 968 if (macp->WlanTxDataUrb[i] == 0) 969 { 970 int j; 971 972 /* Free all urbs */ 973 for (j = 0; j < i; j++) 974 { 975 usb_free_urb(macp->WlanTxDataUrb[j]); 976 } 977 978 return 0; 979 } 980 } 981 982 /* Allocate all Rx URBs */ 983 for (i = 0; i < ZM_MAX_RX_URB_NUM; i++) 984 { 985 macp->WlanRxDataUrb[i] = USB_ALLOC_URB(0, GFP_KERNEL); 986 987 if (macp->WlanRxDataUrb[i] == 0) 988 { 989 int j; 990 991 /* Free all urbs */ 992 for (j = 0; j < i; j++) 993 { 994 usb_free_urb(macp->WlanRxDataUrb[j]); 995 } 996 997 for (j = 0; j < ZM_MAX_TX_URB_NUM; j++) 998 { 999 usb_free_urb(macp->WlanTxDataUrb[j]); 1000 } 1001 1002 return 0; 1003 } 1004 } 1005 1006 /* Allocate Register Read/Write USB */ 1007 macp->RegOutUrb = USB_ALLOC_URB(0, GFP_KERNEL); 1008 macp->RegInUrb = USB_ALLOC_URB(0, GFP_KERNEL); 1009 1010 return 1; 1011} 1012 1013void zfLnxFreeAllUrbs(struct usbdrv_private *macp) 1014{ 1015 int i; 1016 1017 /* Free all Tx URBs */ 1018 for (i = 0; i < ZM_MAX_TX_URB_NUM; i++) 1019 { 1020 if (macp->WlanTxDataUrb[i] != NULL) 1021 { 1022 usb_free_urb(macp->WlanTxDataUrb[i]); 1023 } 1024 } 1025 1026 /* Free all Rx URBs */ 1027 for (i = 0; i < ZM_MAX_RX_URB_NUM; i++) 1028 { 1029 if (macp->WlanRxDataUrb[i] != NULL) 1030 { 1031 usb_free_urb(macp->WlanRxDataUrb[i]); 1032 } 1033 } 1034 1035 /* Free USB Register Read/Write URB */ 1036 usb_free_urb(macp->RegOutUrb); 1037 usb_free_urb(macp->RegInUrb); 1038} 1039 1040void zfLnxUnlinkAllUrbs(struct usbdrv_private *macp) 1041{ 1042 int i; 1043 1044 /* Unlink all Tx URBs */ 1045 for (i = 0; i < ZM_MAX_TX_URB_NUM; i++) 1046 { 1047 if (macp->WlanTxDataUrb[i] != NULL) 1048 { 1049 usb_unlink_urb(macp->WlanTxDataUrb[i]); 1050 } 1051 } 1052 1053 /* Unlink all Rx URBs */ 1054 for (i = 0; i < ZM_MAX_RX_URB_NUM; i++) 1055 { 1056 if (macp->WlanRxDataUrb[i] != NULL) 1057 { 1058 usb_unlink_urb(macp->WlanRxDataUrb[i]); 1059 } 1060 } 1061 1062 /* Unlink USB Register Read/Write URB */ 1063 usb_unlink_urb(macp->RegOutUrb); 1064 1065 usb_unlink_urb(macp->RegInUrb); 1066} 1067 1068static const struct net_device_ops otus_netdev_ops = { 1069 .ndo_open = usbdrv_open, 1070 .ndo_stop = usbdrv_close, 1071 .ndo_start_xmit = usbdrv_xmit_frame, 1072 .ndo_change_mtu = usbdrv_change_mtu, 1073 .ndo_get_stats = usbdrv_get_stats, 1074 .ndo_set_multicast_list = usbdrv_set_multi, 1075 .ndo_set_mac_address = usbdrv_set_mac, 1076 .ndo_do_ioctl = usbdrv_ioctl, 1077 .ndo_validate_addr = eth_validate_addr, 1078}; 1079 1080u8_t zfLnxInitSetup(struct net_device *dev, struct usbdrv_private *macp) 1081{ 1082 //unsigned char addr[6]; 1083 1084 //init_MUTEX(&macp->ps_sem); 1085 //init_MUTEX(&macp->reg_sem); 1086 //init_MUTEX(&macp->bcn_sem); 1087 //init_MUTEX(&macp->config_sem); 1088 1089 spin_lock_init(&(macp->cs_lock)); 1090#if 0 1091 /* MAC address */ 1092 zfiWlanQueryMacAddress(dev, addr); 1093 dev->dev_addr[0] = addr[0]; 1094 dev->dev_addr[1] = addr[1]; 1095 dev->dev_addr[2] = addr[2]; 1096 dev->dev_addr[3] = addr[3]; 1097 dev->dev_addr[4] = addr[4]; 1098 dev->dev_addr[5] = addr[5]; 1099#endif 1100 dev->wireless_handlers = (struct iw_handler_def *)&p80211wext_handler_def; 1101 1102 dev->netdev_ops = &otus_netdev_ops; 1103 1104 dev->flags |= IFF_MULTICAST; 1105 1106 dev->dev_addr[0] = 0x00; 1107 dev->dev_addr[1] = 0x03; 1108 dev->dev_addr[2] = 0x7f; 1109 dev->dev_addr[3] = 0x11; 1110 dev->dev_addr[4] = 0x22; 1111 dev->dev_addr[5] = 0x33; 1112 1113 /* Initialize Heart Beat timer */ 1114 init_timer(&macp->hbTimer10ms); 1115 macp->hbTimer10ms.data = (unsigned long)dev; 1116 macp->hbTimer10ms.function = (void *)&zfLnx10msTimer; 1117 1118 /* Initialize WDS and VAP data structure */ 1119 //zfInitWdsStruct(); 1120 zfLnxInitVapStruct(); 1121 1122 return 1; 1123} 1124 1125u8_t zfLnxClearStructs(struct net_device *dev) 1126{ 1127 u16_t ii; 1128 u16_t TxQCnt; 1129 1130 TxQCnt = zfLnxCheckTxBufferCnt(dev); 1131 1132 printk(KERN_ERR "TxQCnt: %d\n", TxQCnt); 1133 1134 for (ii = 0; ii < TxQCnt; ii++) { 1135 UsbTxQ_t *TxQ = zfLnxGetUsbTxBuffer(dev); 1136 1137 printk(KERN_ERR "dev_kfree_skb_any\n"); 1138 /* Free buffer */ 1139 dev_kfree_skb_any(TxQ->buf); 1140 } 1141 1142 return 0; 1143}