u8_t zfLnxInitSetup(struct net_device *dev, struct usbdrv_private *macp) { //unsigned char addr[6]; //init_MUTEX(&macp->ps_sem); //init_MUTEX(&macp->reg_sem); //init_MUTEX(&macp->bcn_sem); //init_MUTEX(&macp->config_sem); spin_lock_init(&(macp->cs_lock)); #if 0 /* MAC address */ zfiWlanQueryMacAddress(dev, addr); dev->dev_addr[0] = addr[0]; dev->dev_addr[1] = addr[1]; dev->dev_addr[2] = addr[2]; dev->dev_addr[3] = addr[3]; dev->dev_addr[4] = addr[4]; dev->dev_addr[5] = addr[5]; #endif #if WIRELESS_EXT > 12 dev->wireless_handlers = (struct iw_handler_def *)&p80211wext_handler_def; #endif dev->open = usbdrv_open; dev->hard_start_xmit = usbdrv_xmit_frame; dev->stop = usbdrv_close; dev->change_mtu = &usbdrv_change_mtu; dev->get_stats = usbdrv_get_stats; dev->set_multicast_list = usbdrv_set_multi; dev->set_mac_address = usbdrv_set_mac; dev->do_ioctl = usbdrv_ioctl; dev->flags |= IFF_MULTICAST; dev->dev_addr[0] = 0x00; dev->dev_addr[1] = 0x03; dev->dev_addr[2] = 0x7f; dev->dev_addr[3] = 0x11; dev->dev_addr[4] = 0x22; dev->dev_addr[5] = 0x33; /* Initialize Heart Beat timer */ init_timer(&macp->hbTimer10ms); macp->hbTimer10ms.data = (unsigned long)dev; macp->hbTimer10ms.function = (void *)&zfLnx10msTimer; /* Initialize WDS and VAP data structure */ //zfInitWdsStruct(); zfLnxInitVapStruct(); return 1; }
u8_t zfLnxInitSetup(struct net_device *dev, struct usbdrv_private *macp) { //unsigned char addr[6]; //init_MUTEX(&macp->ps_sem); //init_MUTEX(&macp->reg_sem); //init_MUTEX(&macp->bcn_sem); //init_MUTEX(&macp->config_sem); spin_lock_init(&(macp->cs_lock)); #if 0 /* MAC address */ zfiWlanQueryMacAddress(dev, addr); dev->dev_addr[0] = addr[0]; dev->dev_addr[1] = addr[1]; dev->dev_addr[2] = addr[2]; dev->dev_addr[3] = addr[3]; dev->dev_addr[4] = addr[4]; dev->dev_addr[5] = addr[5]; #endif dev->wireless_handlers = (struct iw_handler_def *)&p80211wext_handler_def; dev->netdev_ops = &otus_netdev_ops; dev->flags |= IFF_MULTICAST; dev->dev_addr[0] = 0x00; dev->dev_addr[1] = 0x03; dev->dev_addr[2] = 0x7f; dev->dev_addr[3] = 0x11; dev->dev_addr[4] = 0x22; dev->dev_addr[5] = 0x33; /* Initialize Heart Beat timer */ init_timer(&macp->hbTimer10ms); macp->hbTimer10ms.data = (unsigned long)dev; macp->hbTimer10ms.function = (void *)&zfLnx10msTimer; /* Initialize WDS and VAP data structure */ //zfInitWdsStruct(); zfLnxInitVapStruct(); return 1; }
int usbdrv_open(struct net_device *dev) { struct usbdrv_private *macp = dev->ml_priv; int rc = 0; u16_t size; void* mem; //unsigned char addr[6]; struct zsCbFuncTbl cbFuncTbl; printk("Enter open()\n"); if (macp->driver_isolated) { rc = -EBUSY; goto exit; } size = zfiGlobalDataSize(dev); mem = kmalloc(size, GFP_KERNEL); if (mem == NULL) { rc = -EBUSY; goto exit; } macp->wd = mem; memset(&cbFuncTbl, 0, sizeof(struct zsCbFuncTbl)); cbFuncTbl.zfcbAuthNotify = zfLnxAuthNotify; cbFuncTbl.zfcbAuthNotify = zfLnxAuthNotify; cbFuncTbl.zfcbAsocNotify = zfLnxAsocNotify; cbFuncTbl.zfcbDisAsocNotify = zfLnxDisAsocNotify; cbFuncTbl.zfcbApConnectNotify = zfLnxApConnectNotify; cbFuncTbl.zfcbConnectNotify = zfLnxConnectNotify; cbFuncTbl.zfcbScanNotify = zfLnxScanNotify; cbFuncTbl.zfcbMicFailureNotify = zfLnxMicFailureNotify; cbFuncTbl.zfcbApMicFailureNotify = zfLnxApMicFailureNotify; cbFuncTbl.zfcbIbssPartnerNotify = zfLnxIbssPartnerNotify; cbFuncTbl.zfcbMacAddressNotify = zfLnxMacAddressNotify; cbFuncTbl.zfcbSendCompleteIndication = zfLnxSendCompleteIndication; cbFuncTbl.zfcbRecvEth = zfLnxRecvEth; cbFuncTbl.zfcbRecv80211 = zfLnxRecv80211; cbFuncTbl.zfcbRestoreBufData = zfLnxRestoreBufData; #ifdef ZM_ENABLE_CENC cbFuncTbl.zfcbCencAsocNotify = zfLnxCencAsocNotify; #endif //ZM_ENABLE_CENC cbFuncTbl.zfcbHwWatchDogNotify = zfLnxWatchDogNotify; zfiWlanOpen(dev, &cbFuncTbl); #if 0 { //u16_t mac[3] = {0x1300, 0xb6d4, 0x5aaf}; u16_t mac[3] = {0x8000, 0x00ab, 0x0000}; //zfiWlanSetMacAddress(dev, mac); } /* MAC address */ zfiWlanQueryMacAddress(dev, addr); dev->dev_addr[0] = addr[0]; dev->dev_addr[1] = addr[1]; dev->dev_addr[2] = addr[2]; dev->dev_addr[3] = addr[3]; dev->dev_addr[4] = addr[4]; dev->dev_addr[5] = addr[5]; #endif /* zfwMacAddressNotify() will be called to setup dev->dev_addr[] */ zfLnxCreateThread(dev); mod_timer(&(macp->hbTimer10ms), jiffies + (1*HZ)/100); /* 10 ms */ netif_carrier_on(dev); netif_start_queue(dev); #if ZM_AP_MODE == 1 zfiWlanSetWlanMode(dev, ZM_MODE_AP); zfiWlanSetBasicRate(dev, 0xf, 0, 0); zfiWlanSetSSID(dev, "OTUS_CWY", 8); zfiWlanSetDtimCount(dev, 3); #if ZM_WEP_MOME == 1 { u8_t key[16] = {0x12, 0x34, 0x56, 0x78, 0x90}; struct zsKeyInfo keyInfo; keyInfo.keyLength = 5; keyInfo.keyIndex = 0; keyInfo.flag = 0; keyInfo.key = key; zfiWlanSetKey(dev, keyInfo); zfiWlanSetEncryMode(dev, ZM_WEP64); } #if ZM_SHARE_AUTH == 1 zfiWlanSetAuthenticationMode(dev, 1); #endif /* #if ZM_SHARE_AUTH == 1 */ #endif /* #if ZM_WEP_MOME == 1 */ #elif ZM_PIBSS_MODE == 1 zfiWlanSetWlanMode(dev, ZM_MODE_PSEUDO); #else zfiWlanSetWlanMode(dev, ZM_MODE_INFRASTRUCTURE); #endif /* zfiWlanSetChannel(dev, ZM_CHANNEL, FALSE); */ zfiWlanSetFrequency(dev, 2462000, FALSE); zfiWlanSetRtsThreshold(dev, 32767); zfiWlanSetFragThreshold(dev, 0); zfiWlanEnable(dev); #ifdef ZM_ENABLE_CENC macp->netlink_sk = netlink_kernel_create(NETLINK_USERSOCK, 1, NULL, THIS_MODULE); if (macp->netlink_sk == NULL) { printk(KERN_ERR "Can't create NETLINK socket\n"); } #endif macp->DeviceOpened = 1; exit: //#ifndef CONFIG_SMP // read_unlock(&(macp->isolate_lock)); //#endif //zfRegisterWdsDev(dev, 0); //zfLnxRegisterVapDev(dev, 0); return rc; }