diff options
Diffstat (limited to 'drivers/staging/vt6655/device_main.c')
-rw-r--r-- | drivers/staging/vt6655/device_main.c | 643 |
1 files changed, 152 insertions, 491 deletions
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index f43ca416e4a8..53450b48eaa6 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -60,88 +60,31 @@ */ #undef __NO_VERSION__ -#if !defined(__DEVICE_H__) #include "device.h" -#endif -#if !defined(__CARD_H__) #include "card.h" -#endif -#if !defined(__TBIT_H__) -#include "tbit.h" -#endif -#if !defined(__BASEBAND_H__) #include "baseband.h" -#endif -#if !defined(__MAC_H__) #include "mac.h" -#endif -#if !defined(__TETHER_H__) #include "tether.h" -#endif -#if !defined(__WMGR_H__) #include "wmgr.h" -#endif -#if !defined(__WCTL_H__) #include "wctl.h" -#endif -#if !defined(__POWER_H__) #include "power.h" -#endif -#if !defined(__WCMD_H__) #include "wcmd.h" -#endif -#if !defined(__IOCMD_H__) #include "iocmd.h" -#endif -#if !defined(__TCRC_H__) #include "tcrc.h" -#endif -#if !defined(__RXTX_H__) #include "rxtx.h" -#endif -#if !defined(__WROUTE_H__) #include "wroute.h" -#endif -#if !defined(__BSSDB_H__) #include "bssdb.h" -#endif -#if !defined(__HOSTAP_H__) #include "hostap.h" -#endif -#if !defined(__WPACTL_H__) #include "wpactl.h" -#endif -#if !defined(__IOCTL_H__) #include "ioctl.h" -#endif -#if !defined(__IWCTL_H__) #include "iwctl.h" -#endif -#if !defined(__DPC_H__) #include "dpc.h" -#endif -#if !defined(__DATARATE_H__) #include "datarate.h" -#endif -#if !defined(__RF_H__) #include "rf.h" -#endif -#if !defined(__IOWPA_H__) #include "iowpa.h" -#endif - #include <linux/delay.h> #include <linux/kthread.h> -// #ifdef PRIVATE_OBJ -//#if !defined(__DEVICE_EXP_H) -//#include "device_exp.h" -//#endif -//#if !defined(__DEVICE_MODULE_H) -//#include "device_module.h" -//#endif - -// #endif //#define DEBUG /*--------------------- Static Definitions -------------------------*/ //static int msglevel =MSG_LEVEL_DEBUG; @@ -151,11 +94,9 @@ static int msglevel = MSG_LEVEL_INFO; // // Define module options // -#ifndef PRIVATE_OBJ MODULE_AUTHOR("VIA Networking Technologies, Inc., <lyndonchen@vntek.com.tw>"); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("VIA Networking Solomon-A/B/G Wireless LAN Adapter Driver"); -#endif //PLICE_DEBUG -> static int mlme_kill; @@ -332,7 +273,6 @@ DEVICE_PARAM(bDiversityANTEnable, "ANT diversity mode"); // -#ifndef PRIVATE_OBJ static int device_nics =0; static PSDevice pDevice_Infos =NULL; static struct net_device *root_device_dev = NULL; @@ -343,15 +283,13 @@ static CHIP_INFO chip_info_table[]= { {0,NULL} }; -static struct pci_device_id device_id_table[] __devinitdata = { -{ 0x1106, 0x3253, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long)&chip_info_table[0]}, -{ 0, } +DEFINE_PCI_DEVICE_TABLE(device_id_table) = { + { PCI_VDEVICE(VIA, 0x3253), (kernel_ulong_t)chip_info_table}, + { 0, } }; -#endif /*--------------------- Static Functions --------------------------*/ -#ifndef PRIVATE_OBJ static int device_found1(struct pci_dev *pcid, const struct pci_device_id *ent); static BOOL device_init_info(struct pci_dev* pcid, PSDevice* ppDevice, PCHIP_INFO); @@ -378,7 +316,6 @@ struct notifier_block device_notifier = { }; #endif -#endif // #ifndef PRIVATE_OBJ static void device_init_rd0_ring(PSDevice pDevice); static void device_init_rd1_ring(PSDevice pDevice); @@ -386,9 +323,7 @@ static void device_init_defrag_cb(PSDevice pDevice); static void device_init_td0_ring(PSDevice pDevice); static void device_init_td1_ring(PSDevice pDevice); -#ifndef PRIVATE_OBJ static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev); -#endif //2008-0714<Add>by Mike Liu static BOOL device_release_WPADEV(PSDevice pDevice); @@ -412,7 +347,6 @@ static int Config_FileGetParameter(UCHAR *string, UCHAR *dest,UCHAR *source); /*--------------------- Export Functions --------------------------*/ -#ifndef PRIVATE_OBJ static char* get_chip_name(int chip_id) { int i; @@ -422,7 +356,7 @@ static char* get_chip_name(int chip_id) { return chip_info_table[i].name; } -static void __devexit device_remove1(struct pci_dev *pcid) +static void device_remove1(struct pci_dev *pcid) { PSDevice pDevice=pci_get_drvdata(pcid); @@ -432,34 +366,33 @@ static void __devexit device_remove1(struct pci_dev *pcid) } -#endif /* static void device_set_int_opt(int *opt, int val, int min, int max, int def,char* name,char* devname) { if (val==-1) *opt=def; else if (val<min || val>max) { - DEVICE_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: the value of parameter %s is invalid, the valid range is (%d-%d)\n" , + DBG_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: the value of parameter %s is invalid, the valid range is (%d-%d)\n" , devname,name, min,max); *opt=def; } else { - DEVICE_PRT(MSG_LEVEL_INFO, KERN_INFO "%s: set value of parameter %s to %d\n", + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "%s: set value of parameter %s to %d\n", devname, name, val); *opt=val; } } static void -device_set_bool_opt(PU32 opt, int val,BOOL def,U32 flag, char* name,char* devname) { +device_set_bool_opt(unsigned int *opt, int val,BOOL def,U32 flag, char* name,char* devname) { (*opt)&=(~flag); if (val==-1) *opt|=(def ? flag : 0); else if (val<0 || val>1) { - DEVICE_PRT(MSG_LEVEL_INFO, KERN_NOTICE + DBG_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: the value of parameter %s is invalid, the valid range is (0-1)\n",devname,name); *opt|=(def ? flag : 0); } else { - DEVICE_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: set parameter %s to %s\n", + DBG_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: set parameter %s to %s\n", devname,name , val ? "TRUE" : "FALSE"); *opt|=(val ? flag : 0); } @@ -530,18 +463,18 @@ pDevice->bUpdateBBVGA = TRUE; pDevice->byPreambleType = 0; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" uChannel= %d\n",(INT)pDevice->uChannel); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" byOpMode= %d\n",(INT)pDevice->byOpMode); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" ePSMode= %d\n",(INT)pDevice->ePSMode); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" wRTSThreshold= %d\n",(INT)pDevice->wRTSThreshold); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" byShortRetryLimit= %d\n",(INT)pDevice->byShortRetryLimit); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" byLongRetryLimit= %d\n",(INT)pDevice->byLongRetryLimit); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" byPreambleType= %d\n",(INT)pDevice->byPreambleType); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" byShortPreamble= %d\n",(INT)pDevice->byShortPreamble); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" uConnectionRate= %d\n",(INT)pDevice->uConnectionRate); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" byBBType= %d\n",(INT)pDevice->byBBType); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->b11hEnable= %d\n",(INT)pDevice->b11hEnable); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->bDiversityRegCtlON= %d\n",(INT)pDevice->bDiversityRegCtlON); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" uChannel= %d\n",(INT)pDevice->uChannel); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" byOpMode= %d\n",(INT)pDevice->byOpMode); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" ePSMode= %d\n",(INT)pDevice->ePSMode); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" wRTSThreshold= %d\n",(INT)pDevice->wRTSThreshold); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" byShortRetryLimit= %d\n",(INT)pDevice->byShortRetryLimit); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" byLongRetryLimit= %d\n",(INT)pDevice->byLongRetryLimit); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" byPreambleType= %d\n",(INT)pDevice->byPreambleType); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" byShortPreamble= %d\n",(INT)pDevice->byShortPreamble); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" uConnectionRate= %d\n",(INT)pDevice->uConnectionRate); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" byBBType= %d\n",(INT)pDevice->byBBType); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->b11hEnable= %d\n",(INT)pDevice->b11hEnable); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->bDiversityRegCtlON= %d\n",(INT)pDevice->bDiversityRegCtlON); } static VOID s_vCompleteCurrentMeasure (IN PSDevice pDevice, IN BYTE byResult) @@ -697,7 +630,7 @@ byValue1 = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_ANTENNA); #ifdef PLICE_DEBUG //printk("init registers: TxAntennaMode is %d\n",pDevice->byTxAntennaMode); #endif - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bDiversityEnable=[%d],NValue=[%d],MValue=[%d],TMax=[%d],TMax2=[%d]\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bDiversityEnable=[%d],NValue=[%d],MValue=[%d],TMax=[%d],TMax2=[%d]\n", pDevice->bDiversityEnable,(int)pDevice->ulDiversityNValue,(int)pDevice->ulDiversityMValue,pDevice->byTMax,pDevice->byTMax2); //#ifdef ZoneType_DefaultSetting @@ -709,7 +642,7 @@ byValue1 = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_ANTENNA); (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] !=0x00)){ //for USA pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0; pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0B; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Init Zone Type :USA\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Init Zone Type :USA\n"); } else if((zonetype == 1)&& (pDevice->abyEEPROM[EEP_OFS_ZONETYPE]!=0x01)){ //for Japan @@ -720,7 +653,7 @@ byValue1 = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_ANTENNA); (pDevice->abyEEPROM[EEP_OFS_ZONETYPE]!=0x02)){ //for Europe pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x02; pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Init Zone Type :Europe\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Init Zone Type :Europe\n"); } else @@ -743,12 +676,12 @@ else } pDevice->byRFType &= RF_MASK; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byRFType = %x\n", pDevice->byRFType); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byRFType = %x\n", pDevice->byRFType); if (pDevice->bZoneRegExist == FALSE) { pDevice->byZoneType = pDevice->abyEEPROM[EEP_OFS_ZONETYPE]; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byZoneType = %x\n", pDevice->byZoneType); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byZoneType = %x\n", pDevice->byZoneType); //Init RF module RFbInit(pDevice); @@ -855,8 +788,8 @@ else MACvGPIOIn(pDevice->PortOffset, &pDevice->byGPIO); //2008-4-14 <add> by chester for led issue #ifdef FOR_LED_ON_NOTEBOOK -if (BITbIsBitOn(pDevice->byGPIO,GPIO0_DATA)){pDevice->bHWRadioOff = TRUE;} -if (BITbIsBitOff(pDevice->byGPIO,GPIO0_DATA)){pDevice->bHWRadioOff = FALSE;} +if (pDevice->byGPIO & GPIO0_DATA){pDevice->bHWRadioOff = TRUE;} +if ( !(pDevice->byGPIO & GPIO0_DATA)){pDevice->bHWRadioOff = FALSE;} } if ( (pDevice->bRadioControlOff == TRUE)) { @@ -864,8 +797,8 @@ if (BITbIsBitOff(pDevice->byGPIO,GPIO0_DATA)){pDevice->bHWRadioOff = FALSE;} } else CARDbRadioPowerOn(pDevice); #else - if ((BITbIsBitOn(pDevice->byGPIO,GPIO0_DATA) && BITbIsBitOff(pDevice->byRadioCtl, EEP_RADIOCTL_INV)) || - (BITbIsBitOff(pDevice->byGPIO,GPIO0_DATA) && BITbIsBitOn(pDevice->byRadioCtl, EEP_RADIOCTL_INV))) { + if (((pDevice->byGPIO & GPIO0_DATA) && !(pDevice->byRadioCtl & EEP_RADIOCTL_INV)) || + ( !(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV))) { pDevice->bHWRadioOff = TRUE; } } @@ -878,7 +811,7 @@ else CARDbRadioPowerOn(pDevice); pMgmt->eScanType = WMAC_SCAN_PASSIVE; // get Permanent network address SROMvReadEtherAddress(pDevice->PortOffset, pDevice->abyCurrentNetAddr); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Network address = %02x-%02x-%02x=%02x-%02x-%02x\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Network address = %02x-%02x-%02x=%02x-%02x-%02x\n", pDevice->abyCurrentNetAddr[0], pDevice->abyCurrentNetAddr[1], pDevice->abyCurrentNetAddr[2], @@ -946,7 +879,7 @@ static BOOL device_release_WPADEV(PSDevice pDevice) wpahdr->req_ie_len = 0; skb_put(pDevice->skb, sizeof(viawget_wpa_header)); pDevice->skb->dev = pDevice->wpadev; - pDevice->skb->mac_header = pDevice->skb->data; + skb_reset_mac_header(pDevice->skb); pDevice->skb->pkt_type = PACKET_HOST; pDevice->skb->protocol = htons(ETH_P_802_2); memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb)); @@ -978,7 +911,6 @@ static const struct net_device_ops device_netdev_ops = { }; -#ifndef PRIVATE_OBJ static int device_found1(struct pci_dev *pcid, const struct pci_device_id *ent) @@ -1146,14 +1078,7 @@ device_found1(struct pci_dev *pcid, const struct pci_device_id *ent) dev->irq = pcid->irq; dev->netdev_ops = &device_netdev_ops; -#ifdef WIRELESS_EXT -//Einsn Modify for ubuntu-7.04 -// dev->wireless_handlers->get_wireless_stats = iwctl_get_wireless_stats; -#if WIRELESS_EXT > 12 dev->wireless_handlers = (struct iw_handler_def *)&iwctl_handler_def; -// netdev->wireless_handlers = NULL; -#endif /* WIRELESS_EXT > 12 */ -#endif /* WIRELESS_EXT */ rc = register_netdev(dev); if (rc) @@ -1179,17 +1104,17 @@ static void device_print_info(PSDevice pDevice) { struct net_device* dev=pDevice->dev; - DEVICE_PRT(MSG_LEVEL_INFO, KERN_INFO "%s: %s\n",dev->name, get_chip_name(pDevice->chip_id)); - DEVICE_PRT(MSG_LEVEL_INFO, KERN_INFO "%s: MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X", + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "%s: %s\n",dev->name, get_chip_name(pDevice->chip_id)); + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "%s: MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X", dev->name, dev->dev_addr[0],dev->dev_addr[1],dev->dev_addr[2], dev->dev_addr[3],dev->dev_addr[4],dev->dev_addr[5]); #ifdef IO_MAP - DEVICE_PRT(MSG_LEVEL_INFO, KERN_INFO" IO=0x%lx ",(ULONG) pDevice->ioaddr); - DEVICE_PRT(MSG_LEVEL_INFO, KERN_INFO" IRQ=%d \n", pDevice->dev->irq); + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO" IO=0x%lx ",(ULONG) pDevice->ioaddr); + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO" IRQ=%d \n", pDevice->dev->irq); #else - DEVICE_PRT(MSG_LEVEL_INFO, KERN_INFO" IO=0x%lx Mem=0x%lx ",(ULONG) pDevice->ioaddr,(ULONG) pDevice->PortOffset); - DEVICE_PRT(MSG_LEVEL_INFO, KERN_INFO" IRQ=%d \n", pDevice->dev->irq); + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO" IO=0x%lx Mem=0x%lx ",(ULONG) pDevice->ioaddr,(ULONG) pDevice->PortOffset); + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO" IRQ=%d \n", pDevice->dev->irq); #endif } @@ -1254,17 +1179,17 @@ static BOOL device_get_pci_info(PSDevice pDevice, struct pci_dev* pcid) { pDevice->pcid = pcid; - pci_read_config_byte(pcid, PCI_REG_COMMAND, &b); - pci_write_config_byte(pcid, PCI_REG_COMMAND, (b|COMMAND_BUSM)); + pci_read_config_byte(pcid, PCI_COMMAND, &b); + pci_write_config_byte(pcid, PCI_COMMAND, (b|PCI_COMMAND_MASTER)); #ifdef PLICE_DEBUG - //pci_read_config_word(pcid,PCI_REG_MAX_LAT,&max_lat); + //pci_read_config_word(pcid,PCI_MAX_LAT,&max_lat); //printk("max lat is %x,SubSystemID is %x\n",max_lat,pDevice->SubSystemID); //for (ii=0;ii<0xFF;ii++) - //pci_read_config_word(pcid,PCI_REG_MAX_LAT,&max_lat); + //pci_read_config_word(pcid,PCI_MAX_LAT,&max_lat); //max_lat = 0x20; - //pci_write_config_word(pcid,PCI_REG_MAX_LAT,max_lat); - //pci_read_config_word(pcid,PCI_REG_MAX_LAT,&max_lat); + //pci_write_config_word(pcid,PCI_MAX_LAT,max_lat); + //pci_read_config_word(pcid,PCI_MAX_LAT,&max_lat); //printk("max lat is %x\n",max_lat); for (ii=0;ii<0xFF;ii++) @@ -1314,7 +1239,7 @@ device_release_WPADEV(pDevice); ptr->prev->next=ptr->next; } else { - DEVICE_PRT(MSG_LEVEL_ERR, KERN_ERR "info struct not found\n"); + DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "info struct not found\n"); return; } #ifdef HOSTAP @@ -1336,7 +1261,6 @@ device_release_WPADEV(pDevice); pci_set_drvdata(pDevice->pcid,NULL); } } -#endif// ifndef PRIVATE_OBJ static BOOL device_init_rings(PSDevice pDevice) { void* vir_pool; @@ -1351,7 +1275,7 @@ static BOOL device_init_rings(PSDevice pDevice) { &pDevice->pool_dma); if (vir_pool == NULL) { - DEVICE_PRT(MSG_LEVEL_ERR,KERN_ERR "%s : allocate desc dma memory failed\n", pDevice->dev->name); + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s : allocate desc dma memory failed\n", pDevice->dev->name); return FALSE; } @@ -1379,7 +1303,7 @@ static BOOL device_init_rings(PSDevice pDevice) { &pDevice->tx_bufs_dma0); if (pDevice->tx0_bufs == NULL) { - DEVICE_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: allocate buf dma memory failed\n", pDevice->dev->name); + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: allocate buf dma memory failed\n", pDevice->dev->name); pci_free_consistent(pDevice->pcid, pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) + pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) + @@ -1468,7 +1392,7 @@ static void device_init_rd0_ring(PSDevice pDevice) { pDesc->pRDInfo = alloc_rd_info(); ASSERT(pDesc->pRDInfo); if (!device_alloc_rx_buf(pDevice, pDesc)) { - DEVICE_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc rx bufs\n", + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc rx bufs\n", pDevice->dev->name); } pDesc->next = &(pDevice->aRD0Ring[(i+1) % pDevice->sOpts.nRxDescs0]); @@ -1476,7 +1400,8 @@ static void device_init_rd0_ring(PSDevice pDevice) { pDesc->next_desc = cpu_to_le32(curr + sizeof(SRxDesc)); } - pDevice->aRD0Ring[i-1].next_desc = cpu_to_le32(pDevice->rd0_pool_dma); + if (i > 0) + pDevice->aRD0Ring[i-1].next_desc = cpu_to_le32(pDevice->rd0_pool_dma); pDevice->pCurrRD[0] = &(pDevice->aRD0Ring[0]); } @@ -1492,7 +1417,7 @@ static void device_init_rd1_ring(PSDevice pDevice) { pDesc->pRDInfo = alloc_rd_info(); ASSERT(pDesc->pRDInfo); if (!device_alloc_rx_buf(pDevice, pDesc)) { - DEVICE_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc rx bufs\n", + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc rx bufs\n", pDevice->dev->name); } pDesc->next = &(pDevice->aRD1Ring[(i+1) % pDevice->sOpts.nRxDescs1]); @@ -1500,7 +1425,8 @@ static void device_init_rd1_ring(PSDevice pDevice) { pDesc->next_desc = cpu_to_le32(curr + sizeof(SRxDesc)); } - pDevice->aRD1Ring[i-1].next_desc = cpu_to_le32(pDevice->rd1_pool_dma); + if (i > 0) + pDevice->aRD1Ring[i-1].next_desc = cpu_to_le32(pDevice->rd1_pool_dma); pDevice->pCurrRD[1] = &(pDevice->aRD1Ring[0]); } @@ -1513,7 +1439,7 @@ static void device_init_defrag_cb(PSDevice pDevice) { for (i = 0; i < CB_MAX_RX_FRAG; i++) { pDeF = &(pDevice->sRxDFCB[i]); if (!device_alloc_frag_buf(pDevice, pDeF)) { - DEVICE_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc frag bufs\n", + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc frag bufs\n", pDevice->dev->name); }; } @@ -1593,7 +1519,8 @@ static void device_init_td0_ring(PSDevice pDevice) { pDesc->next_desc = cpu_to_le32(curr+sizeof(STxDesc)); } - pDevice->apTD0Rings[i-1].next_desc = cpu_to_le32(pDevice->td0_pool_dma); + if (i > 0) + pDevice->apTD0Rings[i-1].next_desc = cpu_to_le32(pDevice->td0_pool_dma); pDevice->apTailTD[0] = pDevice->apCurrTD[0] =&(pDevice->apTD0Rings[0]); } @@ -1618,7 +1545,8 @@ static void device_init_td1_ring(PSDevice pDevice) { pDesc->next_desc = cpu_to_le32(curr+sizeof(STxDesc)); } - pDevice->apTD1Rings[i-1].next_desc = cpu_to_le32(pDevice->td1_pool_dma); + if (i > 0) + pDevice->apTD1Rings[i-1].next_desc = cpu_to_le32(pDevice->td1_pool_dma); pDevice->apTailTD[1] = pDevice->apCurrTD[1] = &(pDevice->apTD1Rings[0]); } @@ -1672,22 +1600,18 @@ static int device_rx_srv(PSDevice pDevice, UINT uIdx) { for (pRD = pDevice->pCurrRD[uIdx]; pRD->m_rd0RD0.f1Owner == OWNED_BY_HOST; pRD = pRD->next) { -// DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->pCurrRD = %x, works = %d\n", pRD, works); +// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->pCurrRD = %x, works = %d\n", pRD, works); if (works++>15) break; if (device_receive_frame(pDevice, pRD)) { if (!device_alloc_rx_buf(pDevice,pRD)) { - DEVICE_PRT(MSG_LEVEL_ERR, KERN_ERR + DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not allocate rx buf\n", pDevice->dev->name); break; } } pRD->m_rd0RD0.f1Owner = OWNED_BY_NIC; -#ifdef PRIVATE_OBJ - ref_set_rx_jiffies(pDevice->dev); -#else pDevice->dev->last_rx = jiffies; -#endif } pDevice->pCurrRD[uIdx]=pRD; @@ -1700,15 +1624,6 @@ static BOOL device_alloc_rx_buf(PSDevice pDevice, PSRxDesc pRD) { PDEVICE_RD_INFO pRDInfo=pRD->pRDInfo; -#ifdef PRIVATE_OBJ - - pRDInfo->skb=dev_alloc_skb(pDevice->rx_buf_sz); - if (pRDInfo->skb==NULL) - return FALSE; - ref_skb_remap(pDevice->dev, &(pRDInfo->ref_skb), pRDInfo->skb); - pRDInfo->skb_dma = pci_map_single(pDevice->pcid, pRDInfo->ref_skb.tail, pDevice->rx_buf_sz, - PCI_DMA_FROMDEVICE); -#else pRDInfo->skb = dev_alloc_skb((int)pDevice->rx_buf_sz); #ifdef PLICE_DEBUG @@ -1718,10 +1633,9 @@ static BOOL device_alloc_rx_buf(PSDevice pDevice, PSRxDesc pRD) { return FALSE; ASSERT(pRDInfo->skb); pRDInfo->skb->dev = pDevice->dev; - pRDInfo->skb_dma = pci_map_single(pDevice->pcid, pRDInfo->skb->tail, pDevice->rx_buf_sz, - PCI_DMA_FROMDEVICE); -#endif - *((PU32) &(pRD->m_rd0RD0)) = 0; + pRDInfo->skb_dma = pci_map_single(pDevice->pcid, skb_tail_pointer(pRDInfo->skb), + pDevice->rx_buf_sz, PCI_DMA_FROMDEVICE); + *((unsigned int *) &(pRD->m_rd0RD0)) = 0; /* FIX cast */ pRD->m_rd0RD0.wResCount = cpu_to_le16(pDevice->rx_buf_sz); pRD->m_rd0RD0.f1Owner = OWNED_BY_NIC; @@ -1735,20 +1649,11 @@ static BOOL device_alloc_rx_buf(PSDevice pDevice, PSRxDesc pRD) { BOOL device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF) { -#ifdef PRIVATE_OBJ - - pDeF->skb=dev_alloc_skb(pDevice->rx_buf_sz); - if (pDeF->skb==NULL) - return FALSE; - ref_skb_remap(pDevice->dev, &(pDeF->ref_skb), pDeF->skb); - -#else pDeF->skb = dev_alloc_skb((int)pDevice->rx_buf_sz); if (pDeF->skb == NULL) return FALSE; ASSERT(pDeF->skb); pDeF->skb->dev = pDevice->dev; -#endif return TRUE; } @@ -1767,9 +1672,6 @@ static int device_tx_srv(PSDevice pDevice, UINT uIdx) { struct sk_buff* skb; UINT uNodeIndex; PSMgmtObject pMgmt = pDevice->pMgmt; -#ifdef PRIVATE_OBJ - ref_sk_buff ref_skb; -#endif for (pTD = pDevice->apTailTD[uIdx]; pDevice->iTDUsed[uIdx] >0; pTD = pTD->next) { @@ -1789,9 +1691,6 @@ static int device_tx_srv(PSDevice pDevice, UINT uIdx) { uFIFOHeaderSize = pTD->pTDInfo->dwHeaderLength; uFrameSize = pTD->pTDInfo->dwReqCount - uFIFOHeaderSize; pTxBufHead = (PSTxBufHead) (pTD->pTDInfo->buf); -#ifdef PRIVATE_OBJ - ref_skb_remap(pDevice->dev, &ref_skb, pTD->pTDInfo->skb); -#endif // Update the statistics based on the Transmit status // now, we DO'NT check TSR0_CDH @@ -1807,23 +1706,19 @@ static int device_tx_srv(PSDevice pDevice, UINT uIdx) { uFIFOHeaderSize ); - if (BITbIsBitOff(byTsr1, TSR1_TERR)) { + if ( !(byTsr1 & TSR1_TERR)) { if (byTsr0 != 0) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Tx[%d] OK but has error. tsr1[%02X] tsr0[%02X].\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Tx[%d] OK but has error. tsr1[%02X] tsr0[%02X].\n", (INT)uIdx, byTsr1, byTsr0); } if ((pTxBufHead->wFragCtl & FRAGCTL_ENDFRAG) != FRAGCTL_NONFRAG) { pDevice->s802_11Counter.TransmittedFragmentCount ++; } pStats->tx_packets++; -#ifdef PRIVATE_OBJ - pStats->tx_bytes += *(ref_skb.len); -#else pStats->tx_bytes += pTD->pTDInfo->skb->len; -#endif } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Tx[%d] dropped & tsr1[%02X] tsr0[%02X].\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Tx[%d] dropped & tsr1[%02X] tsr0[%02X].\n", (INT)uIdx, byTsr1, byTsr0); pStats->tx_errors++; pStats->tx_dropped++; @@ -1832,33 +1727,24 @@ static int device_tx_srv(PSDevice pDevice, UINT uIdx) { if ((pTD->pTDInfo->byFlags & TD_FLAGS_PRIV_SKB) != 0) { if (pDevice->bEnableHostapd) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "tx call back netif.. \n"); -#ifdef PRIVATE_OBJ - ref_skb_remap(pDevice->apdev, &(ref_skb), pTD->pTDInfo->skb); - ref_skb.mac.raw = ref_skb.data; - *(ref_skb.pkt_type) = PACKET_OTHERHOST; - //*(ref_skb.protocol) = htons(ETH_P_802_2); - memset(ref_skb.cb, 0, sizeof(ref_skb.cb)); - netif_rx(ref_skb.skb); -#else + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "tx call back netif.. \n"); skb = pTD->pTDInfo->skb; skb->dev = pDevice->apdev; - skb->mac_header = skb->data; + skb_reset_mac_header(skb); skb->pkt_type = PACKET_OTHERHOST; //skb->protocol = htons(ETH_P_802_2); memset(skb->cb, 0, sizeof(skb->cb)); netif_rx(skb); -#endif } } - if (BITbIsBitOn(byTsr1, TSR1_TERR)) { + if (byTsr1 & TSR1_TERR) { if ((pTD->pTDInfo->byFlags & TD_FLAGS_PRIV_SKB) != 0) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Tx[%d] fail has error. tsr1[%02X] tsr0[%02X].\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Tx[%d] fail has error. tsr1[%02X] tsr0[%02X].\n", (INT)uIdx, byTsr1, byTsr0); } -// DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Tx[%d] fail has error. tsr1[%02X] tsr0[%02X].\n", +// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Tx[%d] fail has error. tsr1[%02X] tsr0[%02X].\n", // (INT)uIdx, byTsr1, byTsr0); if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && @@ -1875,7 +1761,7 @@ static int device_tx_srv(PSDevice pDevice, UINT uIdx) { wAID = pMgmt->sNodeDBTable[uNodeIndex].wAID; pMgmt->abyPSTxMap[wAID >> 3] |= byMask[wAID & 7]; pTD->pTDInfo->byFlags &= ~(TD_FLAGS_NETIF_SKB); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "tx_srv:tx fail re-queue sta index= %d, QueCnt= %d\n" + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "tx_srv:tx fail re-queue sta index= %d, QueCnt= %d\n" ,(INT)uNodeIndex, pMgmt->sNodeDBTable[uNodeIndex].wEnQueueCnt); pStats->tx_errors--; pStats->tx_dropped--; @@ -1894,7 +1780,7 @@ static int device_tx_srv(PSDevice pDevice, UINT uIdx) { if (AVAIL_TD(pDevice, uIdx) < RESERV_AC0DMA) { bFull = TRUE; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " AC0DMA is Full = %d\n", pDevice->iTDUsed[uIdx]); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " AC0DMA is Full = %d\n", pDevice->iTDUsed[uIdx]); } if (netif_queue_stopped(pDevice->dev) && (bFull==FALSE)){ netif_wake_queue(pDevice->dev); @@ -1911,7 +1797,7 @@ static int device_tx_srv(PSDevice pDevice, UINT uIdx) { static void device_error(PSDevice pDevice, WORD status) { if (status & ISR_FETALERR) { - DEVICE_PRT(MSG_LEVEL_ERR, KERN_ERR + DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: Hardware fatal error.\n", pDevice->dev->name); netif_stop_queue(pDevice->dev); @@ -2005,31 +1891,24 @@ INT MlmeThread( } -#ifdef PRIVATE_OBJ - -int __device_open(HANDLE pExDevice) { - PSDevice_info pDevice_info = (PSDevice_info)pExDevice; - PSDevice pDevice = (PSDevice)(pDevice_info->pWDevice); - -#else static int device_open(struct net_device *dev) { PSDevice pDevice=(PSDevice) netdev_priv(dev); int i; +#ifdef WPA_SM_Transtatus + extern SWPAResult wpa_Result; #endif + pDevice->rx_buf_sz = PKT_BUF_SZ; if (!device_init_rings(pDevice)) { return -ENOMEM; } //2008-5-13 <add> by chester -#ifndef PRIVATE_OBJ i=request_irq(pDevice->pcid->irq, &device_intr, IRQF_SHARED, dev->name, dev); if (i) return i; -#endif //printk("DEBUG1\n"); #ifdef WPA_SM_Transtatus - extern SWPAResult wpa_Result; memset(wpa_Result.ifname,0,sizeof(wpa_Result.ifname)); wpa_Result.proto = 0; wpa_Result.key_mgmt = 0; @@ -2037,7 +1916,7 @@ static int device_open(struct net_device *dev) { wpa_Result.authenticated = FALSE; pDevice->fWPA_Authened = FALSE; #endif -DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call device init rd0 ring\n"); +DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call device init rd0 ring\n"); device_init_rd0_ring(pDevice); device_init_rd1_ring(pDevice); device_init_defrag_cb(pDevice); @@ -2088,15 +1967,11 @@ device_init_rd0_ring(pDevice); // if (( SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_RADIOCTL)&0x06)==0x04) // return -ENOMEM; -DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call device_init_registers\n"); +DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call device_init_registers\n"); device_init_registers(pDevice, DEVICE_INIT_COLD); MACvReadEtherAddress(pDevice->PortOffset, pDevice->abyCurrentNetAddr); memcpy(pDevice->pMgmt->abyMACAddr, pDevice->abyCurrentNetAddr, U_ETHER_ADDR_LEN); -#ifdef PRIVATE_OBJ - __device_set_multi(pExDevice); -#else device_set_multi(pDevice->dev); -#endif // Init for Key Management KeyvInitTable(&pDevice->sKey, pDevice->PortOffset); @@ -2131,7 +2006,7 @@ DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call device_init_registers\n"); //printk("DEBUG2\n"); -DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call MACvIntEnable\n"); +DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call MACvIntEnable\n"); MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE); if (pDevice->pMgmt->eConfigMode == WMAC_CONFIG_AP) { @@ -2143,22 +2018,13 @@ DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call MACvIntEnable\n"); } pDevice->flags |=DEVICE_FLAGS_OPENED; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_open success.. \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_open success.. \n"); return 0; } -#ifdef PRIVATE_OBJ - -int __device_close(HANDLE pExDevice) { - PSDevice_info pDevice_info = (PSDevice_info)pExDevice; - struct net_device *dev = pDevice_info->dev; - PSDevice pDevice = (PSDevice)(pDevice_info->pWDevice); - -#else static int device_close(struct net_device *dev) { PSDevice pDevice=(PSDevice) netdev_priv(dev); -#endif PSMgmtObject pMgmt = pDevice->pMgmt; //PLICE_DEBUG-> #ifdef THREAD @@ -2207,32 +2073,23 @@ device_release_WPADEV(pDevice); //PLICE_DEBUG-> //tasklet_kill(&pDevice->RxMngWorkItem); //PLICE_DEBUG<- - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_close.. \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_close.. \n"); return 0; } -#ifdef PRIVATE_OBJ - -int __device_dma0_tx_80211(HANDLE pExDevice, struct sk_buff *skb) { - PSDevice_info pDevice_info = (PSDevice_info)pExDevice; - PSDevice pDevice = (PSDevice)(pDevice_info->pWDevice); - ref_sk_buff ref_skb; - -#else static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev) { PSDevice pDevice=netdev_priv(dev); -#endif PBYTE pbMPDU; UINT cbMPDULen = 0; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_tx_80211\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_tx_80211\n"); spin_lock_irq(&pDevice->lock); if (AVAIL_TD(pDevice, TYPE_TXDMA0) <= 0) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_tx_80211, td0 <=0\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_tx_80211, td0 <=0\n"); dev_kfree_skb_irq(skb); spin_unlock_irq(&pDevice->lock); return 0; @@ -2244,14 +2101,8 @@ static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev) { return 0; }; -#ifdef PRIVATE_OBJ - ref_skb_remap(pDevice->dev, &ref_skb, skb); - cbMPDULen = *(ref_skb.len); - pbMPDU = ref_skb.data; -#else cbMPDULen = skb->len; pbMPDU = skb->data; -#endif vDMA0_tx_80211(pDevice, skb, pbMPDU, cbMPDULen); @@ -2268,16 +2119,13 @@ BOOL device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, UINT uNodeIndex) { PSTxDesc pHeadTD, pLastTD; UINT cbFrameBodySize; UINT uMACfragNum; - BYTE byPktTyp; + BYTE byPktType; BOOL bNeedEncryption = FALSE; PSKeyItem pTransmitKey = NULL; UINT cbHeaderSize; UINT ii; SKeyItem STempKey; // BYTE byKeyIndex = 0; -#ifdef PRIVATE_OBJ - ref_sk_buff ref_skb; -#endif if (pDevice->bStopTx0Pkt == TRUE) { @@ -2287,33 +2135,24 @@ BOOL device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, UINT uNodeIndex) { if (AVAIL_TD(pDevice, TYPE_TXDMA0) <= 0) { dev_kfree_skb_irq(skb); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_xmit, td0 <=0\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_xmit, td0 <=0\n"); return FALSE; } if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { if (pDevice->uAssocCount == 0) { dev_kfree_skb_irq(skb); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_xmit, assocCount = 0\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_xmit, assocCount = 0\n"); return FALSE; } } -#ifdef PRIVATE_OBJ - ref_skb_remap(pDevice->dev, &(ref_skb), skb); -#endif pHeadTD = pDevice->apCurrTD[TYPE_TXDMA0]; pHeadTD->m_td1TD1.byTCR = (TCR_EDP|TCR_STP); -#ifdef PRIVATE_OBJ - memcpy(pDevice->sTxEthHeader.abyDstAddr, (PBYTE)(ref_skb.data), U_HEADER_LEN); - cbFrameBodySize = *(ref_skb.len) - U_HEADER_LEN; - -#else memcpy(pDevice->sTxEthHeader.abyDstAddr, (PBYTE)(skb->data), U_HEADER_LEN); cbFrameBodySize = skb->len - U_HEADER_LEN; -#endif // 802.1H if (ntohs(pDevice->sTxEthHeader.wType) > MAX_DATA_LEN) { @@ -2325,7 +2164,7 @@ BOOL device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, UINT uNodeIndex) { dev_kfree_skb_irq(skb); return FALSE; } - byPktTyp = (BYTE)pDevice->byPacketType; + byPktType = (BYTE)pDevice->byPacketType; if (pDevice->bFixRate) { @@ -2354,18 +2193,18 @@ BOOL device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, UINT uNodeIndex) { pDevice->byPreambleType = PREAMBLE_LONG; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dma0: pDevice->wCurrentRate = %d \n", pDevice->wCurrentRate); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dma0: pDevice->wCurrentRate = %d \n", pDevice->wCurrentRate); if (pDevice->wCurrentRate <= RATE_11M) { - byPktTyp = PK_TYPE_11B; + byPktType = PK_TYPE_11B; } else if (pDevice->eCurrentPHYType == PHY_TYPE_11A) { - byPktTyp = PK_TYPE_11A; + byPktType = PK_TYPE_11A; } else { if (pDevice->bProtectMode == TRUE) { - byPktTyp = PK_TYPE_11GB; + byPktType = PK_TYPE_11GB; } else { - byPktTyp = PK_TYPE_11GA; + byPktType = PK_TYPE_11GA; } } @@ -2384,7 +2223,7 @@ BOOL device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, UINT uNodeIndex) { pTransmitKey->uKeyLength ); } - vGenerateFIFOHeader(pDevice, byPktTyp, pDevice->pbyTmpBuff, bNeedEncryption, + vGenerateFIFOHeader(pDevice, byPktType, pDevice->pbyTmpBuff, bNeedEncryption, cbFrameBodySize, TYPE_TXDMA0, pHeadTD, &pDevice->sTxEthHeader, (PBYTE)skb->data, pTransmitKey, uNodeIndex, &uMACfragNum, @@ -2424,19 +2263,9 @@ BOOL device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, UINT uNodeIndex) { } //TYPE_AC0DMA data tx -#ifdef PRIVATE_OBJ - -int __device_xmit(HANDLE pExDevice, struct sk_buff *skb) { - PSDevice_info pDevice_info = (PSDevice_info)pExDevice; - PSDevice pDevice = (PSDevice)(pDevice_info->pWDevice); - struct net_device *dev = pDevice_info->dev; - ref_sk_buff ref_skb; - -#else static int device_xmit(struct sk_buff *skb, struct net_device *dev) { PSDevice pDevice=netdev_priv(dev); -#endif PSMgmtObject pMgmt = pDevice->pMgmt; PSTxDesc pHeadTD, pLastTD; UINT uNodeIndex = 0; @@ -2444,7 +2273,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { WORD wAID; UINT uMACfragNum = 1; UINT cbFrameBodySize; - BYTE byPktTyp; + BYTE byPktType; UINT cbHeaderSize; BOOL bNeedEncryption = FALSE; PSKeyItem pTransmitKey = NULL; @@ -2470,9 +2299,6 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { return 0; } -#ifdef PRIVATE_OBJ - ref_skb_remap(pDevice->dev, &ref_skb, skb); -#endif if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { if (pDevice->uAssocCount == 0) { @@ -2480,19 +2306,11 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { spin_unlock_irq(&pDevice->lock); return 0; } -#ifdef PRIVATE_OBJ - if (IS_MULTICAST_ADDRESS((PBYTE)(ref_skb.data))) { -#else if (IS_MULTICAST_ADDRESS((PBYTE)(skb->data))) { -#endif uNodeIndex = 0; bNodeExist = TRUE; if (pMgmt->sNodeDBTable[0].bPSEnable) { -#ifdef PRIVATE_OBJ - skb_queue_tail(&(pMgmt->sNodeDBTable[0].sTxPSQueue), ref_skb.skb); -#else skb_queue_tail(&(pMgmt->sNodeDBTable[0].sTxPSQueue), skb); -#endif pMgmt->sNodeDBTable[0].wEnQueueCnt++; // set tx map pMgmt->abyPSTxMap[0] |= byMask[0]; @@ -2500,22 +2318,14 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { return 0; } }else { -#ifdef PRIVATE_OBJ - if (BSSDBbIsSTAInNodeDB(pMgmt, (PBYTE)(ref_skb.data), &uNodeIndex)) { -#else if (BSSDBbIsSTAInNodeDB(pMgmt, (PBYTE)(skb->data), &uNodeIndex)) { -#endif if (pMgmt->sNodeDBTable[uNodeIndex].bPSEnable) { -#ifdef PRIVATE_OBJ - skb_queue_tail(&pMgmt->sNodeDBTable[uNodeIndex].sTxPSQueue, ref_skb.skb); -#else skb_queue_tail(&pMgmt->sNodeDBTable[uNodeIndex].sTxPSQueue, skb); -#endif pMgmt->sNodeDBTable[uNodeIndex].wEnQueueCnt++; // set tx map wAID = pMgmt->sNodeDBTable[uNodeIndex].wAID; pMgmt->abyPSTxMap[wAID >> 3] |= byMask[wAID & 7]; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set:pMgmt->abyPSTxMap[%d]= %d\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set:pMgmt->abyPSTxMap[%d]= %d\n", (wAID >> 3), pMgmt->abyPSTxMap[wAID >> 3]); spin_unlock_irq(&pDevice->lock); return 0; @@ -2533,7 +2343,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { } if (bNodeExist == FALSE) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"Unknown STA not found in node DB \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"Unknown STA not found in node DB \n"); dev_kfree_skb_irq(skb); spin_unlock_irq(&pDevice->lock); return 0; @@ -2545,13 +2355,8 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { pHeadTD->m_td1TD1.byTCR = (TCR_EDP|TCR_STP); -#ifdef PRIVATE_OBJ - memcpy(pDevice->sTxEthHeader.abyDstAddr, (PBYTE)(ref_skb.data), U_HEADER_LEN); - cbFrameBodySize = *(ref_skb.len) - U_HEADER_LEN; -#else memcpy(pDevice->sTxEthHeader.abyDstAddr, (PBYTE)(skb->data), U_HEADER_LEN); cbFrameBodySize = skb->len - U_HEADER_LEN; -#endif // 802.1H if (ntohs(pDevice->sTxEthHeader.wType) > MAX_DATA_LEN) { cbFrameBodySize += 8; @@ -2570,20 +2375,20 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { // get group key if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == TRUE) { bTKIP_UseGTK = TRUE; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"Get GTK.\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"Get GTK.\n"); break; } } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"Get PTK.\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"Get PTK.\n"); break; } }else if (pDevice->pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { pbyBSSID = pDevice->sTxEthHeader.abyDstAddr; //TO_DS = 0 and FROM_DS = 0 --> 802.11 MAC Address1 - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"IBSS Serach Key: \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"IBSS Serach Key: \n"); for (ii = 0; ii< 6; ii++) - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"%x \n", *(pbyBSSID+ii)); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"%x \n", *(pbyBSSID+ii)); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"\n"); // get pairwise key if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, PAIRWISE_KEY, &pTransmitKey) == TRUE) @@ -2594,19 +2399,19 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == FALSE) { pTransmitKey = NULL; if (pDevice->pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"IBSS and KEY is NULL. [%d]\n", pDevice->pMgmt->eCurrMode); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"IBSS and KEY is NULL. [%d]\n", pDevice->pMgmt->eCurrMode); } else - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"NOT IBSS and KEY is NULL. [%d]\n", pDevice->pMgmt->eCurrMode); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"NOT IBSS and KEY is NULL. [%d]\n", pDevice->pMgmt->eCurrMode); } else { bTKIP_UseGTK = TRUE; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"Get GTK.\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"Get GTK.\n"); } } while(FALSE); } if (pDevice->bEnableHostWEP) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"acdma0: STA index %d\n", uNodeIndex); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"acdma0: STA index %d\n", uNodeIndex); if (pDevice->bEncryptionEnable == TRUE) { pTransmitKey = &STempKey; pTransmitKey->byCipherSuite = pMgmt->sNodeDBTable[uNodeIndex].byCipherSuite; @@ -2624,7 +2429,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { uMACfragNum = cbGetFragCount(pDevice, pTransmitKey, cbFrameBodySize, &pDevice->sTxEthHeader); if (uMACfragNum > AVAIL_TD(pDevice, TYPE_AC0DMA)) { - DEVICE_PRT(MSG_LEVEL_ERR, KERN_DEBUG "uMACfragNum > AVAIL_TD(TYPE_AC0DMA) = %d\n", uMACfragNum); + DBG_PRT(MSG_LEVEL_ERR, KERN_DEBUG "uMACfragNum > AVAIL_TD(TYPE_AC0DMA) = %d\n", uMACfragNum); dev_kfree_skb_irq(skb); spin_unlock_irq(&pDevice->lock); return 0; @@ -2637,7 +2442,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { } } - byPktTyp = (BYTE)pDevice->byPacketType; + byPktType = (BYTE)pDevice->byPacketType; if (pDevice->bFixRate) { #ifdef PLICE_DEBUG @@ -2708,17 +2513,17 @@ pDevice->byTopCCKBasicRate,pDevice->byTopOFDMBasicRate); } } -// DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "acdma0: pDevice->wCurrentRate = %d \n", pDevice->wCurrentRate); +// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "acdma0: pDevice->wCurrentRate = %d \n", pDevice->wCurrentRate); if (pDevice->wCurrentRate <= RATE_11M) { - byPktTyp = PK_TYPE_11B; + byPktType = PK_TYPE_11B; } else if (pDevice->eCurrentPHYType == PHY_TYPE_11A) { - byPktTyp = PK_TYPE_11A; + byPktType = PK_TYPE_11A; } else { if (pDevice->bProtectMode == TRUE) { - byPktTyp = PK_TYPE_11GB; + byPktType = PK_TYPE_11GB; } else { - byPktTyp = PK_TYPE_11GA; + byPktType = PK_TYPE_11GA; } } @@ -2727,20 +2532,20 @@ pDevice->byTopCCKBasicRate,pDevice->byTopOFDMBasicRate); //#endif if (bNeedEncryption == TRUE) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ntohs Pkt Type=%04x\n", ntohs(pDevice->sTxEthHeader.wType)); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ntohs Pkt Type=%04x\n", ntohs(pDevice->sTxEthHeader.wType)); if ((pDevice->sTxEthHeader.wType) == TYPE_PKT_802_1x) { bNeedEncryption = FALSE; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Pkt Type=%04x\n", (pDevice->sTxEthHeader.wType)); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Pkt Type=%04x\n", (pDevice->sTxEthHeader.wType)); if ((pDevice->pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pDevice->pMgmt->eCurrState == WMAC_STATE_ASSOC)) { if (pTransmitKey == NULL) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Don't Find TX KEY\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Don't Find TX KEY\n"); } else { if (bTKIP_UseGTK == TRUE) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"error: KEY is GTK!!~~\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"error: KEY is GTK!!~~\n"); } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Find PTK [%lX]\n", pTransmitKey->dwKeyIndex); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Find PTK [%lX]\n", pTransmitKey->dwKeyIndex); bNeedEncryption = TRUE; } } @@ -2754,14 +2559,14 @@ pDevice->byTopCCKBasicRate,pDevice->byTopOFDMBasicRate); if (pDevice->bEnableHostWEP) { if ((uNodeIndex != 0) && (pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex & PAIRWISE_KEY)) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Find PTK [%lX]\n", pTransmitKey->dwKeyIndex); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Find PTK [%lX]\n", pTransmitKey->dwKeyIndex); bNeedEncryption = TRUE; } } } else { if (pTransmitKey == NULL) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"return no tx key\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"return no tx key\n"); dev_kfree_skb_irq(skb); spin_unlock_irq(&pDevice->lock); return 0; @@ -2770,27 +2575,18 @@ pDevice->byTopCCKBasicRate,pDevice->byTopOFDMBasicRate); } -#ifdef PRIVATE_OBJ - vGenerateFIFOHeader(pDevice, byPktTyp, pDevice->pbyTmpBuff, bNeedEncryption, - cbFrameBodySize, TYPE_AC0DMA, pHeadTD, - &pDevice->sTxEthHeader, (PBYTE)ref_skb.data, pTransmitKey, uNodeIndex, - &uMACfragNum, - &cbHeaderSize - ); -#else #ifdef PLICE_DEBUG //if (skb->len == 98) //{ // printk("ping:len is %d\n"); //} #endif - vGenerateFIFOHeader(pDevice, byPktTyp, pDevice->pbyTmpBuff, bNeedEncryption, + vGenerateFIFOHeader(pDevice, byPktType, pDevice->pbyTmpBuff, bNeedEncryption, cbFrameBodySize, TYPE_AC0DMA, pHeadTD, &pDevice->sTxEthHeader, (PBYTE)skb->data, pTransmitKey, uNodeIndex, &uMACfragNum, &cbHeaderSize ); -#endif if (MACbIsRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PS)) { // Disable PS @@ -2811,11 +2607,7 @@ pDevice->byTopCCKBasicRate,pDevice->byTopOFDMBasicRate); // Save the information needed by the tx interrupt handler // to complete the Send request -#ifdef PRIVATE_OBJ - pLastTD->pTDInfo->skb = ref_skb.skb; -#else pLastTD->pTDInfo->skb = skb; -#endif pLastTD->pTDInfo->byFlags = 0; pLastTD->pTDInfo->byFlags |= TD_FLAGS_NETIF_SKB; #ifdef TxInSleep @@ -2867,31 +2659,18 @@ BOOL bTxeapol_key = FALSE; } MACvTransmitAC0(pDevice->PortOffset); -// DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "acdma0:pDevice->apCurrTD= %p\n", pHeadTD); +// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "acdma0:pDevice->apCurrTD= %p\n", pHeadTD); -#ifdef PRIVATE_OBJ - ref_set_tx_jiffies(pDevice->dev); -#else dev->trans_start = jiffies; -#endif spin_unlock_irq(&pDevice->lock); return 0; } -#ifdef PRIVATE_OBJ - -int __device_intr(int irq, HANDLE pExDevice, struct pt_regs *regs) { - PSDevice_info pDevice_info = (PSDevice_info)pExDevice; - PSDevice pDevice = (PSDevice)(pDevice_info->pWDevice); - - -#else static irqreturn_t device_intr(int irq, void *dev_instance) { struct net_device* dev=dev_instance; PSDevice pDevice=(PSDevice) netdev_priv(dev); -#endif int max_count=0; DWORD dwMIBCounter=0; @@ -2909,13 +2688,13 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { return IRQ_RETVAL(handled); if (pDevice->dwIsr == 0xffffffff) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dwIsr = 0xffff\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dwIsr = 0xffff\n"); return IRQ_RETVAL(handled); } /* // 2008-05-21 <mark> by Richardtai, we can't read RSSI here, because no packet bound with RSSI - if ((BITbIsBitOn(pDevice->dwIsr, ISR_RXDMA0)) && + if ((pDevice->dwIsr & ISR_RXDMA0) && (pDevice->byLocalID != REV_ID_VT3253_B0) && (pDevice->bBSSIDFilter == TRUE)) { // update RSSI @@ -2948,7 +2727,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { MACvWriteISR(pDevice->PortOffset, pDevice->dwIsr); if (pDevice->dwIsr & ISR_FETALERR){ - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " ISR_FETALERR \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " ISR_FETALERR \n"); VNSvOutPortB(pDevice->PortOffset + MAC_REG_SOFTPWRCTL, 0); VNSvOutPortW(pDevice->PortOffset + MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPECTI); device_error(pDevice, pDevice->dwIsr); @@ -2956,7 +2735,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { if (pDevice->byLocalID > REV_ID_VT3253_B1) { - if (BITbIsBitOn(pDevice->dwIsr, ISR_MEASURESTART)) { + if (pDevice->dwIsr & ISR_MEASURESTART) { // 802.11h measure start pDevice->byOrgChannel = pDevice->byCurrentCh; VNSvInPortB(pDevice->PortOffset + MAC_REG_RCR, &(pDevice->byOrgRCR)); @@ -2988,7 +2767,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { MACvSelectPage0(pDevice->PortOffset); } } - if (BITbIsBitOn(pDevice->dwIsr, ISR_MEASUREEND)) { + if (pDevice->dwIsr & ISR_MEASUREEND) { // 802.11h measure end pDevice->bMeasureInProgress = FALSE; VNSvOutPortB(pDevice->PortOffset + MAC_REG_RCR, pDevice->byOrgRCR); @@ -3007,7 +2786,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { MACvSelectPage1(pDevice->PortOffset); MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL+1, MSRCTL1_TXPAUSE); MACvSelectPage0(pDevice->PortOffset); - if (BITbIsBitOn(byData, MSRCTL_FINISH)) { + if (byData & MSRCTL_FINISH) { // measure success s_vCompleteCurrentMeasure(pDevice, 0); } else { @@ -3015,7 +2794,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { s_vCompleteCurrentMeasure(pDevice, MEASURE_MODE_LATE); } } - if (BITbIsBitOn(pDevice->dwIsr, ISR_QUIETSTART)) { + if (pDevice->dwIsr & ISR_QUIETSTART) { do { ; } while (CARDbStartQuiet(pDevice) == FALSE); @@ -3064,11 +2843,11 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { if (pDevice->uBBVGADiffCount == 1) { // first VGA diff gain BBvSetVGAGainOffset(pDevice, pDevice->byBBVGANew); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"First RSSI[%d] NewGain[%d] OldGain[%d] Count[%d]\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"First RSSI[%d] NewGain[%d] OldGain[%d] Count[%d]\n", (int)ldBm, pDevice->byBBVGANew, pDevice->byBBVGACurrent, (int)pDevice->uBBVGADiffCount); } if (pDevice->uBBVGADiffCount >= BB_VGA_CHANGE_THRESHOLD) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RSSI[%d] NewGain[%d] OldGain[%d] Count[%d]\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RSSI[%d] NewGain[%d] OldGain[%d] Count[%d]\n", (int)ldBm, pDevice->byBBVGANew, pDevice->byBBVGACurrent, (int)pDevice->uBBVGADiffCount); BBvSetVGAGainOffset(pDevice, pDevice->byBBVGANew); } @@ -3297,18 +3076,9 @@ error2: } -#ifdef PRIVATE_OBJ - -void __device_set_multi(HANDLE pExDevice) { - PSDevice_info pDevice_info = (PSDevice_info)pExDevice; - ref_net_device *dev = &(pDevice_info->ref_dev); - PSDevice pDevice = (PSDevice)(pDevice_info->pWDevice); - -#else static void device_set_multi(struct net_device *dev) { PSDevice pDevice = (PSDevice) netdev_priv(dev); -#endif PSMgmtObject pMgmt = pDevice->pMgmt; u32 mc_filter[2]; @@ -3318,24 +3088,13 @@ static void device_set_multi(struct net_device *dev) { VNSvInPortB(pDevice->PortOffset + MAC_REG_RCR, &(pDevice->byRxMode)); -#ifdef PRIVATE_OBJ - if (*(dev->flags) & IFF_PROMISC) { /* Set promiscuous. */ - DEVICE_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: Promiscuous mode enabled.\n", pDevice->dev->name); - -#else if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */ - DEVICE_PRT(MSG_LEVEL_ERR,KERN_NOTICE "%s: Promiscuous mode enabled.\n", dev->name); -#endif + DBG_PRT(MSG_LEVEL_ERR,KERN_NOTICE "%s: Promiscuous mode enabled.\n", dev->name); /* Unconditionally log net taps. */ pDevice->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST|RCR_UNICAST); } -#ifdef PRIVATE_OBJ - else if ((*(dev->mc_count) > pDevice->multicast_limit) - || (*(dev->flags) & IFF_ALLMULTI)) { -#else else if ((dev->mc_count > pDevice->multicast_limit) || (dev->flags & IFF_ALLMULTI)) { -#endif MACvSelectPage1(pDevice->PortOffset); VNSvOutPortD(pDevice->PortOffset + MAC_REG_MAR0, 0xffffffff); VNSvOutPortD(pDevice->PortOffset + MAC_REG_MAR0 + 4, 0xffffffff); @@ -3344,13 +3103,8 @@ static void device_set_multi(struct net_device *dev) { } else { memset(mc_filter, 0, sizeof(mc_filter)); -#ifdef PRIVATE_OBJ - for (i = 0, mclist = dev->mc_list; mclist && i < *(dev->mc_count); - i++, mclist = mclist->next) { -#else for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; i++, mclist = mclist->next) { -#endif int bit_nr = ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26; mc_filter[bit_nr >> 5] |= cpu_to_le32(1 << (bit_nr & 31)); } @@ -3369,42 +3123,23 @@ static void device_set_multi(struct net_device *dev) { } VNSvOutPortB(pDevice->PortOffset + MAC_REG_RCR, pDevice->byRxMode); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byRxMode = %x\n", pDevice->byRxMode ); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byRxMode = %x\n", pDevice->byRxMode ); } -#ifdef PRIVATE_OBJ - -struct net_device_stats *__device_get_stats(HANDLE pExDevice) { - PSDevice_info pDevice_info = (PSDevice_info)pExDevice; - PSDevice pDevice = (PSDevice)(pDevice_info->pWDevice); - -#else static struct net_device_stats *device_get_stats(struct net_device *dev) { PSDevice pDevice=(PSDevice) netdev_priv(dev); -#endif return &pDevice->stats; } -#ifdef PRIVATE_OBJ - -int __device_ioctl(HANDLE pExDevice, struct ifreq *rq, int cmd) { - PSDevice_info pDevice_info = (PSDevice_info)pExDevice; - struct net_device *dev = pDevice_info->dev; - PSDevice pDevice = (PSDevice)(pDevice_info->pWDevice); - -#else static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { PSDevice pDevice = (PSDevice)netdev_priv(dev); -#endif -#ifdef WIRELESS_EXT struct iwreq *wrq = (struct iwreq *) rq; int rc =0; -#endif PSMgmtObject pMgmt = pDevice->pMgmt; PSCmdRequest pReq; @@ -3416,9 +3151,6 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { switch(cmd) { -#ifdef WIRELESS_EXT -//#if WIRELESS_EXT < 13 - case SIOCGIWNAME: rc = iwctl_giwname(dev, NULL, (char *)&(wrq->u.name), NULL); break; @@ -3490,13 +3222,13 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { // Set desired station name case SIOCSIWNICKN: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWNICKN \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWNICKN \n"); rc = -EOPNOTSUPP; break; // Get current station name case SIOCGIWNICKN: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWNICKN \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWNICKN \n"); rc = -EOPNOTSUPP; break; @@ -3593,21 +3325,17 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { } break; -#if WIRELESS_EXT > 9 // Get the current Tx-Power case SIOCGIWTXPOW: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWTXPOW \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWTXPOW \n"); rc = -EOPNOTSUPP; break; case SIOCSIWTXPOW: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWTXPOW \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWTXPOW \n"); rc = -EOPNOTSUPP; break; -#endif // WIRELESS_EXT > 9 - -#if WIRELESS_EXT > 10 case SIOCSIWRETRY: rc = iwctl_siwretry(dev, NULL, &(wrq->u.retry), NULL); @@ -3618,8 +3346,6 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { rc = iwctl_giwretry(dev, NULL, &(wrq->u.retry), NULL); break; -#endif // WIRELESS_EXT > 10 - // Get range of parameters case SIOCGIWRANGE: @@ -3651,7 +3377,7 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { break; case SIOCSIWSENS: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSENS \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSENS \n"); rc = -EOPNOTSUPP; break; @@ -3677,21 +3403,21 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { // Set the spy list case SIOCSIWSPY: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSPY \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSPY \n"); rc = -EOPNOTSUPP; break; // Get the spy list case SIOCGIWSPY: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSPY \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSPY \n"); rc = -EOPNOTSUPP; break; #endif // WIRELESS_SPY case SIOCGIWPRIV: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPRIV \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPRIV \n"); rc = -EOPNOTSUPP; /* if(wrq->u.data.pointer) { @@ -3706,33 +3432,32 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { break; -//#endif // WIRELESS_EXT < 13 //2008-0409-07, <Add> by Einsn Liu #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT case SIOCSIWAUTH: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH \n"); rc = iwctl_siwauth(dev, NULL, &(wrq->u.param), NULL); break; case SIOCGIWAUTH: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAUTH \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAUTH \n"); rc = iwctl_giwauth(dev, NULL, &(wrq->u.param), NULL); break; case SIOCSIWGENIE: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWGENIE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWGENIE \n"); rc = iwctl_siwgenie(dev, NULL, &(wrq->u.data), wrq->u.data.pointer); break; case SIOCGIWGENIE: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWGENIE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWGENIE \n"); rc = iwctl_giwgenie(dev, NULL, &(wrq->u.data), wrq->u.data.pointer); break; case SIOCSIWENCODEEXT: { char extra[sizeof(struct iw_encode_ext)+MAX_KEY_LEN+1]; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODEEXT \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODEEXT \n"); if(wrq->u.encoding.pointer){ memset(extra, 0, sizeof(struct iw_encode_ext)+MAX_KEY_LEN+1); if(wrq->u.encoding.length > (sizeof(struct iw_encode_ext)+ MAX_KEY_LEN)){ @@ -3752,20 +3477,18 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { break; case SIOCGIWENCODEEXT: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODEEXT \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODEEXT \n"); rc = iwctl_giwencodeext(dev, NULL, &(wrq->u.encoding), NULL); break; case SIOCSIWMLME: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMLME \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMLME \n"); rc = iwctl_siwmlme(dev, NULL, &(wrq->u.data), wrq->u.data.pointer); break; #endif // #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT //End Add -- //2008-0409-07, <Add> by Einsn Liu -#endif // WIRELESS_EXT - case IOCTL_CMD_TEST: if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) { @@ -3804,20 +3527,12 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { case IOCTL_CMD_HOSTAPD: -#if WIRELESS_EXT > 8 - rc = hostap_ioctl(pDevice, &wrq->u.data); -#else // WIRELESS_EXT > 8 - rc = hostap_ioctl(pDevice, (struct iw_point *) &wrq->u.data); -#endif // WIRELESS_EXT > 8 + rc = hostap_ioctl(pDevice, &wrq->u.data); break; case IOCTL_CMD_WPA: -#if WIRELESS_EXT > 8 - rc = wpa_ioctl(pDevice, &wrq->u.data); -#else // WIRELESS_EXT > 8 - rc = wpa_ioctl(pDevice, (struct iw_point *) &wrq->u.data); -#endif // WIRELESS_EXT > 8 + rc = wpa_ioctl(pDevice, &wrq->u.data); break; case SIOCETHTOOL: @@ -3826,7 +3541,7 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { default: rc = -EOPNOTSUPP; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Ioctl command not support..%x\n", cmd); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Ioctl command not support..%x\n", cmd); } @@ -3839,7 +3554,7 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { spin_unlock_irq(&pDevice->lock); } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Commit the settings\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Commit the settings\n"); spin_lock_irq(&pDevice->lock); pDevice->bLinkPass = FALSE; memset(pMgmt->abyCurrBSSID, 0, 6); @@ -3883,7 +3598,6 @@ static int ethtool_ioctl(struct net_device *dev, void *useraddr) } /*------------------------------------------------------------------*/ -#ifndef PRIVATE_OBJ MODULE_DEVICE_TABLE(pci, device_id_table); @@ -4016,59 +3730,6 @@ viawget_resume(struct pci_dev *pcid) #endif -#endif //#ifndef PRIVATE_OBJ - -#ifdef PRIVATE_OBJ - - -int __device_hw_reset(HANDLE pExDevice){ - PSDevice_info pDevice_info = (PSDevice_info)pExDevice; - - return MACbSoftwareReset(pDevice_info->port_offset); -} - -int __device_hw_init(HANDLE pExDevice){ - PSDevice_info pDevice_info = (PSDevice_info)pExDevice; - PSDevice pDevice; - - pDevice = (PSDevice)kmalloc(sizeof(DEVICE_INFO), (int)GFP_ATOMIC); - if (pDevice == NULL) - return FALSE; - - memset(pDevice, 0, sizeof(DEVICE_INFO)); - pDevice_info->pWDevice = pDevice; - pDevice->PortOffset = pDevice_info->port_offset; - pDevice->dev = pDevice_info->dev; - pDevice->pcid = pDevice_info->pcid; - pDevice->chip_id = pDevice_info->chip_id; - pDevice->memaddr = pDevice_info->mem_addr; - pDevice->ioaddr = pDevice_info->io_addr; - pDevice->io_size = pDevice_info->io_size; - pDevice->nTxQueues = pDevice_info->nTxQueues; - pDevice->multicast_limit = pDevice_info->multicast_limit; - pDevice->sMgmtObj.pAdapter = (PVOID)pDevice; - pDevice->pMgmt = &(pDevice->sMgmtObj); - MACvInitialize(pDevice->PortOffset); - device_get_options(pDevice, 0 , pDevice_info->dev->name); - device_set_options(pDevice); - pDevice->sOpts.flags &= pDevice_info->flags; - pDevice->flags = pDevice->sOpts.flags | (pDevice_info->flags & 0xFF000000UL); - spin_lock_init(&(pDevice->lock)); - - return TRUE; -} - - -void __device_read_mac(HANDLE pExDevice, PBYTE dev_addr){ - PSDevice_info pDevice_info = (PSDevice_info)pExDevice; - PSDevice pDevice = (PSDevice)(pDevice_info->pWDevice); - - MACvReadEtherAddress(pDevice->PortOffset, dev_addr); - return; -} - - -#endif |