diff options
Diffstat (limited to 'drivers/staging/vt6655')
81 files changed, 1544 insertions, 4463 deletions
diff --git a/drivers/staging/vt6655/80211hdr.h b/drivers/staging/vt6655/80211hdr.h index b4bbb8d..e5cee6f 100644 --- a/drivers/staging/vt6655/80211hdr.h +++ b/drivers/staging/vt6655/80211hdr.h @@ -16,10 +16,11 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + * * File: 80211hdr.h * - * Purpose: Defines the macros, types, and functions for dealing - * with 802.11 MAC headers. + * Purpose: 802.11 MAC headers related pre-defines and macros. + * * * Author: Lyndon Chen * @@ -27,15 +28,10 @@ * */ - - #ifndef __80211HDR_H__ #define __80211HDR_H__ - -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif /*--------------------- Export Definitions -------------------------*/ // bit type diff --git a/drivers/staging/vt6655/80211mgr.c b/drivers/staging/vt6655/80211mgr.c index 84745fb6..d309049 100644 --- a/drivers/staging/vt6655/80211mgr.c +++ b/drivers/staging/vt6655/80211mgr.c @@ -16,10 +16,9 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * * File: 80211mgr.c * - * Purpose: Handles the 802.11 managment support functions + * Purpose: Handles the 802.11 management support functions * * Author: Lyndon Chen * @@ -53,28 +52,12 @@ * */ - - -#if !defined(__TMACRO_H__) #include "tmacro.h" -#endif -#if !defined(__TETHER_H__) #include "tether.h" -#endif -#if !defined(__80211MGR_H__) #include "80211mgr.h" -#endif -#if !defined(__80211HDR_H__) #include "80211hdr.h" -#endif -#if !defined(__DEVICE_H__) #include "device.h" -#endif -#if !defined(__WPA_H__) #include "wpa.h" -#endif - - /*--------------------- Static Definitions -------------------------*/ @@ -236,7 +219,7 @@ vMgrDecodeBeacon( break; default: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in beacon decode.\n", pItem->byElementID); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in beacon decode.\n", pItem->byElementID); break; } @@ -431,7 +414,7 @@ vMgrDecodeAssocRequest( break; default: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in assocreq decode.\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in assocreq decode.\n", pItem->byElementID); break; } @@ -509,7 +492,7 @@ vMgrDecodeAssocResponse( if ((((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) && (pItem->byElementID == WLAN_EID_EXTSUPP_RATES)) { pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pFrame->pExtSuppRates=[%p].\n", pItem); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pFrame->pExtSuppRates=[%p].\n", pItem); } else { pFrame->pExtSuppRates = NULL; @@ -610,7 +593,7 @@ vMgrDecodeReassocRequest( pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem; break; default: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in reassocreq decode.\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in reassocreq decode.\n", pItem->byElementID); break; } @@ -685,7 +668,7 @@ vMgrDecodeProbeRequest( break; default: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Bad EID=%dd in probereq\n", pItem->byElementID); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Bad EID=%dd in probereq\n", pItem->byElementID); break; } @@ -747,7 +730,6 @@ vMgrDecodeProbeResponse( ) { PWLAN_IE pItem; -// BYTE byCheckEID = 0; pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; @@ -765,12 +747,6 @@ vMgrDecodeProbeResponse( + WLAN_PROBERESP_OFF_SSID); while( ((PBYTE)pItem) < (pFrame->pBuf + pFrame->len) ) { - /* - if (pItem->byElementID < byCheckEID) - break; - else - byCheckEID = pItem->byElementID; -*/ switch (pItem->byElementID) { case WLAN_EID_SSID: if (pFrame->pSSID == NULL) @@ -841,7 +817,7 @@ vMgrDecodeProbeResponse( break; default: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Bad EID=%dd in proberesp\n", pItem->byElementID); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Bad EID=%dd in proberesp\n", pItem->byElementID); break; } diff --git a/drivers/staging/vt6655/80211mgr.h b/drivers/staging/vt6655/80211mgr.h index dc54a65..5efc132 100644 --- a/drivers/staging/vt6655/80211mgr.h +++ b/drivers/staging/vt6655/80211mgr.h @@ -16,10 +16,11 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + * * File: 80211mgr.h * - * Purpose: Defines the macros, types, and functions for dealing - * with 802.11 managment frames. + * Purpose: 802.11 managment frames pre-defines. + * * * Author: Lyndon Chen * @@ -27,17 +28,11 @@ * */ - #ifndef __80211MGR_H__ #define __80211MGR_H__ -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif -#if !defined(__80211HDR_H__) #include "80211hdr.h" -#endif - /*--------------------- Export Definitions -------------------------*/ @@ -273,7 +268,6 @@ typedef struct _WLAN_IE_FH_PARMS { BYTE byHopIndex; } WLAN_IE_FH_PARMS, *PWLAN_IE_FH_PARMS; - // DS Parameter Set #pragma pack(1) typedef struct tagWLAN_IE_DS_PARMS { @@ -719,6 +713,7 @@ typedef struct tagWLAN_FR_DEAUTHEN { } WLAN_FR_DEAUTHEN, *PWLAN_FR_DEAUTHEN; /*--------------------- Export Functions --------------------------*/ + VOID vMgrEncodeBeacon( IN PWLAN_FR_BEACON pFrame diff --git a/drivers/staging/vt6655/IEEE11h.c b/drivers/staging/vt6655/IEEE11h.c index 5f25b8e..2567143 100644 --- a/drivers/staging/vt6655/IEEE11h.c +++ b/drivers/staging/vt6655/IEEE11h.c @@ -31,34 +31,13 @@ * */ - -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif -#if !defined(__UMEM_H__) -#include "umem.h" -#endif -#if !defined(__TMACRO_H__) #include "tmacro.h" -#endif -#if !defined(__TETHER_H__) #include "tether.h" -#endif -#if !defined(__IEEE11h_H__) #include "IEEE11h.h" -#endif - -#if !defined(__DEVICE_H__) #include "device.h" -#endif -#if !defined(__WMGR_H__) #include "wmgr.h" -#endif -#if !defined(__RXTX_H__) #include "rxtx.h" -#endif - - /*--------------------- Static Definitions -------------------------*/ static int msglevel =MSG_LEVEL_INFO; @@ -120,13 +99,13 @@ typedef struct _WLAN_FRAME_TPCREP { /*--------------------- Static Functions --------------------------*/ static BOOL s_bRxMSRReq(PSMgmtObject pMgmt, PWLAN_FRAME_MSRREQ pMSRReq, UINT uLength) { - UINT uNumOfEIDs = 0; + size_t uNumOfEIDs = 0; BOOL bResult = TRUE; if (uLength <= WLAN_A3FR_MAXLEN) { - MEMvCopy(pMgmt->abyCurrentMSRReq, pMSRReq, uLength); + memcpy(pMgmt->abyCurrentMSRReq, pMSRReq, uLength); } - uNumOfEIDs = ((uLength - OFFSET(WLAN_FRAME_MSRREQ, sMSRReqEIDs))/ (sizeof(WLAN_IE_MEASURE_REQ))); + uNumOfEIDs = ((uLength - offsetof(WLAN_FRAME_MSRREQ, sMSRReqEIDs))/ (sizeof(WLAN_IE_MEASURE_REQ))); pMgmt->pCurrMeasureEIDRep = &(((PWLAN_FRAME_MSRREP) (pMgmt->abyCurrentMSRRep))->sMSRRepEIDs[0]); pMgmt->uLengthOfRepEIDs = 0; bResult = CARDbStartMeasure(pMgmt->pAdapter, @@ -153,9 +132,9 @@ static BOOL s_bRxTPCReq(PSMgmtObject pMgmt, PWLAN_FRAME_TPCREQ pTPCReq, BYTE byR WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_ACTION) ); - MEMvCopy( pFrame->Header.abyAddr1, pTPCReq->Header.abyAddr2, WLAN_ADDR_LEN); - MEMvCopy( pFrame->Header.abyAddr2, CARDpGetCurrentAddress(pMgmt->pAdapter), WLAN_ADDR_LEN); - MEMvCopy( pFrame->Header.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); + memcpy( pFrame->Header.abyAddr1, pTPCReq->Header.abyAddr2, WLAN_ADDR_LEN); + memcpy( pFrame->Header.abyAddr2, CARDpGetCurrentAddress(pMgmt->pAdapter), WLAN_ADDR_LEN); + memcpy( pFrame->Header.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); pFrame->byCategory = 0; pFrame->byAction = 3; @@ -271,11 +250,11 @@ IEEE11hbMgrRxAction ( } break; default: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Unknown Action = %d\n", pAction->byAction); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Unknown Action = %d\n", pAction->byAction); break; } } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Unknown Category = %d\n", pAction->byCategory); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Unknown Category = %d\n", pAction->byCategory); pAction->byCategory |= 0x80; //return (CARDbSendPacket(pMgmt->pAdapter, pAction, PKT_TYPE_802_11_MNG, uLength)); @@ -291,7 +270,7 @@ BOOL IEEE11hbMSRRepTx ( { PSMgmtObject pMgmt = (PSMgmtObject) pMgmtHandle; PWLAN_FRAME_MSRREP pMSRRep = (PWLAN_FRAME_MSRREP) (pMgmt->abyCurrentMSRRep + sizeof(STxMgmtPacket)); - UINT uLength = 0; + size_t uLength = 0; PSTxMgmtPacket pTxPacket = NULL; pTxPacket = (PSTxMgmtPacket)pMgmt->abyCurrentMSRRep; @@ -303,15 +282,15 @@ BOOL IEEE11hbMSRRepTx ( WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_ACTION) ); - MEMvCopy( pMSRRep->Header.abyAddr1, ((PWLAN_FRAME_MSRREQ) (pMgmt->abyCurrentMSRReq))->Header.abyAddr2, WLAN_ADDR_LEN); - MEMvCopy( pMSRRep->Header.abyAddr2, CARDpGetCurrentAddress(pMgmt->pAdapter), WLAN_ADDR_LEN); - MEMvCopy( pMSRRep->Header.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); + memcpy( pMSRRep->Header.abyAddr1, ((PWLAN_FRAME_MSRREQ) (pMgmt->abyCurrentMSRReq))->Header.abyAddr2, WLAN_ADDR_LEN); + memcpy( pMSRRep->Header.abyAddr2, CARDpGetCurrentAddress(pMgmt->pAdapter), WLAN_ADDR_LEN); + memcpy( pMSRRep->Header.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); pMSRRep->byCategory = 0; pMSRRep->byAction = 1; pMSRRep->byDialogToken = ((PWLAN_FRAME_MSRREQ) (pMgmt->abyCurrentMSRReq))->byDialogToken; - uLength = pMgmt->uLengthOfRepEIDs + OFFSET(WLAN_FRAME_MSRREP, sMSRRepEIDs); + uLength = pMgmt->uLengthOfRepEIDs + offsetof(WLAN_FRAME_MSRREP, sMSRRepEIDs); pTxPacket->cbMPDULen = uLength; pTxPacket->cbPayloadLen = uLength - WLAN_HDR_ADDR3_LEN; diff --git a/drivers/staging/vt6655/IEEE11h.h b/drivers/staging/vt6655/IEEE11h.h index 22bcaf1..0f61edd 100644 --- a/drivers/staging/vt6655/IEEE11h.h +++ b/drivers/staging/vt6655/IEEE11h.h @@ -31,17 +31,9 @@ #ifndef __IEEE11h_H__ #define __IEEE11h_H__ - -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif -#if !defined(__80211HDR_H__) #include "80211hdr.h" -#endif -#if !defined(__80211MGR_H__) #include "80211mgr.h" -#endif - /*--------------------- Export Definitions -------------------------*/ @@ -52,17 +44,9 @@ /*--------------------- Export Types ------------------------------*/ /*--------------------- Export Functions --------------------------*/ -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ BOOL IEEE11hbMSRRepTx ( IN PVOID pMgmtHandle ); -#ifdef __cplusplus -} /* End of extern "C" { */ -#endif /* __cplusplus */ - - #endif // __IEEE11h_H__ diff --git a/drivers/staging/vt6655/Kconfig b/drivers/staging/vt6655/Kconfig index a01b1e4..9bec95a 100644 --- a/drivers/staging/vt6655/Kconfig +++ b/drivers/staging/vt6655/Kconfig @@ -1,6 +1,6 @@ config VT6655 tristate "VIA Technologies VT6655 support" - depends on PCI + depends on WIRELESS_EXT && PCI ---help--- This is a vendor-written driver for VIA VT6655. diff --git a/drivers/staging/vt6655/Makefile b/drivers/staging/vt6655/Makefile index 7d76e7e..931deb1 100644 --- a/drivers/staging/vt6655/Makefile +++ b/drivers/staging/vt6655/Makefile @@ -1,8 +1,8 @@ # TODO: all of these should be removed -EXTRA_CFLAGS += -DLINUX -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -D__NO_VERSION__ +EXTRA_CFLAGS += -DLINUX -D__KERNEL__ -D__NO_VERSION__ EXTRA_CFLAGS += -DHOSTAP -vt6655-y += device_main.o \ +vt6655_stage-y += device_main.o \ card.o \ mac.o \ baseband.o \ @@ -35,4 +35,4 @@ vt6655-y += device_main.o \ vntwifi.o \ IEEE11h.o -obj-$(CONFIG_VT6655) += vt6655.o +obj-$(CONFIG_VT6655) += vt6655_stage.o diff --git a/drivers/staging/vt6655/Makefile.arm b/drivers/staging/vt6655/Makefile.arm deleted file mode 100644 index 2d2ccad..0000000 --- a/drivers/staging/vt6655/Makefile.arm +++ /dev/null @@ -1,181 +0,0 @@ -# -# -# Build options: -# PRIV_OBJ := 1 for object version -# BIG_ENDIAN := 1 for big-endian mode -# -# arm-linux-tools chain are located at: -# /usr/local/bin/arm-linux-gcc -# /usr/local/bin/arm-linux-ld -# - -IO_MAP := 0 -HOSTAP := 1 -PRIV_OBJ := 1 -BIG_ENDIAN := 1 - -test_dir = $(shell [ -e $(dir)/include/linux ] && echo $(dir)) -KSP := $(foreach dir, $(KSP), $(test_dir)) - -KSRC := $(firstword $(KSP)) - -#ifeq (,$(KSRC)) -# $(error Linux kernel source not found) -#endif - -# check kernel version -KVER := $(shell uname -r | cut -c1-3 | sed 's/2\.[56]/2\.6/') -KERVER2=$(shell uname -r | cut -d. -f2) - -ifeq ($(KVER), 2.6) -# 2.6 kernel -TARGET = viawget.ko - -else -TARGET = viawget.o - -endif - -INSTDIR := $(shell find /lib/modules/$(shell uname -r) -name $(TARGET) -printf "%h\n" | sort | head -1) -ifeq (,$(INSTDIR)) - ifeq (,$(KERVER2)) - ifneq (,$(wildcard /lib/modules/$(shell uname -r)/kernel)) - INSTDIR := /lib/modules/$(shell uname -r)/kernel/drivers/net - else - INSTDIR := /lib/modules/$(shell uname -r)/net - endif - else - ifneq ($(KERVER2),2) - INSTDIR := /lib/modules/$(shell uname -r)/kernel/drivers/net - else - INSTDIR := /lib/modules/$(shell uname -r)/net - endif - endif -endif - - -SRC = device_main.c card.c mac.c baseband.c wctl.c 80211mgr.c \ - wcmd.c wmgr.c bssdb.c rxtx.c dpc.c power.c datarate.c srom.c \ - mib.c rc4.c tether.c tcrc.c ioctl.c hostap.c wpa.c key.c tkip.c \ - michael.c wroute.c rf.c iwctl.c wpactl.c wpa2.c aes_ccmp.c - -ifeq ($(IO_MAP), 1) - CFLAGS += -DIO_MAP -endif - -ifeq ($(HOSTAP), 1) - CFLAGS += -DHOSTAP -endif - -ifeq ($(PRIV_OBJ), 1) - CFLAGS += -DPRIVATE_OBJ -endif - -ifeq ($(BIG_ENDIAN), 1) - CFLAGS += -D__BIG_ENDIAN - CFLAGS += -mbig-endian - LDOPTS += -EB -else - CFLAGS += -mlittle-endian - LDOPTS += -EL -endif - -CFLAGS += -I$(PWD) -I$(PWD)/../include -I$(PWD)/../solomon - - -# build rule -ifeq ($(KVER), 2.6) -# 2.6 kernel - -ifndef KERNEL_CONF -KERNEL_CONF= $(KSRC)/.config -endif - -include ${KERNEL_CONF} - -obj-m += viawget.o - -viawget-objs := device_main.o card.o mac.o baseband.o wctl.o 80211mgr.o \ - wcmd.o wmgr.o bssdb.o rxtx.o dpc.o power.o datarate.o srom.o \ - mib.o rc4.o tether.o tcrc.o ioctl.o hostap.o wpa.o key.o tkip.o \ - michael.o wroute.o rf.o iwctl.o wpactl.o wpa2.o aes_ccmp.o - -.c.o: - $(CC) $(CFLAGS) -o $@ $< - -default: - make -C $(KSRC) SUBDIRS=$(shell pwd) modules - -else - -# 2.2/2.4 kernel -OBJS := device_main.o card.o mac.o baseband.o wctl.o 80211mgr.o \ - wcmd.o wmgr.o bssdb.o rxtx.o dpc.o power.o datarate.o srom.o \ - mib.o rc4.o tether.o tcrc.o ioctl.o hostap.o wpa.o key.o tkip.o \ - michael.o wroute.o rf.o iwctl.o wpactl.o wpa2.o - - -CC := /usr/local/bin/arm-linux-gcc -LD := /usr/local/bin/arm-linux-ld - -CFLAGS += -Wall -DLINUX -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -D__NO_VERSION__ -O2 -pipe -#CFLAGS += -Wstrict-prototypes -fomit-frame-pointer -COPTS+= -march=armv4 -fno-strict-aliasing -fno-common -#COPTS+= -mapcs-32 -mtune=xscale -mshort-load-bytes -msoft-float -mfp=2 -#COPTS+= -mthumb -mcpu=arm9 -ffunction-sections -fdata-sections - - -.SILENT: $(TARGET) clean - - - -ifeq ($(PRIV_OBJ), 1) - -ifeq ($(BIG_ENDIAN), 1) - TARGET = arm_be_g.o -else - TARGET = arm_le_g.o -endif - -endif - - - -$(TARGET): $(filter-out $(TARGET), $(SRC:.c=.o)) - $(LD) $(LDOPTS) -r $^ -o $@ - echo - echo "***********************************" - echo "Build options:" - echo " VERSION $(KVER)" - echo -n " SMP " - if [ "$(SMP)" = "1" ]; \ - then echo "Enabled"; else echo "Disabled"; fi - - -endif # ifeq ($(KVER),2.6) - - -ifeq ($(KVER), 2.6) -install: default -else -install: clean $(TARGET) -endif - mkdir -p $(MOD_ROOT)$(INSTDIR) - install -m 644 -o root $(TARGET) $(MOD_ROOT)$(INSTDIR) - -ifeq (,$(MOD_ROOT)) - /sbin/depmod -a || true -else - /sbin/depmod -b $(MOD_ROOT) -a || true -endif - - -uninstall: - rm -f $(INSTDIR)/$(TARGET) - /sbin/depmod -a - -clean: - rm -f $(TARGET) $(SRC:.c=.o) *~ - rm -f .*.o.d .*.o.cmd .*.ko.cmd *.mod.c *.mod.o - --include .depend.mak diff --git a/drivers/staging/vt6655/Makefile.x86 b/drivers/staging/vt6655/Makefile.x86 deleted file mode 100644 index 69082f0..0000000 --- a/drivers/staging/vt6655/Makefile.x86 +++ /dev/null @@ -1,209 +0,0 @@ -# -# Build options: -# PRIV_OBJ := 1 for object version -# - -IO_MAP := 0 -HOSTAP := 1 -PRIV_OBJ := 1 - -KSP := /lib/modules/$(shell uname -r)/build \ - /usr/src/linux-$(shell uname -r) \ - /usr/src/linux-$(shell uname -r | sed 's/-.*//') \ - /usr/src/kernel-headers-$(shell uname -r) \ - /usr/src/kernel-source-$(shell uname -r) \ - /usr/src/linux-$(shell uname -r | sed 's/\([0-9]*\.[0-9]*\)\..*/\1/') \ - /usr/src/linux - -test_dir = $(shell [ -e $(dir)/include/linux ] && echo $(dir)) -KSP := $(foreach dir, $(KSP), $(test_dir)) - -KSRC := $(firstword $(KSP)) - -ifeq (,$(KSRC)) - $(error Linux kernel source not found) -endif - -# check kernel version -KVER := $(shell uname -r | cut -c1-3 | sed 's/2\.[56]/2\.6/') -KERVER2=$(shell uname -r | cut -d. -f2) - -ifeq ($(KVER), 2.6) -# 2.6 kernel -TARGET = viawget.ko - -else -TARGET = viawget.o - -endif - -INSTDIR := $(shell find /lib/modules/$(shell uname -r) -name $(TARGET) -printf "%h\n" | sort | head -1) -ifeq (,$(INSTDIR)) - ifeq (,$(KERVER2)) - ifneq (,$(wildcard /lib/modules/$(shell uname -r)/kernel)) - INSTDIR := /lib/modules/$(shell uname -r)/kernel/drivers/net - else - INSTDIR := /lib/modules/$(shell uname -r)/net - endif - else - ifneq ($(KERVER2),2) - INSTDIR := /lib/modules/$(shell uname -r)/kernel/drivers/net - else - INSTDIR := /lib/modules/$(shell uname -r)/net - endif - endif -endif - - -SRC = device_main.c card.c mac.c baseband.c wctl.c 80211mgr.c \ - wcmd.c wmgr.c bssdb.c wpa2.c rxtx.c dpc.c power.c datarate.c \ - srom.c mib.c rc4.c tether.c tcrc.c ioctl.c hostap.c wpa.c key.c \ - tkip.c michael.c wroute.c rf.c iwctl.c wpactl.c aes_ccmp.c - -ifeq ($(IO_MAP), 1) - CFLAGS += -DIO_MAP -endif - -ifeq ($(HOSTAP), 1) - CFLAGS += -DHOSTAP -endif - -ifeq ($(PRIV_OBJ), 1) - CFLAGS += -DPRIVATE_OBJ -endif - -CFLAGS += -I$(PWD) -I$(PWD)/../include -I$(PWD)/../solomon - - -# build rule -ifeq ($(KVER), 2.6) -# 2.6 kernel - -ifndef KERNEL_CONF -KERNEL_CONF= $(KSRC)/.config -endif - -include ${KERNEL_CONF} - -obj-m += viawget.o - -viawget-objs := device_main.o card.o mac.o baseband.o wctl.o 80211mgr.o \ - wcmd.o wmgr.o bssdb.o rxtx.o dpc.o power.o datarate.o srom.o \ - mib.o rc4.o tether.o tcrc.o ioctl.o hostap.o wpa.o key.o tkip.o \ - michael.o wroute.o rf.o iwctl.o wpactl.o wpa2.o aes_ccmp.o - -.c.o: - $(CC) $(CFLAGS) -o $@ $< - -default: - make -C $(KSRC) SUBDIRS=$(shell pwd) modules - -else - -# 2.2/2.4 kernel -OBJS := device_main.o card.o mac.o baseband.o wctl.o 80211mgr.o \ - wcmd.o wmgr.o bssdb.o rxtx.o dpc.o power.o datarate.o srom.o \ - mib.o rc4.o tether.o tcrc.o ioctl.o hostap.o wpa.o key.o tkip.o \ - michael.o wroute.o rf.o iwctl.o wpactl.o wpa2.o aes_ccmp.o - -VERSION_FILE := $(KSRC)/include/linux/version.h -CONFIG_FILE := $(KSRC)/include/linux/config.h - - -ifeq (,$(wildcard $(VERSION_FILE))) - $(error Linux kernel source not configured - missing version.h) -endif - -ifeq (,$(wildcard $(CONFIG_FILE))) - $(error Linux kernel source not configured - missing config.h) -endif - -ifneq (,$(findstring egcs-2.91.66, $(shell cat /proc/version))) - CC := kgcc gcc cc -else - CC := gcc cc -endif - -test_cc = $(shell which $(cc) > /dev/null 2>&1 && echo $(cc)) -CC := $(foreach cc, $(CC), $(test_cc)) -CC := $(firstword $(CC)) - -CFLAGS += -Wall -DLINUX -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -D__NO_VERSION__ -O2 -pipe -CFLAGS += -I$(KSRC)/include -Wstrict-prototypes -fomit-frame-pointer -CFLAGS += $(shell [ -f $(KSRC)/include/linux/modversions.h ] && \ - echo "-DMODVERSIONS -include $(KSRC)/include/linux/modversions.h") - -.SILENT: $(TARGET) clean - - -# look for SMP in config.h -SMP := $(shell $(CC) $(CFLAGS) -E -dM $(CONFIG_FILE) | \ - grep CONFIG_SMP | awk '{ print $$3 }') - -ifneq ($(SMP),1) - SMP := 0 -endif - - -ifeq ($(SMP), 1) - CFLAGS += -D__SMP__ -endif - - -ifeq ($(PRIV_OBJ), 1) - CFLAGS += -DPRIVATE_OBJ - TARGET = x86g_up.o - -ifeq ($(SMP), 1) - TARGET = x86g_smp.o -endif - -endif - - -# check x86_64 -SUBARCH := $(shell uname -m) -ifeq ($(SUBARCH),x86_64) - CFLAGS += -mcmodel=kernel -mno-red-zone -endif - - -$(TARGET): $(filter-out $(TARGET), $(SRC:.c=.o)) - $(LD) -r $^ -o $@ - echo; echo - echo "**************************************************" - echo "Build options:" - echo " VERSION $(KVER)" - echo -n " SMP " - if [ "$(SMP)" = "1" ]; \ - then echo "Enabled"; else echo "Disabled"; fi - - - -endif # ifeq ($(KVER),2.6) - - -ifeq ($(KVER), 2.6) -install: default -else -install: clean $(TARGET) -endif - mkdir -p $(MOD_ROOT)$(INSTDIR) - install -m 644 -o root $(TARGET) $(MOD_ROOT)$(INSTDIR) - -ifeq (,$(MOD_ROOT)) - /sbin/depmod -a || true -else - /sbin/depmod -b $(MOD_ROOT) -a || true -endif - - -uninstall: - rm -f $(INSTDIR)/$(TARGET) - /sbin/depmod -a - -clean: - rm -f $(TARGET) $(SRC:.c=.o) *~ - rm -f .*.o.d .*.o.cmd .*.ko.cmd *.mod.c *.mod.o - --include .depend.mak diff --git a/drivers/staging/vt6655/TODO b/drivers/staging/vt6655/TODO new file mode 100644 index 0000000..8462cd1 --- /dev/null +++ b/drivers/staging/vt6655/TODO @@ -0,0 +1,21 @@ +TODO: +- remove __cplusplus ifdefs -- done +- prepare for merge with vt6656 driver: + - rename DEVICE_PRT() to DBG_PRT() -- done + - share 80211*.h includes + - move code for channel mapping from card.c to channel.c + - split rf.c + - remove dead code + - abstract VT3253 chipset specific code +- add common vt665x infrastructure +- kill ttype.h +- switch to use LIB80211 +- switch to use MAC80211 +- use kernel coding style +- checkpatch.pl fixes +- sparse fixes +- integrate with drivers/net/wireless + +Please send any patches to Greg Kroah-Hartman <greg@kroah.com>, +Forest Bond <forest@alittletooquiet.net> and Bartlomiej Zolnierkiewicz +<bzolnier@gmail.com>. diff --git a/drivers/staging/vt6655/aes_ccmp.c b/drivers/staging/vt6655/aes_ccmp.c index 59cc018..2614ed3 100644 --- a/drivers/staging/vt6655/aes_ccmp.c +++ b/drivers/staging/vt6655/aes_ccmp.c @@ -33,16 +33,8 @@ * */ -#if !defined(__UMEM_H__) -#include "umem.h" -#endif -#if !defined(__DEVICE_H__) #include "device.h" -#endif -#if !defined(__80211HDR_H__) #include "80211hdr.h" -#endif - /*--------------------- Static Definitions -------------------------*/ @@ -285,7 +277,7 @@ int ii,jj,kk; pbyPayload = pbyIV + 8; //IV-length abyNonce[0] = 0x00; //now is 0, if Qos here will be priority - MEMvCopy(&(abyNonce[1]), pMACHeader->abyAddr2, U_ETHER_ADDR_LEN); + memcpy(&(abyNonce[1]), pMACHeader->abyAddr2, U_ETHER_ADDR_LEN); abyNonce[7] = pbyIV[7]; abyNonce[8] = pbyIV[6]; abyNonce[9] = pbyIV[5]; @@ -295,7 +287,7 @@ int ii,jj,kk; //MIC_IV MIC_IV[0] = 0x59; - MEMvCopy(&(MIC_IV[1]), &(abyNonce[0]), 13); + memcpy(&(MIC_IV[1]), &(abyNonce[0]), 13); MIC_IV[14] = (BYTE)(wPayloadSize >> 8); MIC_IV[15] = (BYTE)(wPayloadSize & 0xff); @@ -307,16 +299,16 @@ int ii,jj,kk; byTmp = (BYTE)(pMACHeader->wFrameCtl >> 8); byTmp &= 0x87; MIC_HDR1[3] = byTmp | 0x40; - MEMvCopy(&(MIC_HDR1[4]), pMACHeader->abyAddr1, U_ETHER_ADDR_LEN); - MEMvCopy(&(MIC_HDR1[10]), pMACHeader->abyAddr2, U_ETHER_ADDR_LEN); + memcpy(&(MIC_HDR1[4]), pMACHeader->abyAddr1, U_ETHER_ADDR_LEN); + memcpy(&(MIC_HDR1[10]), pMACHeader->abyAddr2, U_ETHER_ADDR_LEN); //MIC_HDR2 - MEMvCopy(&(MIC_HDR2[0]), pMACHeader->abyAddr3, U_ETHER_ADDR_LEN); + memcpy(&(MIC_HDR2[0]), pMACHeader->abyAddr3, U_ETHER_ADDR_LEN); byTmp = (BYTE)(pMACHeader->wSeqCtl & 0xff); MIC_HDR2[6] = byTmp & 0x0f; MIC_HDR2[7] = 0; if ( bA4 ) { - MEMvCopy(&(MIC_HDR2[8]), pMACHeader->abyAddr4, U_ETHER_ADDR_LEN); + memcpy(&(MIC_HDR2[8]), pMACHeader->abyAddr4, U_ETHER_ADDR_LEN); } else { MIC_HDR2[8] = 0x00; MIC_HDR2[9] = 0x00; @@ -341,7 +333,7 @@ int ii,jj,kk; wCnt = 1; abyCTRPLD[0] = 0x01; - MEMvCopy(&(abyCTRPLD[1]), &(abyNonce[0]), 13); + memcpy(&(abyCTRPLD[1]), &(abyNonce[0]), 13); for(jj=wPayloadSize; jj>16; jj=jj-16) { @@ -358,13 +350,13 @@ int ii,jj,kk; } AESv128(pbyRxKey,abyTmp,abyMIC); - MEMvCopy(pbyPayload, abyPlainText, 16); + memcpy(pbyPayload, abyPlainText, 16); wCnt++; pbyPayload += 16; } //for wPayloadSize //last payload - MEMvCopy(&(abyLastCipher[0]), pbyPayload, jj); + memcpy(&(abyLastCipher[0]), pbyPayload, jj); for ( ii=jj; ii<16; ii++ ) { abyLastCipher[ii] = 0x00; } @@ -376,7 +368,7 @@ int ii,jj,kk; for ( kk=0; kk<16; kk++ ) { abyPlainText[kk] = abyTmp[kk] ^ abyLastCipher[kk]; } - MEMvCopy(pbyPayload, abyPlainText, jj); + memcpy(pbyPayload, abyPlainText, jj); pbyPayload += jj; //for MIC calculation @@ -401,7 +393,7 @@ int ii,jj,kk; //=>above is the dec-MIC from packet //-------------------------------------------- - if ( MEMEqualMemory(abyMIC,abyTmp,8) ) { + if ( !memcmp(abyMIC,abyTmp,8) ) { return TRUE; } else { return FALSE; diff --git a/drivers/staging/vt6655/aes_ccmp.h b/drivers/staging/vt6655/aes_ccmp.h index 2b1920f..f2ba1d5 100644 --- a/drivers/staging/vt6655/aes_ccmp.h +++ b/drivers/staging/vt6655/aes_ccmp.h @@ -30,9 +30,7 @@ #ifndef __AES_H__ #define __AES_H__ -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif /*--------------------- Export Definitions -------------------------*/ diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c index bc6db86..cd5b8ea 100644 --- a/drivers/staging/vt6655/baseband.c +++ b/drivers/staging/vt6655/baseband.c @@ -16,6 +16,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + * * File: baseband.c * * Purpose: Implement functions to access baseband @@ -44,32 +45,16 @@ * Add the comments. * 09-01-2003 Bryan YC Fan: RF & BB tables updated. * Modified BBvLoopbackOn & BBvLoopbackOff(). + * + * */ -#if !defined(__TMACRO_H__) #include "tmacro.h" -#endif -#if !defined(__TBIT_H__) -#include "tbit.h" -#endif -#if !defined(__TETHER_H__) #include "tether.h" -#endif -#if !defined(__MAC_H__) #include "mac.h" -#endif -#if !defined(__BASEBAND_H__) #include "baseband.h" -#endif -#if !defined(__SROM_H__) #include "srom.h" -#endif -#if !defined(__UMEM_H__) -#include "umem.h" -#endif -#if !defined(__RF_H__) #include "rf.h" -#endif /*--------------------- Static Definitions -------------------------*/ //static int msglevel =MSG_LEVEL_DEBUG; @@ -80,6 +65,7 @@ static int msglevel =MSG_LEVEL_INFO; /*--------------------- Static Classes ----------------------------*/ /*--------------------- Static Variables --------------------------*/ + /*--------------------- Static Functions --------------------------*/ /*--------------------- Export Variables --------------------------*/ @@ -1806,6 +1792,7 @@ BBuGetFrameTime ( if (uRateIdx > RATE_54M) { + ASSERT(0); return 0; } @@ -2041,7 +2028,7 @@ BOOL BBbReadEmbeded (DWORD_PTR dwIoBase, BYTE byBBAddr, PBYTE pbyData) // W_MAX_TIMEOUT is the timeout period for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortB(dwIoBase + MAC_REG_BBREGCTL, &byValue); - if (BITbIsBitOn(byValue, BBREGCTL_DONE)) + if (byValue & BBREGCTL_DONE) break; } @@ -2050,7 +2037,7 @@ BOOL BBbReadEmbeded (DWORD_PTR dwIoBase, BYTE byBBAddr, PBYTE pbyData) if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x30); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x30)\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x30)\n"); return FALSE; } return TRUE; @@ -2086,13 +2073,13 @@ BOOL BBbWriteEmbeded (DWORD_PTR dwIoBase, BYTE byBBAddr, BYTE byData) // W_MAX_TIMEOUT is the timeout period for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortB(dwIoBase + MAC_REG_BBREGCTL, &byValue); - if (BITbIsBitOn(byValue, BBREGCTL_DONE)) + if (byValue & BBREGCTL_DONE) break; } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x31); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x31)\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x31)\n"); return FALSE; } return TRUE; @@ -2118,7 +2105,7 @@ BOOL BBbIsRegBitsOn (DWORD_PTR dwIoBase, BYTE byBBAddr, BYTE byTestBits) BYTE byOrgData; BBbReadEmbeded(dwIoBase, byBBAddr, &byOrgData); - return BITbIsAllBitsOn(byOrgData, byTestBits); + return (byOrgData & byTestBits) == byTestBits; } @@ -2141,7 +2128,7 @@ BOOL BBbIsRegBitsOff (DWORD_PTR dwIoBase, BYTE byBBAddr, BYTE byTestBits) BYTE byOrgData; BBbReadEmbeded(dwIoBase, byBBAddr, &byOrgData); - return BITbIsAllBitsOff(byOrgData, byTestBits); + return (byOrgData & byTestBits) == 0; } /* @@ -2807,24 +2794,24 @@ BBvAntennaDiversity (PSDevice pDevice, BYTE byRxRate, BYTE bySQ3) return; } pDevice->uDiversityCnt++; - // DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->uDiversityCnt = %d\n", (int)pDevice->uDiversityCnt); + // DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->uDiversityCnt = %d\n", (int)pDevice->uDiversityCnt); pDevice->uNumSQ3[byRxRate]++; if (pDevice->byAntennaState == 0) { if (pDevice->uDiversityCnt > pDevice->ulDiversityNValue) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ulDiversityNValue=[%d],54M-[%d]\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ulDiversityNValue=[%d],54M-[%d]\n", (int)pDevice->ulDiversityNValue, (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate]); if (pDevice->uNumSQ3[pDevice->wAntDiversityMaxRate] < pDevice->uDiversityCnt/2) { pDevice->ulRatio_State0 = s_ulGetRatio(pDevice); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State0, rate = [%08x]\n", (int)pDevice->ulRatio_State0); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State0, rate = [%08x]\n", (int)pDevice->ulRatio_State0); if ( pDevice->byTMax == 0 ) return; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1.[%08x], uNumSQ3[%d]=%d, %d\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1.[%08x], uNumSQ3[%d]=%d, %d\n", (int)pDevice->ulRatio_State0, (int)pDevice->wAntDiversityMaxRate, (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate], (int)pDevice->uDiversityCnt); #ifdef PLICE_DEBUG @@ -2852,11 +2839,11 @@ BBvAntennaDiversity (PSDevice pDevice, BYTE byRxRate, BYTE bySQ3) del_timer(&pDevice->TimerSQ3Tmax1); pDevice->ulRatio_State1 = s_ulGetRatio(pDevice); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RX:SQ3_State1, rate0 = %08x,rate1 = %08x\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RX:SQ3_State1, rate0 = %08x,rate1 = %08x\n", (int)pDevice->ulRatio_State0,(int)pDevice->ulRatio_State1); if (pDevice->ulRatio_State1 < pDevice->ulRatio_State0) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"2.[%08x][%08x], uNumSQ3[%d]=%d, %d\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"2.[%08x][%08x], uNumSQ3[%d]=%d, %d\n", (int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1, (int)pDevice->wAntDiversityMaxRate, (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate], (int)pDevice->uDiversityCnt); @@ -2896,12 +2883,10 @@ TimerSQ3CallBack ( { PSDevice pDevice = (PSDevice)hDeviceContext; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TimerSQ3CallBack..."); - - + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TimerSQ3CallBack..."); spin_lock_irq(&pDevice->lock); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"3.[%08x][%08x], %d\n",(int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1, (int)pDevice->uDiversityCnt); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"3.[%08x][%08x], %d\n",(int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1, (int)pDevice->uDiversityCnt); #ifdef PLICE_DEBUG //printk("TimerSQ3CallBack1:call s_vChangeAntenna\n"); #endif @@ -2915,8 +2900,8 @@ TimerSQ3CallBack ( add_timer(&pDevice->TimerSQ3Tmax3); add_timer(&pDevice->TimerSQ3Tmax2); - spin_unlock_irq(&pDevice->lock); + spin_unlock_irq(&pDevice->lock); return; } @@ -2946,7 +2931,7 @@ TimerState1CallBack ( { PSDevice pDevice = (PSDevice)hDeviceContext; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TimerState1CallBack..."); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TimerState1CallBack..."); spin_lock_irq(&pDevice->lock); if (pDevice->uDiversityCnt < pDevice->ulDiversityMValue/100) { @@ -2961,11 +2946,11 @@ TimerState1CallBack ( add_timer(&pDevice->TimerSQ3Tmax2); } else { pDevice->ulRatio_State1 = s_ulGetRatio(pDevice); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State1, rate0 = %08x,rate1 = %08x\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State1, rate0 = %08x,rate1 = %08x\n", (int)pDevice->ulRatio_State0,(int)pDevice->ulRatio_State1); if ( pDevice->ulRatio_State1 < pDevice->ulRatio_State0 ) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"2.[%08x][%08x], uNumSQ3[%d]=%d, %d\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"2.[%08x][%08x], uNumSQ3[%d]=%d, %d\n", (int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1, (int)pDevice->wAntDiversityMaxRate, (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate], (int)pDevice->uDiversityCnt); diff --git a/drivers/staging/vt6655/baseband.h b/drivers/staging/vt6655/baseband.h index 09cf4f9..0682a396 100644 --- a/drivers/staging/vt6655/baseband.h +++ b/drivers/staging/vt6655/baseband.h @@ -16,6 +16,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + * * File: baseband.h * * Purpose: Implement functions to access baseband @@ -26,23 +27,12 @@ * */ - #ifndef __BASEBAND_H__ #define __BASEBAND_H__ - -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif - -#if !defined(__TETHER_H__) #include "tether.h" -#endif - -#if !defined(__DEVICE_H__) #include "device.h" -#endif - /*--------------------- Export Definitions -------------------------*/ @@ -106,12 +96,11 @@ #define TOP_RATE_2M 0x00200000 #define TOP_RATE_1M 0x00100000 + /*--------------------- Export Types ------------------------------*/ /*--------------------- Export Macros ------------------------------*/ - - #define BBvClearFOE(dwIoBase) \ { \ BBbWriteEmbeded(dwIoBase, 0xB1, 0); \ @@ -128,9 +117,6 @@ /*--------------------- Export Variables --------------------------*/ /*--------------------- Export Functions --------------------------*/ -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ UINT BBuGetFrameTime( @@ -173,26 +159,19 @@ VOID BBvSetDeepSleep(DWORD_PTR dwIoBase, BYTE byLocalID); VOID BBvExitDeepSleep(DWORD_PTR dwIoBase, BYTE byLocalID); // timer for antenna diversity + VOID -TimerSQ3CallBack( - IN HANDLE hDeviceContext +TimerSQ3CallBack ( + IN HANDLE hDeviceContext ); + VOID TimerState1CallBack( - IN HANDLE hDeviceContext + IN HANDLE hDeviceContext ); void BBvAntennaDiversity(PSDevice pDevice, BYTE byRxRate, BYTE bySQ3); VOID BBvClearAntDivSQ3Value (PSDevice pDevice); - -#ifdef __cplusplus -} /* End of extern "C" { */ -#endif /* __cplusplus */ - - #endif // __BASEBAND_H__ - - - diff --git a/drivers/staging/vt6655/bssdb.c b/drivers/staging/vt6655/bssdb.c index 746fadc..9535d44 100644 --- a/drivers/staging/vt6655/bssdb.c +++ b/drivers/staging/vt6655/bssdb.c @@ -39,65 +39,23 @@ * */ - -#if !defined(__TBIT_H__) -#include "tbit.h" -#endif//chester -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif -#if !defined(__TMACRO_H__) #include "tmacro.h" -#endif -#if !defined(__TETHER_H__) #include "tether.h" -#endif -#if !defined(__DEVICE_H__) #include "device.h" -#endif -#if !defined(__80211HDR_H__) #include "80211hdr.h" -#endif -#if !defined(__BSSDB_H__) #include "bssdb.h" -#endif -#if !defined(__WMGR_H__) #include "wmgr.h" -#endif -#if !defined(__DATARATE_H__) #include "datarate.h" -#endif -#if !defined(__DESC_H__) #include "desc.h" -#endif -#if !defined(__WCMD_H__) #include "wcmd.h" -#endif -#if !defined(__WPA_H__) #include "wpa.h" -#endif -#if !defined(__BASEBAND_H__) #include "baseband.h" -#endif -#if !defined(__RF_H__) #include "rf.h" -#endif -#if !defined(__CARD_H__) #include "card.h" -#endif -#if !defined(__MAC_H__) #include "mac.h" -#endif -#if !defined(__WPA2_H__) #include "wpa2.h" -#endif -#if !defined(__UMEM_H__) -#include "umem.h" -#endif -//DavidWang -#if !defined(__IOWPA_H__) #include "iowpa.h" -#endif //#define PLICE_DEBUG /*--------------------- Static Definitions -------------------------*/ @@ -170,7 +128,7 @@ BSSpSearchBSSList( IN HANDLE hDeviceContext, IN PBYTE pbyDesireBSSID, IN PBYTE pbyDesireSSID, - IN CARD_PHY_TYPE ePhyType + IN CARD_PHY_TYPE ePhyType ) { PSDevice pDevice = (PSDevice)hDeviceContext; @@ -183,11 +141,11 @@ BYTE ZeroBSSID[WLAN_BSSID_LEN]={0x00,0x00,0x00,0x00,0x00,0x00}; UINT ii = 0; // UINT jj = 0; //DavidWang if (pbyDesireBSSID != NULL) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BSSpSearchBSSList BSSID[%02X %02X %02X-%02X %02X %02X]\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BSSpSearchBSSList BSSID[%02X %02X %02X-%02X %02X %02X]\n", *pbyDesireBSSID,*(pbyDesireBSSID+1),*(pbyDesireBSSID+2), *(pbyDesireBSSID+3),*(pbyDesireBSSID+4),*(pbyDesireBSSID+5)); if ((!IS_BROADCAST_ADDRESS(pbyDesireBSSID)) && - (memcmp(pbyDesireBSSID, ZeroBSSID, 6)!= 0)) { + (memcmp(pbyDesireBSSID, ZeroBSSID, 6)!= 0)){ pbyBSSID = pbyDesireBSSID; } } @@ -207,7 +165,7 @@ if(pDevice->bLinkPass==FALSE) pCurrBSS->bSelected = FALSE; if (IS_ETH_ADDRESS_EQUAL(pCurrBSS->abyBSSID, pbyBSSID)) { if (pSSID != NULL) { // compare ssid - if (MEMEqualMemory(pSSID->abySSID, + if ( !memcmp(pSSID->abySSID, ((PWLAN_IE_SSID)pCurrBSS->abySSID)->abySSID, pSSID->len)) { if ((pMgmt->eConfigMode == WMAC_CONFIG_AUTO) || @@ -240,19 +198,19 @@ if(pDevice->bLinkPass==FALSE) pCurrBSS->bSelected = FALSE; if (pSSID != NULL) { // matched SSID - if (!MEMEqualMemory(pSSID->abySSID, + if (! !memcmp(pSSID->abySSID, ((PWLAN_IE_SSID)pCurrBSS->abySSID)->abySSID, pSSID->len) || (pSSID->len != ((PWLAN_IE_SSID)pCurrBSS->abySSID)->len)) { // SSID not match skip this BSS continue; - } + } } if (((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)) || ((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) - ) { + ){ // Type not match skip this BSS - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BSS type mismatch.... Config[%d] BSS[0x%04x]\n", pMgmt->eConfigMode, pCurrBSS->wCapInfo); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BSS type mismatch.... Config[%d] BSS[0x%04x]\n", pMgmt->eConfigMode, pCurrBSS->wCapInfo); continue; } @@ -260,7 +218,7 @@ if(pDevice->bLinkPass==FALSE) pCurrBSS->bSelected = FALSE; if (((ePhyType == PHY_TYPE_11A) && (PHY_TYPE_11A != pCurrBSS->eNetworkTypeInUse)) || ((ePhyType != PHY_TYPE_11A) && (PHY_TYPE_11A == pCurrBSS->eNetworkTypeInUse))) { // PhyType not match skip this BSS - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Physical type mismatch.... ePhyType[%d] BSS[%d]\n", ePhyType, pCurrBSS->eNetworkTypeInUse); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Physical type mismatch.... ePhyType[%d] BSS[%d]\n", ePhyType, pCurrBSS->eNetworkTypeInUse); continue; } } @@ -299,8 +257,8 @@ if(pDevice->bLinkPass==FALSE) pCurrBSS->bSelected = FALSE; /* if (pDevice->bRoaming == FALSE) { // Einsn Add @20070907 - ZERO_MEMORY(pbyDesireSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - MEMvCopy(pbyDesireSSID,pCurrBSS->abySSID,WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1) ; + memset(pbyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); + memcpy(pbyDesireSSID,pCurrBSS->abySSID,WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1) ; }*/ return(pSelect); @@ -398,7 +356,6 @@ BSSpAddrIsInBSSList( - /*+ * * Routine Description: @@ -450,7 +407,7 @@ BSSbInsertToBSSList ( } if (ii == MAX_BSS_NUM){ - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Get free KnowBSS node failed.\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Get free KnowBSS node failed.\n"); return FALSE; } // save the BSS info @@ -476,7 +433,7 @@ BSSbInsertToBSSList ( if (pExtSuppRates->len > WLAN_RATES_MAXLEN) pExtSuppRates->len = WLAN_RATES_MAXLEN; memcpy(pBSSList->abyExtSuppRates, pExtSuppRates, pExtSuppRates->len + WLAN_IEHDR_LEN); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BSSbInsertToBSSList: pExtSuppRates->len = %d\n", pExtSuppRates->len); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BSSbInsertToBSSList: pExtSuppRates->len = %d\n", pExtSuppRates->len); } else { memset(pBSSList->abyExtSuppRates, 0, WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1); @@ -543,7 +500,7 @@ BSSbInsertToBSSList ( } } if ((bIs802_1x == TRUE) && (pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len) && - (MEMEqualMemory(pSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySSID, pSSID->len))) { + ( !memcmp(pSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySSID, pSSID->len))) { bAdd_PMKID_Candidate((HANDLE)pDevice, pBSSList->abyBSSID, &pBSSList->sRSNCapObj); @@ -575,8 +532,6 @@ BSSbInsertToBSSList ( pIE_Country); } - - if ((bParsingQuiet == TRUE) && (pIE_Quiet != NULL)) { if ((((PWLAN_IE_QUIET)pIE_Quiet)->len == 8) && (((PWLAN_IE_QUIET)pIE_Quiet)->byQuietCount != 0)) { @@ -611,7 +566,7 @@ BSSbInsertToBSSList ( pBSSList->uIELength = uIELength; if (pBSSList->uIELength > WLAN_BEACON_FR_MAXLEN) pBSSList->uIELength = WLAN_BEACON_FR_MAXLEN; - MEMvCopy(pBSSList->abyIEs, pbyIEs, pBSSList->uIELength); + memcpy(pBSSList->abyIEs, pbyIEs, pBSSList->uIELength); return TRUE; } @@ -663,13 +618,14 @@ BSSbUpdateToBSSList ( if (pBSSList == NULL) return FALSE; + HIDWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(HIDWORD(qwTimestamp)); LODWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(LODWORD(qwTimestamp)); pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval); pBSSList->wCapInfo = cpu_to_le16(wCapInfo); pBSSList->uClearCount = 0; pBSSList->uChannel = byCurrChannel; -// DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BSSbUpdateToBSSList: pBSSList->uChannel: %d\n", pBSSList->uChannel); +// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BSSbUpdateToBSSList: pBSSList->uChannel: %d\n", pBSSList->uChannel); if (pSSID->len > WLAN_SSID_MAXLEN) pSSID->len = WLAN_SSID_MAXLEN; @@ -711,7 +667,7 @@ BSSbUpdateToBSSList ( } } - WPA_ClearRSN(pBSSList); //mike update + WPA_ClearRSN(pBSSList); //mike update if (pRSNWPA != NULL) { UINT uLen = pRSNWPA->len + 2; @@ -722,7 +678,7 @@ BSSbUpdateToBSSList ( } } - WPA2_ClearRSN(pBSSList); //mike update + WPA2_ClearRSN(pBSSList); //mike update if (pRSN != NULL) { UINT uLen = pRSN->len + 2; @@ -872,7 +828,7 @@ BSSvCreateOneNode( // if not found replace uInActiveCount is largest one. if ( ii == (MAX_NODE_NUM + 1)) { *puNodeIndex = SelectIndex; - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Replace inactive node = %d\n", SelectIndex); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Replace inactive node = %d\n", SelectIndex); // clear ps buffer if (pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue.next != NULL) { while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue)) != NULL) @@ -890,7 +846,7 @@ BSSvCreateOneNode( skb_queue_head_init(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue); pMgmt->sNodeDBTable[*puNodeIndex].byAuthSequence = 0; pMgmt->sNodeDBTable[*puNodeIndex].wEnQueueCnt = 0; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create node index = %d\n", ii); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create node index = %d\n", ii); return; }; @@ -982,7 +938,7 @@ BSSvUpdateAPNode( #endif // Auto rate fallback function initiation. // RATEbInit(pDevice); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pMgmt->sNodeDBTable[0].wTxDataRate = %d \n", pMgmt->sNodeDBTable[0].wTxDataRate); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pMgmt->sNodeDBTable[0].wTxDataRate = %d \n", pMgmt->sNodeDBTable[0].wTxDataRate); }; @@ -1067,7 +1023,7 @@ BSSvSecondCallBack( UINT uSleepySTACnt = 0; UINT uNonShortSlotSTACnt = 0; UINT uLongPreambleSTACnt = 0; -viawget_wpa_header* wpahdr; + viawget_wpa_header* wpahdr; //DavidWang spin_lock_irq(&pDevice->lock); @@ -1078,14 +1034,14 @@ viawget_wpa_header* wpahdr; //2008-4-14 <add> by chester for led issue #ifdef FOR_LED_ON_NOTEBOOK MACvGPIOIn(pDevice->PortOffset, &pDevice->byGPIO); -if (((BITbIsBitOff(pDevice->byGPIO,GPIO0_DATA)&&(pDevice->bHWRadioOff == FALSE))||(BITbIsBitOn(pDevice->byGPIO,GPIO0_DATA)&&(pDevice->bHWRadioOff == TRUE)))&&(cc==FALSE)){ +if ((( !(pDevice->byGPIO & GPIO0_DATA)&&(pDevice->bHWRadioOff == FALSE))||((pDevice->byGPIO & GPIO0_DATA)&&(pDevice->bHWRadioOff == TRUE)))&&(cc==FALSE)){ cc=TRUE; } else if(cc==TRUE){ if(pDevice->bHWRadioOff == TRUE){ - if (BITbIsBitOff(pDevice->byGPIO,GPIO0_DATA)) -//||(BITbIsBitOff(pDevice->byGPIO,GPIO0_DATA) && BITbIsBitOn(pDevice->byRadioCtl, EEP_RADIOCTL_INV))) + if ( !(pDevice->byGPIO & GPIO0_DATA)) +//||( !(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV))) {if(status==1) goto start; status=1; CARDbRadioPowerOff(pDevice); @@ -1096,15 +1052,15 @@ CARDbRadioPowerOff(pDevice); pDevice->bLinkPass = FALSE; } - if (BITbIsBitOn(pDevice->byGPIO,GPIO0_DATA)) -//||(BITbIsBitOff(pDevice->byGPIO,GPIO0_DATA) && BITbIsBitOn(pDevice->byRadioCtl, EEP_RADIOCTL_INV))) + if (pDevice->byGPIO &GPIO0_DATA) +//||( !(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV))) {if(status==2) goto start; status=2; CARDbRadioPowerOn(pDevice); } } else{ - if (BITbIsBitOn(pDevice->byGPIO,GPIO0_DATA)) -//||(BITbIsBitOff(pDevice->byGPIO,GPIO0_DATA) && BITbIsBitOn(pDevice->byRadioCtl, EEP_RADIOCTL_INV))) + if (pDevice->byGPIO & GPIO0_DATA) +//||( !(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV))) {if(status==3) goto start; status=3; CARDbRadioPowerOff(pDevice); @@ -1115,8 +1071,8 @@ CARDbRadioPowerOff(pDevice); pDevice->bLinkPass = FALSE; } - if (BITbIsBitOff(pDevice->byGPIO,GPIO0_DATA)) -//||(BITbIsBitOff(pDevice->byGPIO,GPIO0_DATA) && BITbIsBitOn(pDevice->byRadioCtl, EEP_RADIOCTL_INV))) + if ( !(pDevice->byGPIO & GPIO0_DATA)) +//||( !(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV))) {if(status==4) goto start; status=4; CARDbRadioPowerOn(pDevice); @@ -1145,7 +1101,7 @@ start: union iwreq_data wrqu; memset(&wrqu, 0, sizeof (wrqu)); wrqu.ap_addr.sa_family = ARPHRD_ETHER; - printk("wireless_send_event--->SIOCGIWAP(disassociated)\n"); + PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n"); wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); } #endif @@ -1161,14 +1117,13 @@ start: for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) { if (pMgmt->sNodeDBTable[ii].bActive) { - // Increase in-activity counter pMgmt->sNodeDBTable[ii].uInActiveCount++; if (ii > 0) { if (pMgmt->sNodeDBTable[ii].uInActiveCount > MAX_INACTIVE_COUNT) { BSSvRemoveOneNode(pDevice, ii); - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Inactive timeout [%d] sec, STA index = [%d] remove\n", MAX_INACTIVE_COUNT, ii); continue; } @@ -1200,7 +1155,6 @@ start: } // Rate fallback check - if (!pDevice->bFixRate) { /* if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (ii == 0)) @@ -1227,11 +1181,11 @@ start: // check if pending PS queue if (pMgmt->sNodeDBTable[ii].wEnQueueCnt != 0) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index= %d, Queue = %d pending \n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index= %d, Queue = %d pending \n", ii, pMgmt->sNodeDBTable[ii].wEnQueueCnt); if ((ii >0) && (pMgmt->sNodeDBTable[ii].wEnQueueCnt > 15)) { BSSvRemoveOneNode(pDevice, ii); - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Pending many queues PS STA Index = %d remove \n", ii); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Pending many queues PS STA Index = %d remove \n", ii); continue; } } @@ -1300,26 +1254,27 @@ start: pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; pCurrSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; -//printk("pCurrSSID=%s\n",pCurrSSID->abySSID); + if ((pMgmt->eCurrMode == WMAC_MODE_STANDBY) || (pMgmt->eCurrMode == WMAC_MODE_ESS_STA)) { if (pMgmt->sNodeDBTable[0].bActive) { // Assoc with BSS - // DEVICE_PRT(MSG_LEVEL_INFO, KERN_INFO "Callback inactive Count = [%d]\n", pMgmt->sNodeDBTable[0].uInActiveCount); + // DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Callback inactive Count = [%d]\n", pMgmt->sNodeDBTable[0].uInActiveCount); //if (pDevice->bUpdateBBVGA) { // s_vCheckSensitivity((HANDLE) pDevice); //} + if (pDevice->bUpdateBBVGA) { // s_vCheckSensitivity((HANDLE) pDevice); s_vCheckPreEDThreshold((HANDLE)pDevice); } + if ((pMgmt->sNodeDBTable[0].uInActiveCount >= (LOST_BEACON_COUNT/2)) && (pDevice->byBBVGACurrent != pDevice->abyBBVGA[0]) ) { pDevice->byBBVGANew = pDevice->abyBBVGA[0]; bScheduleCommand((HANDLE) pDevice, WLAN_CMD_CHANGE_BBSENSITIVITY, NULL); } - if (pMgmt->sNodeDBTable[0].uInActiveCount >= LOST_BEACON_COUNT) { pMgmt->sNodeDBTable[0].bActive = FALSE; pMgmt->eCurrMode = WMAC_MODE_STANDBY; @@ -1327,7 +1282,7 @@ start: netif_stop_queue(pDevice->dev); pDevice->bLinkPass = FALSE; pDevice->bRoaming = TRUE; - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost AP beacon [%d] sec, disconnected !\n", pMgmt->sNodeDBTable[0].uInActiveCount); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost AP beacon [%d] sec, disconnected !\n", pMgmt->sNodeDBTable[0].uInActiveCount); if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) { wpahdr = (viawget_wpa_header *)pDevice->skb->data; wpahdr->type = VIAWGET_DISASSOC_MSG; @@ -1335,7 +1290,7 @@ start: 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)); @@ -1348,29 +1303,29 @@ start: union iwreq_data wrqu; memset(&wrqu, 0, sizeof (wrqu)); wrqu.ap_addr.sa_family = ARPHRD_ETHER; - printk("wireless_send_event--->SIOCGIWAP(disassociated)\n"); + PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n"); wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); } #endif - } + } } else if (pItemSSID->len != 0) { if (pDevice->uAutoReConnectTime < 10) { pDevice->uAutoReConnectTime++; - #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT + #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT //network manager support need not do Roaming scan??? if(pDevice->bWPASuppWextEnabled ==TRUE) pDevice->uAutoReConnectTime = 0; #endif - } else { - //mike use old encryption status for wpa reauthen + //mike use old encryption status for wpa reauthen if(pDevice->bWPADEVUp) pDevice->eEncryptionStatus = pDevice->eOldEncryptionStatus; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Roaming ...\n"); + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Roaming ...\n"); BSSvClearBSSList((HANDLE)pDevice, pDevice->bLinkPass); - pMgmt->eScanType = WMAC_SCAN_ACTIVE; + pMgmt->eScanType = WMAC_SCAN_ACTIVE; bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); bScheduleCommand((HANDLE) pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID); pDevice->uAutoReConnectTime = 0; @@ -1385,20 +1340,21 @@ start: pDevice->uAutoReConnectTime++; } else { - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Adhoc re-scaning ...\n"); - pMgmt->eScanType = WMAC_SCAN_ACTIVE; + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Adhoc re-scaning ...\n"); + pMgmt->eScanType = WMAC_SCAN_ACTIVE; bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, NULL); bScheduleCommand((HANDLE) pDevice, WLAN_CMD_SSID, NULL); pDevice->uAutoReConnectTime = 0; }; } if (pMgmt->eCurrState == WMAC_STATE_JOINTED) { + if (pDevice->bUpdateBBVGA) { //s_vCheckSensitivity((HANDLE) pDevice); s_vCheckPreEDThreshold((HANDLE)pDevice); } if (pMgmt->sNodeDBTable[0].uInActiveCount >=ADHOC_LOST_BEACON_COUNT) { - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost other STA beacon [%d] sec, started !\n", pMgmt->sNodeDBTable[0].uInActiveCount); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost other STA beacon [%d] sec, started !\n", pMgmt->sNodeDBTable[0].uInActiveCount); pMgmt->sNodeDBTable[0].uInActiveCount = 0; pMgmt->eCurrState = WMAC_STATE_STARTED; netif_stop_queue(pDevice->dev); @@ -1474,7 +1430,7 @@ BSSvUpdateNodeTxCounter( ////#endif // Only Unicast using support rates if (pTxBufHead->wFIFOCtl & FIFOCTL_NEEDACK) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wRate %04X, byTsr0 %02X, byTsr1 %02X\n", wRate, byTsr0, byTsr1); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wRate %04X, byTsr0 %02X, byTsr1 %02X\n", wRate, byTsr0, byTsr1); if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) { pMgmt->sNodeDBTable[0].uTxAttempts += 1; if ((byTsr1 & TSR1_TERR) == 0) { @@ -1600,6 +1556,7 @@ BSSvUpdateNodeTxCounter( return; + } @@ -1641,7 +1598,7 @@ BSSvClearNodeDBTable( // check if sTxPSQueue has been initial if (pMgmt->sNodeDBTable[ii].sTxPSQueue.next != NULL) { while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) != NULL){ - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PS skb != NULL %d\n", ii); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PS skb != NULL %d\n", ii); dev_kfree_skb(skb); } } @@ -1683,7 +1640,7 @@ VOID s_vCheckSensitivity( if (uNumofdBm > 0) { LocalldBmAverage = LocalldBmAverage/uNumofdBm; for (ii=0;ii<BB_VGA_LEVEL;ii++) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"LocalldBmAverage:%ld, %ld %02x\n", LocalldBmAverage, pDevice->ldBmThreshold[ii], pDevice->abyBBVGA[ii]); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"LocalldBmAverage:%ld, %ld %02x\n", LocalldBmAverage, pDevice->ldBmThreshold[ii], pDevice->abyBBVGA[ii]); if (LocalldBmAverage < pDevice->ldBmThreshold[ii]) { pDevice->byBBVGANew = pDevice->abyBBVGA[ii]; break; @@ -1784,3 +1741,4 @@ VOID s_vCheckPreEDThreshold( } return; } + diff --git a/drivers/staging/vt6655/bssdb.h b/drivers/staging/vt6655/bssdb.h index d35616d..5ce4ef9 100644 --- a/drivers/staging/vt6655/bssdb.h +++ b/drivers/staging/vt6655/bssdb.h @@ -30,21 +30,10 @@ #ifndef __BSSDB_H__ #define __BSSDB_H__ -//#if !defined(__DEVICE_H__) -//#include "device.h" -//#endif #include <linux/skbuff.h> -#if !defined(__80211HDR_H__) #include "80211hdr.h" -#endif -#if !defined(__80211MGR_H__) #include "80211mgr.h" -#endif -#if !defined(__CARD_H__) #include "card.h" -#endif - - /*--------------------- Export Definitions -------------------------*/ @@ -103,13 +92,13 @@ typedef enum _NDIS_802_11_NETWORK_TYPE typedef struct tagSERPObject { BOOL bERPExist; BYTE byERP; -} ERPObject, DEF* PERPObject; +}ERPObject, *PERPObject; typedef struct tagSRSNCapObject { BOOL bRSNCapExist; WORD wRSNCap; -} SRSNCapObject, DEF* PSRSNCapObject; +}SRSNCapObject, *PSRSNCapObject; // BSS info(AP) #pragma pack(1) @@ -126,11 +115,12 @@ typedef struct tagKnownBSS { WORD wCapInfo; BYTE abySSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; BYTE byRxRate; + // WORD wATIMWindow; BYTE byRSSIStatCnt; LONG ldBmMAX; LONG ldBmAverage[RSSI_STAT_COUNT]; - LONG ldBmAverRange; + LONG ldBmAverRange; //For any BSSID selection improvment BOOL bSelected; @@ -174,7 +164,7 @@ typedef struct tagKnownBSS { BYTE abyIEs[1024]; // don't move this field !! }__attribute__ ((__packed__)) -KnownBSS , DEF* PKnownBSS; +KnownBSS , *PKnownBSS; //2006-1116-01,<Add> by NomadZhao #pragma pack() @@ -245,7 +235,7 @@ typedef struct tagKnownNodeDB { UINT uTxFail[MAX_RATE+1]; UINT uTimeCount; -} KnownNodeDB, DEF* PKnownNodeDB; +} KnownNodeDB, *PKnownNodeDB; /*--------------------- Export Functions --------------------------*/ @@ -345,6 +335,7 @@ BSSvSecondCallBack( IN HANDLE hDeviceContext ); + VOID BSSvUpdateNodeTxCounter( IN HANDLE hDeviceContext, diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c index 723f44e..db78614 100644 --- a/drivers/staging/vt6655/card.c +++ b/drivers/staging/vt6655/card.c @@ -45,47 +45,17 @@ * */ -#if !defined(__TMACRO_H__) #include "tmacro.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(__DESC_H__) #include "desc.h" -#endif -#if !defined(__RF_H__) #include "rf.h" -#endif -#if !defined(__VNTWIFI_H__) #include "vntwifi.h" -#endif -#if !defined(__POWER_H__) #include "power.h" -#endif -#if !defined(__KEY_H__) #include "key.h" -#endif -#if !defined(__RC4_H__) #include "rc4.h" -#endif -#if !defined(__COUNTRY_H__) #include "country.h" -#endif -#if !defined(__UMEM_H__) -#include "umem.h" -#endif - - /*--------------------- Static Definitions -------------------------*/ @@ -115,7 +85,7 @@ typedef struct tagSChannelTblElement { UINT uFrequency; BOOL bValid; BYTE byMAP; -}SChannelTblElement, DEF* PSChannelTblElement; +}SChannelTblElement, *PSChannelTblElement; //1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M static BYTE abyDefaultSuppRatesG[] = {WLAN_EID_SUPP_RATES, 8, 0x02, 0x04, 0x0B, 0x16, 0x24, 0x30, 0x48, 0x6C}; @@ -837,7 +807,7 @@ BOOL CARDbSetChannel (PVOID pDeviceHandler, UINT uConnectionChannel) RFvWriteWakeProgSyn(pDevice->PortOffset, pDevice->byRFType, uConnectionChannel); - //DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CARDbSetMediaChannel: %d\n", (BYTE)uConnectionChannel); + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CARDbSetMediaChannel: %d\n", (BYTE)uConnectionChannel); BBvSoftwareReset(pDevice->PortOffset); if (pDevice->byLocalID > REV_ID_VT3253_B1) { @@ -1332,7 +1302,7 @@ BOOL CARDbSetBSSID(PVOID pDeviceHandler, PBYTE pbyBSSID, CARD_OP_MODE eOPMode) PSDevice pDevice = (PSDevice) pDeviceHandler; MACvWriteBSSIDAddress(pDevice->PortOffset, pbyBSSID); - MEMvCopy(pDevice->abyBSSID, pbyBSSID, WLAN_BSSID_LEN); + memcpy(pDevice->abyBSSID, pbyBSSID, WLAN_BSSID_LEN); if (eOPMode == OP_MODE_ADHOC) { MACvRegBitsOn(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_ADHOC); } else { @@ -1347,14 +1317,14 @@ BOOL CARDbSetBSSID(PVOID pDeviceHandler, PBYTE pbyBSSID, CARD_OP_MODE eOPMode) MACvRegBitsOff(pDevice->PortOffset, MAC_REG_RCR, RCR_BSSID); pDevice->bBSSIDFilter = FALSE; pDevice->byRxMode &= ~RCR_BSSID; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wcmd: rx_mode = %x\n", pDevice->byRxMode ); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wcmd: rx_mode = %x\n", pDevice->byRxMode ); } else { if (IS_NULL_ADDRESS(pDevice->abyBSSID) == FALSE) { MACvRegBitsOn(pDevice->PortOffset, MAC_REG_RCR, RCR_BSSID); pDevice->bBSSIDFilter = TRUE; pDevice->byRxMode |= RCR_BSSID; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: rx_mode = %x\n", pDevice->byRxMode ); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: rx_mode = %x\n", pDevice->byRxMode ); } // Adopt BSS state in Adapter Device Object pDevice->eOPMode = eOPMode; @@ -1444,7 +1414,7 @@ CARDbPowerDown( } MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_GO2DOZE); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Go to Doze ZZZZZZZZZZZZZZZ\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Go to Doze ZZZZZZZZZZZZZZZ\n"); return TRUE; } @@ -1590,23 +1560,23 @@ CARDbAdd_PMKID_Candidate ( PPMKID_CANDIDATE pCandidateList; UINT ii = 0; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"bAdd_PMKID_Candidate START: (%d)\n", (int)pDevice->gsPMKIDCandidate.NumCandidates); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"bAdd_PMKID_Candidate START: (%d)\n", (int)pDevice->gsPMKIDCandidate.NumCandidates); if (pDevice->gsPMKIDCandidate.NumCandidates >= MAX_PMKIDLIST) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"vFlush_PMKID_Candidate: 3\n"); - ZERO_MEMORY(&pDevice->gsPMKIDCandidate, sizeof(SPMKIDCandidateEvent)); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"vFlush_PMKID_Candidate: 3\n"); + memset(&pDevice->gsPMKIDCandidate, 0, sizeof(SPMKIDCandidateEvent)); } for (ii = 0; ii < 6; ii++) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02X ", *(pbyBSSID + ii)); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02X ", *(pbyBSSID + ii)); } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); // Update Old Candidate for (ii = 0; ii < pDevice->gsPMKIDCandidate.NumCandidates; ii++) { pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[ii]; - if (MEMEqualMemory(pCandidateList->BSSID, pbyBSSID, U_ETHER_ADDR_LEN)) { + if ( !memcmp(pCandidateList->BSSID, pbyBSSID, U_ETHER_ADDR_LEN)) { if ((bRSNCapExist == TRUE) && (wRSNCap & BIT0)) { pCandidateList->Flags |= NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED; } else { @@ -1623,9 +1593,9 @@ CARDbAdd_PMKID_Candidate ( } else { pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED); } - MEMvCopy(pCandidateList->BSSID, pbyBSSID, U_ETHER_ADDR_LEN); + memcpy(pCandidateList->BSSID, pbyBSSID, U_ETHER_ADDR_LEN); pDevice->gsPMKIDCandidate.NumCandidates++; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"NumCandidates:%d\n", (int)pDevice->gsPMKIDCandidate.NumCandidates); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"NumCandidates:%d\n", (int)pDevice->gsPMKIDCandidate.NumCandidates); return TRUE; } @@ -1709,7 +1679,7 @@ VOID CARDvInitChannelTable (PVOID pDeviceHandler) } } } - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO"Zone=[%d][%c][%c]!!\n",pDevice->byZoneType,ChannelRuleTab[pDevice->byZoneType].chCountryCode[0],ChannelRuleTab[pDevice->byZoneType].chCountryCode[1]); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO"Zone=[%d][%c][%c]!!\n",pDevice->byZoneType,ChannelRuleTab[pDevice->byZoneType].chCountryCode[0],ChannelRuleTab[pDevice->byZoneType].chCountryCode[1]); for(ii=0;ii<CARD_MAX_CHANNEL_TBL;ii++) { if (pDevice->abyRegPwr[ii+1] == 0) { pDevice->abyRegPwr[ii+1] = pDevice->abyOFDMDefaultPwr[ii+1]; @@ -2304,7 +2274,7 @@ CARDbChannelGetList ( if (uCountryCodeIdx >= CCODE_MAX) { return (FALSE); } - MEMvCopy(pbyChannelTable, ChannelRuleTab[uCountryCodeIdx].bChannelIdxList, CB_MAX_CHANNEL); + memcpy(pbyChannelTable, ChannelRuleTab[uCountryCodeIdx].bChannelIdxList, CB_MAX_CHANNEL); return (TRUE); } @@ -2403,7 +2373,7 @@ CARDbyAutoChannelSelect( } if (sChannelTbl[ii].byMAP == 0) { return ((BYTE) ii); - } else if (BITbIsBitOff(sChannelTbl[ii].byMAP, 0x08)) { + } else if ( !(sChannelTbl[ii].byMAP & 0x08)) { byOptionChannel = (BYTE) ii; } } @@ -2414,7 +2384,7 @@ CARDbyAutoChannelSelect( if (sChannelTbl[ii].bValid == TRUE) { if (sChannelTbl[ii].byMAP == 0) { aiWeight[ii] += 100; - } else if (BITbIsBitOn(sChannelTbl[ii].byMAP, 0x01)) { + } else if (sChannelTbl[ii].byMAP & 0x01) { if (ii > 3) { aiWeight[ii-3] -= 10; } @@ -2599,22 +2569,22 @@ WORD CARDwGetOFDMControlRate (PVOID pDeviceHandler, WORD wRateIdx) PSDevice pDevice = (PSDevice) pDeviceHandler; UINT ui = (UINT)wRateIdx; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BASIC RATE: %X\n", pDevice->wBasicRate); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BASIC RATE: %X\n", pDevice->wBasicRate); if (!CARDbIsOFDMinBasicRate((PVOID)pDevice)) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CARDwGetOFDMControlRate:(NO OFDM) %d\n", wRateIdx); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CARDwGetOFDMControlRate:(NO OFDM) %d\n", wRateIdx); if (wRateIdx > RATE_24M) wRateIdx = RATE_24M; return wRateIdx; } while (ui > RATE_11M) { if (pDevice->wBasicRate & ((WORD)1 << ui)) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CARDwGetOFDMControlRate : %d\n", ui); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CARDwGetOFDMControlRate : %d\n", ui); return (WORD)ui; } ui --; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CARDwGetOFDMControlRate: 6M\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CARDwGetOFDMControlRate: 6M\n"); return (WORD)RATE_24M; } @@ -3002,7 +2972,7 @@ BOOL CARDbGetCurrentTSF (DWORD_PTR dwIoBase, PQWORD pqwCurrTSF) MACvRegBitsOn(dwIoBase, MAC_REG_TFTCTL, TFTCTL_TSFCNTRRD); for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortB(dwIoBase + MAC_REG_TFTCTL, &byData); - if (BITbIsBitOff(byData, TFTCTL_TSFCNTRRD)) + if ( !(byData & TFTCTL_TSFCNTRRD)) break; } if (ww == W_MAX_TIMEOUT) @@ -3085,7 +3055,7 @@ void CARDvSetFirstNextTBTT (DWORD_PTR dwIoBase, WORD wBeaconInterval) VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT, LODWORD(qwNextTBTT)); VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT + 4, HIDWORD(qwNextTBTT)); MACvRegBitsOn(dwIoBase, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN); - //DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Card:First Next TBTT[%8xh:%8xh] \n", HIDWORD(qwNextTBTT), LODWORD(qwNextTBTT)); + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Card:First Next TBTT[%8xh:%8xh] \n", HIDWORD(qwNextTBTT), LODWORD(qwNextTBTT)); return; } @@ -3113,7 +3083,7 @@ void CARDvUpdateNextTBTT (DWORD_PTR dwIoBase, QWORD qwTSF, WORD wBeaconInterval) VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT, LODWORD(qwTSF)); VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT + 4, HIDWORD(qwTSF)); MACvRegBitsOn(dwIoBase, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Card:Update Next TBTT[%8xh:%8xh] \n",(UINT)HIDWORD(qwTSF), (UINT)LODWORD(qwTSF)); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Card:Update Next TBTT[%8xh:%8xh] \n",(UINT)HIDWORD(qwTSF), (UINT)LODWORD(qwTSF)); return; } diff --git a/drivers/staging/vt6655/card.h b/drivers/staging/vt6655/card.h index bb292e1..264b844 100644 --- a/drivers/staging/vt6655/card.h +++ b/drivers/staging/vt6655/card.h @@ -26,19 +26,10 @@ * */ - #ifndef __CARD_H__ #define __CARD_H__ -//#if !defined(__DEVICE_H__) -//#include "device.h" -//#endif -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif - - - /*--------------------- Export Definitions -------------------------*/ // @@ -94,9 +85,6 @@ typedef enum _CARD_OP_MODE { /*--------------------- Export Variables --------------------------*/ /*--------------------- Export Functions --------------------------*/ -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ BOOL ChannelValid(UINT CountryCode, UINT ChannelIndex); void CARDvSetRSPINF(PVOID pDeviceHandler, CARD_PHY_TYPE ePHYType); @@ -262,11 +250,6 @@ CARDbyAutoChannelSelect( BYTE CARDbyGetChannelNumber(PVOID pDeviceHandler, BYTE byChannelIndex); -#ifdef __cplusplus -} /* End of extern "C" { */ -#endif /* __cplusplus */ - - #endif // __CARD_H__ diff --git a/drivers/staging/vt6655/country.h b/drivers/staging/vt6655/country.h index 65d1e52..2005d27 100644 --- a/drivers/staging/vt6655/country.h +++ b/drivers/staging/vt6655/country.h @@ -30,10 +30,7 @@ #ifndef __COUNTRY_H__ #define __COUNTRY_H__ -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif - /*--------------------- Export Definitions -------------------------*/ /************************************************************************ @@ -168,7 +165,7 @@ typedef struct tagSCountryTable CHAR chCountryCode[2]; BYTE bChannelIdxList[CB_MAX_CHANNEL]; /* Available channels Index */ BYTE byPower[CB_MAX_CHANNEL]; -} SCountryTable, DEF* PSCountryTable; +} SCountryTable, *PSCountryTable; /*--------------------- Export Classes ----------------------------*/ @@ -176,17 +173,5 @@ typedef struct tagSCountryTable extern SCountryTable ChannelRuleTab[CCODE_MAX+1]; /*--------------------- Export Functions --------------------------*/ -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ - - -#ifdef __cplusplus -} /* End of extern "C" { */ -#endif /* __cplusplus */ - -/************************************************************************ - * Function prototype - ************************************************************************/ #endif /* __COUNTRY_H__ */ diff --git a/drivers/staging/vt6655/datarate.c b/drivers/staging/vt6655/datarate.c index f58f963..10da57f 100644 --- a/drivers/staging/vt6655/datarate.c +++ b/drivers/staging/vt6655/datarate.c @@ -33,33 +33,15 @@ * */ -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif -#if !defined(__TMACRO_H__) #include "tmacro.h" -#endif -#if !defined(__MAC_H__) #include "mac.h" -#endif -#if !defined(__80211MGR_H__) #include "80211mgr.h" -#endif -#if !defined(__BSSDB_H__) #include "bssdb.h" -#endif -#if !defined(__DATARATE_H__) #include "datarate.h" -#endif -#if !defined(__CARD_H__) #include "card.h" -#endif -#if !defined(__BASEBAND_H__) #include "baseband.h" -#endif -#if !defined(__SROM_H__) #include "srom.h" -#endif /*--------------------- Static Definitions -------------------------*/ @@ -239,7 +221,7 @@ UINT uRateLen; *pwSuppRate = 0; uRateLen = pItemRates->len; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ParseMaxRate Len: %d\n", uRateLen); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ParseMaxRate Len: %d\n", uRateLen); if (pDevice->eCurrentPHYType != PHY_TYPE_11B) { if (uRateLen > WLAN_RATES_MAXLEN) uRateLen = WLAN_RATES_MAXLEN; @@ -254,7 +236,7 @@ UINT uRateLen; (bUpdateBasicRate == TRUE)) { // Add to basic rate set, update pDevice->byTopCCKBasicRate and pDevice->byTopOFDMBasicRate CARDbAddBasicRate((PVOID)pDevice, wGetRateIdx(byRate)); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ParseMaxRate AddBasicRate: %d\n", wGetRateIdx(byRate)); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ParseMaxRate AddBasicRate: %d\n", wGetRateIdx(byRate)); } byRate = (BYTE)(pItemRates->abyRates[ii]&0x7F); if (byHighSuppRate == 0) @@ -277,7 +259,7 @@ UINT uRateLen; if (WLAN_MGMT_IS_BASICRATE(pItemExtRates->abyRates[ii])) { // Add to basic rate set, update pDevice->byTopCCKBasicRate and pDevice->byTopOFDMBasicRate CARDbAddBasicRate((PVOID)pDevice, wGetRateIdx(byRate)); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ParseMaxRate AddBasicRate: %d\n", wGetRateIdx(byRate)); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ParseMaxRate AddBasicRate: %d\n", wGetRateIdx(byRate)); } byRate = (BYTE)(pItemExtRates->abyRates[ii]&0x7F); if (byHighSuppRate == 0) @@ -303,7 +285,7 @@ UINT uRateLen; if (wOldBasicRate != pDevice->wBasicRate) CARDvSetRSPINF((PVOID)pDevice, pDevice->eCurrentPHYType); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Exit ParseMaxRate\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Exit ParseMaxRate\n"); } diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h index c0fc1d3..b573ef7 100644 --- a/drivers/staging/vt6655/desc.h +++ b/drivers/staging/vt6655/desc.h @@ -28,26 +28,13 @@ * */ - #ifndef __DESC_H__ #define __DESC_H__ #include <linux/types.h> #include <linux/mm.h> - -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif -#if !defined(__TETHER_H__) #include "tether.h" -#endif -// #ifdef PRIVATE_OBJ -//#if !defined(__DEVICE_MODULE_H) -//#include "device_module.h" -//#endif - - - /*--------------------- Export Definitions -------------------------*/ @@ -135,6 +122,7 @@ #define CB_PROTOCOL_RESERVED_SECTION 16 + // if retrys excess 15 times , tx will abort, and // if tx fifo underflow, tx will fail // we should try to resend it @@ -237,9 +225,6 @@ typedef struct tagDEVICE_RD_INFO { struct sk_buff* skb; -#ifdef PRIVATE_OBJ - ref_sk_buff ref_skb; -#endif dma_addr_t skb_dma; dma_addr_t curr_desc; } DEVICE_RD_INFO, *PDEVICE_RD_INFO; @@ -311,8 +296,8 @@ typedef struct tagSRxDesc { volatile PDEVICE_RD_INFO pRDInfo;//4 bytes volatile U32 Reserved[2];//8 bytes } __attribute__ ((__packed__)) -SRxDesc, DEF* PSRxDesc; -typedef const SRxDesc DEF* PCSRxDesc; +SRxDesc, *PSRxDesc; +typedef const SRxDesc *PCSRxDesc; #ifdef __BIG_ENDIAN @@ -397,8 +382,8 @@ typedef struct tagSTxDesc { volatile PDEVICE_TD_INFO pTDInfo;//4 bytes volatile U32 Reserved[2];//8 bytes } __attribute__ ((__packed__)) -STxDesc, DEF* PSTxDesc; -typedef const STxDesc DEF* PCSTxDesc; +STxDesc, *PSTxDesc; +typedef const STxDesc *PCSTxDesc; typedef struct tagSTxSyncDesc { @@ -412,8 +397,8 @@ typedef struct tagSTxSyncDesc { volatile PDEVICE_TD_INFO pTDInfo;//4 bytes volatile DWORD m_dwReserved2; } __attribute__ ((__packed__)) -STxSyncDesc, DEF* PSTxSyncDesc; -typedef const STxSyncDesc DEF* PCSTxSyncDesc; +STxSyncDesc, *PSTxSyncDesc; +typedef const STxSyncDesc *PCSTxSyncDesc; // @@ -427,8 +412,8 @@ typedef struct tagSRrvTime_gRTS { WORD wTxRrvTime_b; WORD wTxRrvTime_a; }__attribute__ ((__packed__)) -SRrvTime_gRTS, DEF* PSRrvTime_gRTS; -typedef const SRrvTime_gRTS DEF* PCSRrvTime_gRTS; +SRrvTime_gRTS, *PSRrvTime_gRTS; +typedef const SRrvTime_gRTS *PCSRrvTime_gRTS; typedef struct tagSRrvTime_gCTS { WORD wCTSTxRrvTime_ba; @@ -436,22 +421,22 @@ typedef struct tagSRrvTime_gCTS { WORD wTxRrvTime_b; WORD wTxRrvTime_a; }__attribute__ ((__packed__)) -SRrvTime_gCTS, DEF* PSRrvTime_gCTS; -typedef const SRrvTime_gCTS DEF* PCSRrvTime_gCTS; +SRrvTime_gCTS, *PSRrvTime_gCTS; +typedef const SRrvTime_gCTS *PCSRrvTime_gCTS; typedef struct tagSRrvTime_ab { WORD wRTSTxRrvTime; WORD wTxRrvTime; }__attribute__ ((__packed__)) -SRrvTime_ab, DEF* PSRrvTime_ab; -typedef const SRrvTime_ab DEF* PCSRrvTime_ab; +SRrvTime_ab, *PSRrvTime_ab; +typedef const SRrvTime_ab *PCSRrvTime_ab; typedef struct tagSRrvTime_atim { WORD wCTSTxRrvTime_ba; WORD wTxRrvTime_a; }__attribute__ ((__packed__)) -SRrvTime_atim, DEF* PSRrvTime_atim; -typedef const SRrvTime_atim DEF* PCSRrvTime_atim; +SRrvTime_atim, *PSRrvTime_atim; +typedef const SRrvTime_atim *PCSRrvTime_atim; // // RTS buffer header @@ -462,8 +447,8 @@ typedef struct tagSRTSData { BYTE abyRA[U_ETHER_ADDR_LEN]; BYTE abyTA[U_ETHER_ADDR_LEN]; }__attribute__ ((__packed__)) -SRTSData, DEF* PSRTSData; -typedef const SRTSData DEF* PCSRTSData; +SRTSData, *PSRTSData; +typedef const SRTSData *PCSRTSData; typedef struct tagSRTS_g { BYTE bySignalField_b; @@ -478,8 +463,8 @@ typedef struct tagSRTS_g { WORD wReserved; SRTSData Data; }__attribute__ ((__packed__)) -SRTS_g, DEF* PSRTS_g; -typedef const SRTS_g DEF* PCSRTS_g; +SRTS_g, *PSRTS_g; +typedef const SRTS_g *PCSRTS_g; typedef struct tagSRTS_g_FB { @@ -499,8 +484,8 @@ typedef struct tagSRTS_g_FB { WORD wRTSDuration_aa_f1; SRTSData Data; }__attribute__ ((__packed__)) -SRTS_g_FB, DEF* PSRTS_g_FB; -typedef const SRTS_g_FB DEF* PCSRTS_g_FB; +SRTS_g_FB, *PSRTS_g_FB; +typedef const SRTS_g_FB *PCSRTS_g_FB; typedef struct tagSRTS_ab { @@ -511,8 +496,8 @@ typedef struct tagSRTS_ab { WORD wReserved; SRTSData Data; }__attribute__ ((__packed__)) -SRTS_ab, DEF* PSRTS_ab; -typedef const SRTS_ab DEF* PCSRTS_ab; +SRTS_ab, *PSRTS_ab; +typedef const SRTS_ab *PCSRTS_ab; typedef struct tagSRTS_a_FB { @@ -525,8 +510,8 @@ typedef struct tagSRTS_a_FB { WORD wRTSDuration_f1; SRTSData Data; }__attribute__ ((__packed__)) -SRTS_a_FB, DEF* PSRTS_a_FB; -typedef const SRTS_a_FB DEF* PCSRTS_a_FB; +SRTS_a_FB, *PSRTS_a_FB; +typedef const SRTS_a_FB *PCSRTS_a_FB; // @@ -538,7 +523,7 @@ typedef struct tagSCTSData { BYTE abyRA[U_ETHER_ADDR_LEN]; WORD wReserved; }__attribute__ ((__packed__)) -SCTSData, DEF* PSCTSData; +SCTSData, *PSCTSData; typedef struct tagSCTS { BYTE bySignalField_b; @@ -548,8 +533,8 @@ typedef struct tagSCTS { WORD wReserved; SCTSData Data; }__attribute__ ((__packed__)) -SCTS, DEF* PSCTS; -typedef const SCTS DEF* PCSCTS; +SCTS, *PSCTS; +typedef const SCTS *PCSCTS; typedef struct tagSCTS_FB { BYTE bySignalField_b; @@ -561,8 +546,8 @@ typedef struct tagSCTS_FB { WORD wCTSDuration_ba_f1; SCTSData Data; }__attribute__ ((__packed__)) -SCTS_FB, DEF* PSCTS_FB; -typedef const SCTS_FB DEF* PCSCTS_FB; +SCTS_FB, *PSCTS_FB; +typedef const SCTS_FB *PCSCTS_FB; // @@ -576,15 +561,15 @@ typedef struct tagSTxBufHead { BYTE byTxPower; BYTE wReserved; }__attribute__ ((__packed__)) -STxBufHead, DEF* PSTxBufHead; -typedef const STxBufHead DEF* PCSTxBufHead; +STxBufHead, *PSTxBufHead; +typedef const STxBufHead *PCSTxBufHead; typedef struct tagSTxShortBufHead { WORD wFIFOCtl; WORD wTimeStamp; }__attribute__ ((__packed__)) -STxShortBufHead, DEF* PSTxShortBufHead; -typedef const STxShortBufHead DEF* PCSTxShortBufHead; +STxShortBufHead, *PSTxShortBufHead; +typedef const STxShortBufHead *PCSTxShortBufHead; // // Tx data header @@ -601,8 +586,8 @@ typedef struct tagSTxDataHead_g { WORD wTimeStampOff_b; WORD wTimeStampOff_a; }__attribute__ ((__packed__)) -STxDataHead_g, DEF* PSTxDataHead_g; -typedef const STxDataHead_g DEF* PCSTxDataHead_g; +STxDataHead_g, *PSTxDataHead_g; +typedef const STxDataHead_g *PCSTxDataHead_g; typedef struct tagSTxDataHead_g_FB { BYTE bySignalField_b; @@ -618,8 +603,8 @@ typedef struct tagSTxDataHead_g_FB { WORD wTimeStampOff_b; WORD wTimeStampOff_a; }__attribute__ ((__packed__)) -STxDataHead_g_FB, DEF* PSTxDataHead_g_FB; -typedef const STxDataHead_g_FB DEF* PCSTxDataHead_g_FB; +STxDataHead_g_FB, *PSTxDataHead_g_FB; +typedef const STxDataHead_g_FB *PCSTxDataHead_g_FB; typedef struct tagSTxDataHead_ab { @@ -629,8 +614,8 @@ typedef struct tagSTxDataHead_ab { WORD wDuration; WORD wTimeStampOff; }__attribute__ ((__packed__)) -STxDataHead_ab, DEF* PSTxDataHead_ab; -typedef const STxDataHead_ab DEF* PCSTxDataHead_ab; +STxDataHead_ab, *PSTxDataHead_ab; +typedef const STxDataHead_ab *PCSTxDataHead_ab; typedef struct tagSTxDataHead_a_FB { @@ -642,8 +627,8 @@ typedef struct tagSTxDataHead_a_FB { WORD wDuration_f0; WORD wDuration_f1; }__attribute__ ((__packed__)) -STxDataHead_a_FB, DEF* PSTxDataHead_a_FB; -typedef const STxDataHead_a_FB DEF* PCSTxDataHead_a_FB; +STxDataHead_a_FB, *PSTxDataHead_a_FB; +typedef const STxDataHead_a_FB *PCSTxDataHead_a_FB; // // MICHDR data header @@ -653,8 +638,8 @@ typedef struct tagSMICHDRHead { DWORD adwHDR1[4]; DWORD adwHDR2[4]; }__attribute__ ((__packed__)) -SMICHDRHead, DEF* PSMICHDRHead; -typedef const SMICHDRHead DEF* PCSMICHDRHead; +SMICHDRHead, *PSMICHDRHead; +typedef const SMICHDRHead *PCSMICHDRHead; typedef struct tagSBEACONCtl { DWORD BufReady : 1; diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h index 264d1bb..fa7f0fc 100644 --- a/drivers/staging/vt6655/device.h +++ b/drivers/staging/vt6655/device.h @@ -29,13 +29,7 @@ #ifndef __DEVICE_H__ #define __DEVICE_H__ -#ifdef MODULE -#ifdef MODVERSIONS -#include <linux/modversions.h> -#endif /* MODVERSIONS */ #include <linux/module.h> -#endif /* MODULE */ - #include <linux/types.h> #include <linux/init.h> #include <linux/mm.h> @@ -70,70 +64,34 @@ #endif /* Include Wireless Extension definition and check version - Jean II */ #include <linux/wireless.h> -#if WIRELESS_EXT > 12 #include <net/iw_handler.h> // New driver API -#endif /* WIRELESS_EXT > 12 */ //2008-0409-07, <Add> by Einsn Liu -#if WIRELESS_EXT > 17 #ifndef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT #define WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT #endif -#endif //2008-4-14<add> by chester for led issue //#define FOR_LED_ON_NOTEBOOK // - -// device specific // -#if !defined(_KCOMPAT_H) -#include "kcompat.h" -#endif +// device specific +// -#if !defined(__DEVICE_CONFIG_H) +#include "kcompat.h" #include "device_cfg.h" -#endif - -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif -#if !defined(__80211HDR_H__) #include "80211hdr.h" -#endif -#if !defined(__TETHER_H__) #include "tether.h" -#endif -#if !defined(__WMGR_H__) #include "wmgr.h" -#endif -#if !defined(__WCMD_H__) #include "wcmd.h" -#endif -#if !defined(__MIB_H__) #include "mib.h" -#endif -#if !defined(__SROM_H__) #include "srom.h" -#endif -#if !defined(__RC4_H__) #include "rc4.h" -#endif -#if !defined(__TPCI_H__) -#include "tpci.h" -#endif -#if !defined(__DESC_H__) #include "desc.h" -#endif - -#if !defined(__KEY_H__) #include "key.h" -#endif - -#if !defined(__MAC_H__) #include "mac.h" -#endif //PLICE_DEBUG-> //#define THREAD @@ -141,11 +99,6 @@ //#define TASK_LET //PLICE_DEBUG<- -// #ifdef PRIVATE_OBJ -//#if !defined(__DEVICE_MODULE_H) -//#include "device_module.h" -//#endif - /*--------------------- Export Definitions -------------------------*/ @@ -198,6 +151,7 @@ #define BB_VGA_CHANGE_THRESHOLD 16 + #ifndef RUN_AT #define RUN_AT(x) (jiffies+(x)) #endif @@ -207,93 +161,6 @@ // BUILD OBJ mode -#ifdef PRIVATE_OBJ - -#undef dev_kfree_skb -#undef dev_kfree_skb_irq -#undef dev_alloc_skb -#undef kfree -#undef del_timer -#undef init_timer -#undef add_timer -#undef kmalloc -#undef netif_stop_queue -#undef netif_start_queue -#undef netif_wake_queue -#undef netif_queue_stopped -#undef netif_rx -#undef netif_running -#undef udelay -#undef mdelay -#undef eth_type_trans -#undef skb_put -#undef HZ -#undef RUN_AT -#undef pci_alloc_consistent -#undef pci_free_consistent -#undef register_netdevice -#undef register_netdev -#undef unregister_netdevice -#undef unregister_netdev -#undef skb_queue_head_init -#undef skb_queue_tail -#undef skb_queue_empty -#undef free_irq -#undef copy_from_user -#undef copy_to_user -#undef spin_lock_init -#undef pci_map_single -#undef pci_unmap_single - -// redefine kernel dependent fucntion -#define dev_kfree_skb ref_dev_kfree_skb -#define dev_kfree_skb_irq ref_dev_kfree_skb_irq -#define dev_alloc_skb ref_dev_alloc_skb -#define kfree ref_kfree -#define del_timer ref_del_timer -#define init_timer ref_init_timer -#define add_timer ref_add_timer -#define kmalloc ref_kmalloc -#define netif_stop_queue ref_netif_stop_queue -#define netif_start_queue ref_netif_start_queue -#define netif_wake_queue ref_netif_wake_queue -#define netif_queue_stopped ref_netif_queue_stopped -#define netif_rx ref_netif_rx -#define netif_running ref_netif_running -#define udelay ref_udelay -#define mdelay ref_mdelay -#define get_jiffies() ref_get_jiffies() -#define RUN_AT(x) (get_jiffies()+(x)) -#define HZ ref_HZ_tick() -#define eth_type_trans ref_eth_type_trans -#define skb_put ref_skb_put -#define skb_queue_head_init ref_skb_queue_head_init -#define skb_queue_tail ref_skb_queue_tail -#define skb_queue_empty ref_skb_queue_empty - -#define pci_alloc_consistent ref_pci_alloc_consistent -#define pci_free_consistent ref_pci_free_consistent -#define register_netdevice ref_register_netdevice -#define register_netdev ref_register_netdev -#define unregister_netdevice ref_unregister_netdevice -#define unregister_netdev ref_unregister_netdev - -#define free_irq ref_free_irq -#define copy_from_user ref_copy_from_user -#define copy_to_user ref_copy_to_user -#define spin_lock_init ref_spin_lock_init -#define pci_map_single ref_pci_map_single -#define pci_unmap_single ref_pci_unmap_single -#endif - - -#ifdef PRIVATE_OBJ -#undef printk -#define DEVICE_PRT(l, p, args...) {if (l<=msglevel) do {} while (0);} -//#define DEVICE_PRT(l, p, args...) {if (l<=msglevel) printk( p ,##args);} -#else -#define DEVICE_PRT(l, p, args...) {if (l<=msglevel) printk( p ,##args);} -#endif #define AVAIL_TD(p,q) ((p)->sOpts.nTxDescs[(q)]-((p)->iTDUsed[(q)])) @@ -304,9 +171,14 @@ +#define PRIVATE_Message 0 + /*--------------------- Export Types ------------------------------*/ +#define DBG_PRT(l, p, args...) {if (l<=msglevel) printk( p ,##args);} +#define PRINT_K(p, args...) {if (PRIVATE_Message) printk( p ,##args);} + //0:11A 1:11B 2:11G typedef enum _VIA_BB_TYPE { @@ -401,8 +273,7 @@ typedef struct tagSPMKIDCandidateEvent { ULONG Version; // Version of the structure ULONG NumCandidates; // No. of pmkid candidates PMKID_CANDIDATE CandidateList[MAX_PMKIDLIST]; -} SPMKIDCandidateEvent, DEF* PSPMKIDCandidateEvent; - +} SPMKIDCandidateEvent, *PSPMKIDCandidateEvent; //-- @@ -414,7 +285,7 @@ typedef struct tagSQuietControl { DWORD dwStartTime; BYTE byPeriod; WORD wDuration; -} SQuietControl, DEF* PSQuietControl; +} SQuietControl, *PSQuietControl; //-- typedef struct __chip_info_tbl{ @@ -438,7 +309,6 @@ typedef struct tagSCacheEntry{ BYTE abyAddr2[U_ETHER_ADDR_LEN]; } SCacheEntry, *PSCacheEntry; - typedef struct tagSCache{ /* The receive cache is updated circularly. The next entry to be written is * indexed by the "InPtr". @@ -456,14 +326,10 @@ typedef struct tagSDeFragControlBlock BYTE abyAddr2[U_ETHER_ADDR_LEN]; UINT uLifetime; struct sk_buff* skb; -#ifdef PRIVATE_OBJ - ref_sk_buff ref_skb; -#endif PBYTE pbyRxBuffer; UINT cbFrameLength; BOOL bInUse; -} SDeFragControlBlock, DEF* PSDeFragControlBlock; - +} SDeFragControlBlock, *PSDeFragControlBlock; @@ -511,11 +377,11 @@ typedef struct _RxManagementQueue typedef struct __device_opt { - int nRxDescs0; //Number of RX descriptors0 - int nRxDescs1; //Number of RX descriptors1 - int nTxDescs[2]; //Number of TX descriptors 0, 1 - int int_works; //interrupt limits - int rts_thresh; //rts threshold + int nRxDescs0; //Number of RX descriptors0 + int nRxDescs1; //Number of RX descriptors1 + int nTxDescs[2]; //Number of TX descriptors 0, 1 + int int_works; //interrupt limits + int rts_thresh; //rts threshold int frag_thresh; int data_rate; int channel_num; @@ -703,8 +569,8 @@ typedef struct __device_info { BYTE byERPFlag; WORD wUseProtectCntDown; - BOOL bRadioControlOff; - BOOL bRadioOff; + BOOL bRadioControlOff; + BOOL bRadioOff; BOOL bEnablePSMode; WORD wListenInterval; BOOL bPWBitOn; @@ -760,6 +626,7 @@ typedef struct __device_info { //2007-0925-01<Add>by MikeLiu //mike add :save old Encryption NDIS_802_11_WEP_STATUS eOldEncryptionStatus; + SKeyManagement sKey; DWORD dwIVCounter; @@ -768,7 +635,6 @@ typedef struct __device_info { RC4Ext SBox; BYTE abyPRNG[WLAN_WEPMAX_KEYLEN+3]; - BYTE byKeyIndex; UINT uKeyLength; BYTE abyKey[WLAN_WEP232_KEYLEN]; @@ -807,6 +673,7 @@ typedef struct __device_info { BYTE byBBPreEDRSSI; BYTE byBBPreEDIndex; + BOOL bRadioCmd; DWORD dwDiagRefCount; @@ -954,9 +821,7 @@ typedef struct __device_info { UINT uChannel; BOOL bMACSuspend; -#ifdef WIRELESS_EXT struct iw_statistics wstats; // wireless stats -#endif /* WIRELESS_EXT */ BOOL bCommit; } DEVICE_INFO, *PSDevice; diff --git a/drivers/staging/vt6655/device_cfg.h b/drivers/staging/vt6655/device_cfg.h index 1cbb444..d1e9c19 100644 --- a/drivers/staging/vt6655/device_cfg.h +++ b/drivers/staging/vt6655/device_cfg.h @@ -1,5 +1,6 @@ /* - * Copyright (c) 1996, 2003 VIA Networking, Inc. All rights reserved. + * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. + * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +16,6 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * * File: device_cfg.h * * Purpose: Driver configuration header @@ -30,46 +30,13 @@ //#include <linux/config.h> #include <linux/types.h> -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif - - - -typedef __u8 UINT8, *PUINT8; -typedef __u16 UINT16, *PUINT16; -typedef __u32 UINT32, *PUINT32; - - -#ifndef VOID -#define VOID void -#endif - -#ifndef CONST -#define CONST const -#endif - -#ifndef STATIC -#define STATIC static -#endif - -#ifndef DEF -#define DEF -#endif - -#ifndef IN -#define IN -#endif - -#ifndef OUT -#define OUT -#endif typedef struct _version { - UINT8 major; - UINT8 minor; - UINT8 build; + unsigned char major; + unsigned char minor; + unsigned char build; } version_t, *pversion_t; #ifndef FALSE @@ -100,6 +67,7 @@ struct _version { #ifndef DEVICE_VERSION #define DEVICE_VERSION "1.19.12" #endif + //config file #include <linux/fs.h> #include <linux/fcntl.h> @@ -111,8 +79,6 @@ struct _version { #define PKT_BUF_SZ 2390 -#define MALLOC(x,y) kmalloc((x),(y)) -#define FREE(x) kfree((x)) #define MAX_UINTS 8 #define OPTION_DEFAULT { [0 ... MAX_UINTS-1] = -1} diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index f43ca41..53450b4 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 diff --git a/drivers/staging/vt6655/dpc.c b/drivers/staging/vt6655/dpc.c index acc6d82..67f238c 100644 --- a/drivers/staging/vt6655/dpc.c +++ b/drivers/staging/vt6655/dpc.c @@ -38,61 +38,22 @@ * */ - -#if !defined(__DEVICE_H__) #include "device.h" -#endif -#if !defined(__RXTX_H__) #include "rxtx.h" -#endif -#if !defined(__TETHER_H__) #include "tether.h" -#endif -#if !defined(__CARD_H__) #include "card.h" -#endif -#if !defined(__BSSDB_H__) #include "bssdb.h" -#endif -#if !defined(__MAC_H__) #include "mac.h" -#endif -#if !defined(__BASEBAND_H__) #include "baseband.h" -#endif -#if !defined(__UMEM_H__) -#include "umem.h" -#endif -#if !defined(__MICHAEL_H__) #include "michael.h" -#endif -#if !defined(__TKIP_H__) #include "tkip.h" -#endif -#if !defined(__TCRC_H__) #include "tcrc.h" -#endif -#if !defined(__WCTL_H__) #include "wctl.h" -#endif -#if !defined(__WROUTE_H__) #include "wroute.h" -#endif -#if !defined(__TBIT_H__) -#include "tbit.h" -#endif -#if !defined(__HOSTAP_H__) #include "hostap.h" -#endif -#if !defined(__RF_H__) #include "rf.h" -#endif -#if !defined(__IOWPA_H__) #include "iowpa.h" -#endif -#if !defined(__AES_H__) #include "aes_ccmp.h" -#endif //#define PLICE_DEBUG @@ -143,17 +104,7 @@ static BOOL s_bAPModeRxCtl( IN INT iSANodeIndex ); -#ifdef PRIVATE_OBJ -static BOOL s_bAPModeRxData ( - IN PSDevice pDevice, - IN ref_sk_buff* skb, - IN UINT FrameSize, - IN UINT cbHeaderOffset, - IN INT iSANodeIndex, - IN INT iDANodeIndex - ); -#else static BOOL s_bAPModeRxData ( IN PSDevice pDevice, @@ -163,7 +114,6 @@ static BOOL s_bAPModeRxData ( IN INT iSANodeIndex, IN INT iDANodeIndex ); -#endif static BOOL s_bHandleRxEncryption( @@ -173,7 +123,7 @@ static BOOL s_bHandleRxEncryption( IN PBYTE pbyRsr, OUT PBYTE pbyNewRsr, OUT PSKeyItem *pKeyOut, - OUT PBOOL pbExtIV, + int * pbExtIV, OUT PWORD pwRxTSC15_0, OUT PDWORD pdwRxTSC47_16 ); @@ -187,7 +137,7 @@ static BOOL s_bHostWepRxEncryption( IN BOOL bOnFly, IN PSKeyItem pKey, OUT PBYTE pbyNewRsr, - OUT PBOOL pbExtIV, + int * pbExtIV, OUT PWORD pwRxTSC15_0, OUT PDWORD pdwRxTSC47_16 @@ -395,11 +345,7 @@ device_receive_frame ( //printk("device_receive_frame:pCurrRD is %x,pRDInfo is %x\n",pCurrRD,pCurrRD->pRDInfo); #endif struct net_device_stats* pStats=&pDevice->stats; -#ifdef PRIVATE_OBJ - ref_sk_buff* skb; -#else struct sk_buff* skb; -#endif PSMgmtObject pMgmt = pDevice->pMgmt; PSRxMgmtPacket pRxPacket = &(pDevice->pMgmt->sRxPacket); PS802_11Header p802_11Header; @@ -434,13 +380,9 @@ device_receive_frame ( PS802_11Header pMACHeader; BOOL bRxeapol_key = FALSE; -// DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---------- device_receive_frame---\n"); -#ifdef PRIVATE_OBJ - skb = &(pRDInfo->ref_skb); -#else +// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---------- device_receive_frame---\n"); skb = pRDInfo->skb; -#endif //PLICE_DEBUG-> @@ -456,7 +398,7 @@ device_receive_frame ( // Min (ACK): 10HD +4CRC + 2Padding + 4Len + 8TSF + 4RSR if ((FrameSize > 2364)||(FrameSize <= 32)) { // Frame Size error drop this packet. - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---------- WRONG Length 1 \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---------- WRONG Length 1 \n"); return FALSE; } @@ -474,7 +416,7 @@ device_receive_frame ( if ((FrameSize > 2346)|(FrameSize < 14)) { // Max: 2312Payload + 30HD +4CRC // Min: 14 bytes ACK - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---------- WRONG Length 2 \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---------- WRONG Length 2 \n"); return FALSE; } //PLICE_DEBUG-> @@ -498,7 +440,7 @@ device_receive_frame ( dwDuration = (FrameSize << 4); dwDuration /= acbyRxRate[*pbyRxRate%MAX_RATE]; if (*pbyRxRate <= RATE_11M) { - if (BITbIsBitOn(*pbyRxSts, 0x01)) { + if (*pbyRxSts & 0x01) { // long preamble dwDuration += 192; } else { @@ -541,11 +483,7 @@ device_receive_frame ( p802_11Header = (PS802_11Header) (pbyFrame); // get SA NodeIndex if (BSSDBbIsSTAInNodeDB(pMgmt, (PBYTE)(p802_11Header->abyAddr2), &iSANodeIndex)) { -#ifdef PRIVATE_OBJ - pMgmt->sNodeDBTable[iSANodeIndex].ulLastRxJiffer = get_jiffies(); -#else pMgmt->sNodeDBTable[iSANodeIndex].ulLastRxJiffer = jiffies; -#endif pMgmt->sNodeDBTable[iSANodeIndex].uInActiveCount = 0; } } @@ -556,10 +494,12 @@ device_receive_frame ( return FALSE; } } + + if (IS_FC_WEP(pbyFrame)) { BOOL bRxDecryOK = FALSE; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"rx WEP pkt\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"rx WEP pkt\n"); bIsWEP = TRUE; if ((pDevice->bEnableHostWEP) && (iSANodeIndex >= 0)) { pKey = &STempKey; @@ -597,7 +537,7 @@ device_receive_frame ( if (bRxDecryOK) { if ((*pbyNewRsr & NEWRSR_DECRYPTOK) == 0) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV Fail\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV Fail\n"); if ( (pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPA) || (pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) || (pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) || @@ -615,7 +555,7 @@ device_receive_frame ( return FALSE; } } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"WEP Func Fail\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"WEP Func Fail\n"); return FALSE; } if ((pKey != NULL) && (pKey->byCipherSuite == KEY_CTL_CCMP)) @@ -631,7 +571,7 @@ device_receive_frame ( //remove the CRC length FrameSize -= U_CRC_LEN; - if ((BITbIsAllBitsOff(*pbyRsr, (RSR_ADDRBROAD | RSR_ADDRMULTI))) && // unicast address + if (( !(*pbyRsr & (RSR_ADDRBROAD | RSR_ADDRMULTI))) && // unicast address (IS_FRAGMENT_PKT((skb->data+4))) ) { // defragment @@ -639,11 +579,7 @@ device_receive_frame ( pDevice->s802_11Counter.ReceivedFragmentCount++; if (bDeFragRx) { // defrag complete -#ifdef PRIVATE_OBJ - skb = &(pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].ref_skb); -#else skb = pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].skb; -#endif FrameSize = pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].cbFrameLength; } @@ -705,25 +641,14 @@ device_receive_frame ( // hostap Deamon handle 802.11 management if (pDevice->bEnableHostapd) { skb->dev = pDevice->apdev; -#ifdef PRIVATE_OBJ - ref_skb_add_offset(skb->skb, 4); - ref_skb_set_dev(pDevice->apdev, skb->skb); - skb_put(skb->skb, FrameSize); - skb->mac_header = skb->data; - *(skb->pkt_type) = PACKET_OTHERHOST; - *(skb->protocol) = htons(ETH_P_802_2); - memset(skb->cb, 0, sizeof(skb->cb)); - netif_rx(skb->skb); -#else skb->data += 4; skb->tail += 4; skb_put(skb, FrameSize); - 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 return TRUE; } } @@ -735,10 +660,10 @@ device_receive_frame ( else { if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { //In AP mode, hw only check addr1(BSSID or RA) if equal to local MAC. - if (BITbIsBitOff(*pbyRsr, RSR_BSSIDOK)) { + if ( !(*pbyRsr & RSR_BSSIDOK)) { if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DEVICE_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", pDevice->dev->name); } } @@ -748,16 +673,15 @@ device_receive_frame ( else { // discard DATA packet while not associate || BSSID error if ((pDevice->bLinkPass == FALSE) || - BITbIsBitOff(*pbyRsr, RSR_BSSIDOK)) { + !(*pbyRsr & RSR_BSSIDOK)) { if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DEVICE_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", pDevice->dev->name); } } return FALSE; } - //mike add:station mode check eapol-key challenge---> { BYTE Protocol_Version; //802.1x Authentication @@ -781,11 +705,13 @@ device_receive_frame ( } } + // Data frame Handle + if (pDevice->bEnablePSMode) { if (IS_FC_MOREDATA((skb->data+4))) { - if (BITbIsBitOn(*pbyRsr, RSR_ADDROK)) { + if (*pbyRsr & RSR_ADDROK) { //PSbSendPSPOLL((PSDevice)pDevice); } } @@ -837,7 +763,7 @@ device_receive_frame ( wEtherType = (skb->data[cbIVOffset + 4 + 24 + 6] << 8) | skb->data[cbIVOffset + 4 + 24 + 6 + 1]; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wEtherType = %04x \n", wEtherType); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wEtherType = %04x \n", wEtherType); if (wEtherType == ETH_P_PAE) { skb->dev = pDevice->apdev; @@ -846,26 +772,15 @@ device_receive_frame ( memcpy(&abyMacHdr[0], (skb->data + 4), 24); memcpy((skb->data + 4 + cbIVOffset), &abyMacHdr[0], 24); } -#ifdef PRIVATE_OBJ - ref_skb_add_offset(skb->skb, (cbIVOffset + 4)); - ref_skb_set_dev(pDevice->apdev, skb->skb); - skb_put(skb->skb, FrameSize); - skb->mac_header = skb->data; - *(skb->pkt_type) = PACKET_OTHERHOST; - *(skb->protocol) = htons(ETH_P_802_2); - memset(skb->cb, 0, sizeof(skb->cb)); - netif_rx(skb->skb); -#else skb->data += (cbIVOffset + 4); skb->tail += (cbIVOffset + 4); skb_put(skb, FrameSize); - 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 return TRUE; } @@ -925,27 +840,26 @@ device_receive_frame ( pdwMIC_R = (PDWORD)(skb->data + 4 + FrameSize + 4); //DBG_PRN_GRP12(("RxL: %lx, RxR: %lx\n", *pdwMIC_L, *pdwMIC_R)); //DBG_PRN_GRP12(("LocalL: %lx, LocalR: %lx\n", dwLocalMIC_L, dwLocalMIC_R)); - //DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"dwMICKey0= %lx,dwMICKey1= %lx \n", dwMICKey0, dwMICKey1); + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"dwMICKey0= %lx,dwMICKey1= %lx \n", dwMICKey0, dwMICKey1); if ((cpu_to_le32(*pdwMIC_L) != dwLocalMIC_L) || (cpu_to_le32(*pdwMIC_R) != dwLocalMIC_R) || (pDevice->bRxMICFail == TRUE)) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC comparison is fail!\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC comparison is fail!\n"); pDevice->bRxMICFail = FALSE; //pDevice->s802_11Counter.TKIPLocalMICFailures.QuadPart++; pDevice->s802_11Counter.TKIPLocalMICFailures++; if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DEVICE_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", pDevice->dev->name); } } - -//2008-0409-07, <Add> by Einsn Liu + //2008-0409-07, <Add> by Einsn Liu #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT //send event to wpa_supplicant //if(pDevice->bWPADevEnable == TRUE) - { + { union iwreq_data wrqu; struct iw_michaelmicfailure ev; int keyidx = pbyFrame[cbHeaderSize+3] >> 6; //top two-bits @@ -967,6 +881,8 @@ device_receive_frame ( } #endif + + if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) { wpahdr = (viawget_wpa_header *)pDevice->skb->data; if ((pDevice->pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && @@ -982,7 +898,7 @@ device_receive_frame ( 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)); @@ -1012,7 +928,7 @@ device_receive_frame ( RSC = dwRxTSC47_16; RSC <<= 16; RSC += wRxTSC15_0; - MEMvCopy(&(pKey->KeyRSC), &RSC, sizeof(QWORD)); + memcpy(&(pKey->KeyRSC), &RSC, sizeof(QWORD)); if ( (pDevice->sMgmtObj.eCurrMode == WMAC_MODE_ESS_STA) && (pDevice->sMgmtObj.eCurrState == WMAC_STATE_ASSOC)) { @@ -1020,7 +936,7 @@ device_receive_frame ( if ( (wRxTSC15_0 < wLocalTSC15_0) && (dwRxTSC47_16 <= dwLocalTSC47_16) && !((dwRxTSC47_16 == 0) && (dwLocalTSC47_16 == 0xFFFFFFFF))) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TSC is illegal~~!\n "); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TSC is illegal~~!\n "); if (pKey->byCipherSuite == KEY_CTL_TKIP) //pDevice->s802_11Counter.TKIPReplays.QuadPart++; pDevice->s802_11Counter.TKIPReplays++; @@ -1030,7 +946,7 @@ device_receive_frame ( if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DEVICE_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", pDevice->dev->name); } } @@ -1066,7 +982,7 @@ device_receive_frame ( if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DEVICE_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", pDevice->dev->name); } } @@ -1081,34 +997,22 @@ device_receive_frame ( } -#ifdef PRIVATE_OBJ - ref_skb_add_offset(skb->skb, cbHeaderOffset); - skb_put(skb->skb, FrameSize); - *(skb->protocol)=eth_type_trans(skb->skb, skb->dev); - -#else skb->data += cbHeaderOffset; skb->tail += cbHeaderOffset; skb_put(skb, FrameSize); skb->protocol=eth_type_trans(skb, skb->dev); -#endif //drop frame not met IEEE 802.3 /* if (pDevice->flags & DEVICE_FLAGS_VAL_PKT_LEN) { -#ifdef PRIVATE_OBJ - if ((*(skb->protocol)==htons(ETH_P_802_3)) && - (*(skb->len)!=htons(skb->mac.ethernet->h_proto))) { -#else if ((skb->protocol==htons(ETH_P_802_3)) && (skb->len!=htons(skb->mac.ethernet->h_proto))) { -#endif pStats->rx_length_errors++; pStats->rx_dropped++; if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DEVICE_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", pDevice->dev->name); } } @@ -1117,25 +1021,19 @@ device_receive_frame ( } */ -#ifdef PRIVATE_OBJ - *(skb->ip_summed)=CHECKSUM_NONE; - pStats->rx_bytes +=*(skb->len); - pStats->rx_packets++; - netif_rx(skb->skb); -#else skb->ip_summed=CHECKSUM_NONE; pStats->rx_bytes +=skb->len; pStats->rx_packets++; netif_rx(skb); -#endif if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { - DEVICE_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", + DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc more frag bufs\n", pDevice->dev->name); } return FALSE; } + return TRUE; } @@ -1169,7 +1067,7 @@ static BOOL s_bAPModeRxCtl ( (WLAN_MGMT_REASON_CLASS2_NONAUTH), &Status ); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDeAuthenBeginSta 1\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDeAuthenBeginSta 1\n"); return TRUE; }; if (pMgmt->sNodeDBTable[iSANodeIndex].eNodeState < NODE_ASSOC) { @@ -1181,7 +1079,7 @@ static BOOL s_bAPModeRxCtl ( (WLAN_MGMT_REASON_CLASS3_NONASSOC), &Status ); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDisassocBeginSta 2\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDisassocBeginSta 2\n"); return TRUE; }; @@ -1190,7 +1088,7 @@ static BOOL s_bAPModeRxCtl ( if (IS_CTL_PSPOLL(pbyFrame)) { pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = TRUE; bScheduleCommand((HANDLE)pDevice, WLAN_CMD_RX_PSPOLL, NULL); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 1\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 1\n"); } else { // check Data PS state @@ -1199,7 +1097,7 @@ static BOOL s_bAPModeRxCtl ( pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable = FALSE; pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = TRUE; bScheduleCommand((HANDLE)pDevice, WLAN_CMD_RX_PSPOLL, NULL); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 2\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 2\n"); } } } @@ -1215,7 +1113,7 @@ static BOOL s_bAPModeRxCtl ( pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable = FALSE; pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = TRUE; bScheduleCommand((HANDLE)pDevice, WLAN_CMD_RX_PSPOLL, NULL); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 3\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 3\n"); } } @@ -1228,8 +1126,8 @@ static BOOL s_bAPModeRxCtl ( (WLAN_MGMT_REASON_CLASS2_NONAUTH), &Status ); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDeAuthenBeginSta 3\n"); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BSSID:%02x-%02x-%02x=%02x-%02x-%02x \n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDeAuthenBeginSta 3\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BSSID:%02x-%02x-%02x=%02x-%02x-%02x \n", p802_11Header->abyAddr3[0], p802_11Header->abyAddr3[1], p802_11Header->abyAddr3[2], @@ -1237,7 +1135,7 @@ static BOOL s_bAPModeRxCtl ( p802_11Header->abyAddr3[4], p802_11Header->abyAddr3[5] ); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR2:%02x-%02x-%02x=%02x-%02x-%02x \n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR2:%02x-%02x-%02x=%02x-%02x-%02x \n", p802_11Header->abyAddr2[0], p802_11Header->abyAddr2[1], p802_11Header->abyAddr2[2], @@ -1245,7 +1143,7 @@ static BOOL s_bAPModeRxCtl ( p802_11Header->abyAddr2[4], p802_11Header->abyAddr2[5] ); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR1:%02x-%02x-%02x=%02x-%02x-%02x \n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR1:%02x-%02x-%02x=%02x-%02x-%02x \n", p802_11Header->abyAddr1[0], p802_11Header->abyAddr1[1], p802_11Header->abyAddr1[2], @@ -1253,9 +1151,9 @@ static BOOL s_bAPModeRxCtl ( p802_11Header->abyAddr1[4], p802_11Header->abyAddr1[5] ); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: wFrameCtl= %x\n", p802_11Header->wFrameCtl ); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: wFrameCtl= %x\n", p802_11Header->wFrameCtl ); VNSvInPortB(pDevice->PortOffset + MAC_REG_RCR, &(pDevice->byRxMode)); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc:pDevice->byRxMode = %x\n", pDevice->byRxMode ); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc:pDevice->byRxMode = %x\n", pDevice->byRxMode ); return TRUE; } } @@ -1271,7 +1169,7 @@ static BOOL s_bHandleRxEncryption ( IN PBYTE pbyRsr, OUT PBYTE pbyNewRsr, OUT PSKeyItem *pKeyOut, - OUT PBOOL pbExtIV, + int * pbExtIV, OUT PWORD pwRxTSC15_0, OUT PDWORD pdwRxTSC47_16 ) @@ -1295,7 +1193,7 @@ static BOOL s_bHandleRxEncryption ( } byKeyIdx = (*(pbyIV+3) & 0xc0); byKeyIdx >>= 6; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\nKeyIdx: %d\n", byKeyIdx); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\nKeyIdx: %d\n", byKeyIdx); if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA) || (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) || @@ -1305,14 +1203,14 @@ static BOOL s_bHandleRxEncryption ( if (((*pbyRsr & (RSR_ADDRBROAD | RSR_ADDRMULTI)) == 0) && (pDevice->pMgmt->byCSSPK != KEY_CTL_NONE)) { // unicast pkt use pairwise key - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"unicast pkt\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"unicast pkt\n"); if (KeybGetKey(&(pDevice->sKey), pDevice->abyBSSID, 0xFFFFFFFF, &pKey) == TRUE) { if (pDevice->pMgmt->byCSSPK == KEY_CTL_TKIP) byDecMode = KEY_CTL_TKIP; else if (pDevice->pMgmt->byCSSPK == KEY_CTL_CCMP) byDecMode = KEY_CTL_CCMP; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"unicast pkt: %d, %p\n", byDecMode, pKey); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"unicast pkt: %d, %p\n", byDecMode, pKey); } else { // use group key KeybGetKey(&(pDevice->sKey), pDevice->abyBSSID, byKeyIdx, &pKey); @@ -1320,7 +1218,7 @@ static BOOL s_bHandleRxEncryption ( byDecMode = KEY_CTL_TKIP; else if (pDevice->pMgmt->byCSSGK == KEY_CTL_CCMP) byDecMode = KEY_CTL_CCMP; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"group pkt: %d, %d, %p\n", byKeyIdx, byDecMode, pKey); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"group pkt: %d, %d, %p\n", byKeyIdx, byDecMode, pKey); } } // our WEP only support Default Key @@ -1334,10 +1232,10 @@ static BOOL s_bHandleRxEncryption ( } *pKeyOut = pKey; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"AES:%d %d %d\n", pDevice->pMgmt->byCSSPK, pDevice->pMgmt->byCSSGK, byDecMode); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"AES:%d %d %d\n", pDevice->pMgmt->byCSSPK, pDevice->pMgmt->byCSSGK, byDecMode); if (pKey == NULL) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey == NULL\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey == NULL\n"); if (byDecMode == KEY_CTL_WEP) { // pDevice->s802_11Counter.WEPUndecryptableCount.QuadPart++; } else if (pDevice->bLinkPass == TRUE) { @@ -1363,8 +1261,8 @@ static BOOL s_bHandleRxEncryption ( // 2. WEP 256 PayloadLen -= (WLAN_HDR_ADDR3_LEN + 4 + 4); // 24 is 802.11 header,4 is IV, 4 is crc - MEMvCopy(pDevice->abyPRNG, pbyIV, 3); - MEMvCopy(pDevice->abyPRNG + 3, pKey->abyKey, pKey->uKeyLength); + memcpy(pDevice->abyPRNG, pbyIV, 3); + memcpy(pDevice->abyPRNG + 3, pKey->abyKey, pKey->uKeyLength); rc4_init(&pDevice->SBox, pDevice->abyPRNG, pKey->uKeyLength + 3); rc4_encrypt(&pDevice->SBox, pbyIV+4, pbyIV+4, PayloadLen); @@ -1378,13 +1276,13 @@ static BOOL s_bHandleRxEncryption ( PayloadLen -= (WLAN_HDR_ADDR3_LEN + 8 + 4); // 24 is 802.11 header, 8 is IV&ExtIV, 4 is crc *pdwRxTSC47_16 = cpu_to_le32(*(PDWORD)(pbyIV + 4)); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ExtIV: %lx\n",*pdwRxTSC47_16); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ExtIV: %lx\n",*pdwRxTSC47_16); if (byDecMode == KEY_CTL_TKIP) { *pwRxTSC15_0 = cpu_to_le16(MAKEWORD(*(pbyIV+2), *pbyIV)); } else { *pwRxTSC15_0 = cpu_to_le16(*(PWORD)pbyIV); } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TSC0_15: %x\n", *pwRxTSC15_0); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TSC0_15: %x\n", *pwRxTSC15_0); if ((byDecMode == KEY_CTL_TKIP) && (pDevice->byLocalID <= REV_ID_VT3253_A1)) { @@ -1396,10 +1294,10 @@ static BOOL s_bHandleRxEncryption ( rc4_encrypt(&pDevice->SBox, pbyIV+8, pbyIV+8, PayloadLen); if (ETHbIsBufferCrc32Ok(pbyIV+8, PayloadLen)) { *pbyNewRsr |= NEWRSR_DECRYPTOK; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV OK!\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV OK!\n"); } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV FAIL!!!\n"); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"PayloadLen = %d\n", PayloadLen); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV FAIL!!!\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"PayloadLen = %d\n", PayloadLen); } } }// end of TKIP/AES @@ -1418,7 +1316,7 @@ static BOOL s_bHostWepRxEncryption ( IN BOOL bOnFly, IN PSKeyItem pKey, OUT PBYTE pbyNewRsr, - OUT PBOOL pbExtIV, + int * pbExtIV, OUT PWORD pwRxTSC15_0, OUT PDWORD pdwRxTSC47_16 ) @@ -1442,7 +1340,7 @@ static BOOL s_bHostWepRxEncryption ( } byKeyIdx = (*(pbyIV+3) & 0xc0); byKeyIdx >>= 6; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\nKeyIdx: %d\n", byKeyIdx); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\nKeyIdx: %d\n", byKeyIdx); if (pDevice->pMgmt->byCSSGK == KEY_CTL_TKIP) @@ -1450,7 +1348,7 @@ static BOOL s_bHostWepRxEncryption ( else if (pDevice->pMgmt->byCSSGK == KEY_CTL_CCMP) byDecMode = KEY_CTL_CCMP; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"AES:%d %d %d\n", pDevice->pMgmt->byCSSPK, pDevice->pMgmt->byCSSGK, byDecMode); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"AES:%d %d %d\n", pDevice->pMgmt->byCSSPK, pDevice->pMgmt->byCSSGK, byDecMode); if (byDecMode != pKey->byCipherSuite) { if (byDecMode == KEY_CTL_WEP) { @@ -1463,7 +1361,7 @@ static BOOL s_bHostWepRxEncryption ( if (byDecMode == KEY_CTL_WEP) { // handle WEP - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"byDecMode == KEY_CTL_WEP \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"byDecMode == KEY_CTL_WEP \n"); if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || (((PSKeyTable)(pKey->pvKeyTable))->bSoftWEP == TRUE) || (bOnFly == FALSE)) { @@ -1473,8 +1371,8 @@ static BOOL s_bHostWepRxEncryption ( // 3. NotOnFly PayloadLen -= (WLAN_HDR_ADDR3_LEN + 4 + 4); // 24 is 802.11 header,4 is IV, 4 is crc - MEMvCopy(pDevice->abyPRNG, pbyIV, 3); - MEMvCopy(pDevice->abyPRNG + 3, pKey->abyKey, pKey->uKeyLength); + memcpy(pDevice->abyPRNG, pbyIV, 3); + memcpy(pDevice->abyPRNG + 3, pKey->abyKey, pKey->uKeyLength); rc4_init(&pDevice->SBox, pDevice->abyPRNG, pKey->uKeyLength + 3); rc4_encrypt(&pDevice->SBox, pbyIV+4, pbyIV+4, PayloadLen); @@ -1488,31 +1386,32 @@ static BOOL s_bHostWepRxEncryption ( PayloadLen -= (WLAN_HDR_ADDR3_LEN + 8 + 4); // 24 is 802.11 header, 8 is IV&ExtIV, 4 is crc *pdwRxTSC47_16 = cpu_to_le32(*(PDWORD)(pbyIV + 4)); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ExtIV: %lx\n",*pdwRxTSC47_16); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ExtIV: %lx\n",*pdwRxTSC47_16); if (byDecMode == KEY_CTL_TKIP) { *pwRxTSC15_0 = cpu_to_le16(MAKEWORD(*(pbyIV+2), *pbyIV)); } else { *pwRxTSC15_0 = cpu_to_le16(*(PWORD)pbyIV); } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TSC0_15: %x\n", *pwRxTSC15_0); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TSC0_15: %x\n", *pwRxTSC15_0); if (byDecMode == KEY_CTL_TKIP) { + if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || (bOnFly == FALSE)) { // Software TKIP // 1. 3253 A // 2. NotOnFly - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"soft KEY_CTL_TKIP \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"soft KEY_CTL_TKIP \n"); pMACHeader = (PS802_11Header) (pbyFrame); TKIPvMixKey(pKey->abyKey, pMACHeader->abyAddr2, *pwRxTSC15_0, *pdwRxTSC47_16, pDevice->abyPRNG); rc4_init(&pDevice->SBox, pDevice->abyPRNG, TKIP_KEY_LEN); rc4_encrypt(&pDevice->SBox, pbyIV+8, pbyIV+8, PayloadLen); if (ETHbIsBufferCrc32Ok(pbyIV+8, PayloadLen)) { *pbyNewRsr |= NEWRSR_DECRYPTOK; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV OK!\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV OK!\n"); } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV FAIL!!!\n"); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"PayloadLen = %d\n", PayloadLen); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ICV FAIL!!!\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"PayloadLen = %d\n", PayloadLen); } } } @@ -1521,12 +1420,12 @@ static BOOL s_bHostWepRxEncryption ( if (bOnFly == FALSE) { // Software CCMP // NotOnFly - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"soft KEY_CTL_CCMP\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"soft KEY_CTL_CCMP\n"); if (AESbGenCCMP(pKey->abyKey, pbyFrame, FrameSize)) { *pbyNewRsr |= NEWRSR_DECRYPTOK; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CCMP MIC compare OK!\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CCMP MIC compare OK!\n"); } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CCMP MIC fail!\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CCMP MIC fail!\n"); } } } @@ -1540,20 +1439,6 @@ static BOOL s_bHostWepRxEncryption ( - -#ifdef PRIVATE_OBJ - -static BOOL s_bAPModeRxData ( - IN PSDevice pDevice, - IN ref_sk_buff* skb, - IN UINT FrameSize, - IN UINT cbHeaderOffset, - IN INT iSANodeIndex, - IN INT iDANodeIndex - ) - -#else - static BOOL s_bAPModeRxData ( IN PSDevice pDevice, IN struct sk_buff* skb, @@ -1562,22 +1447,15 @@ static BOOL s_bAPModeRxData ( IN INT iSANodeIndex, IN INT iDANodeIndex ) -#endif { PSMgmtObject pMgmt = pDevice->pMgmt; BOOL bRelayAndForward = FALSE; BOOL bRelayOnly = FALSE; BYTE byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; WORD wAID; -#ifdef PRIVATE_OBJ - struct sk_buff* tmp_skb; - ref_sk_buff s_ref_skb; - ref_sk_buff* skbcpy = &s_ref_skb; -#else - struct sk_buff* skbcpy = NULL; -#endif + struct sk_buff* skbcpy = NULL; if (FrameSize > CB_MAX_BUF_SIZE) return FALSE; @@ -1585,28 +1463,18 @@ static BOOL s_bAPModeRxData ( if(IS_MULTICAST_ADDRESS((PBYTE)(skb->data+cbHeaderOffset))) { if (pMgmt->sNodeDBTable[0].bPSEnable) { -#ifdef PRIVATE_OBJ - tmp_skb = dev_alloc_skb((int)pDevice->rx_buf_sz); - skbcpy = &s_ref_skb; - ref_skb_remap(pDevice->dev, skbcpy, tmp_skb); -#else skbcpy = dev_alloc_skb((int)pDevice->rx_buf_sz); -#endif + // if any node in PS mode, buffer packet until DTIM. if (skbcpy == NULL) { - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "relay multicast no skb available \n"); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "relay multicast no skb available \n"); } else { skbcpy->dev = pDevice->dev; -#ifdef PRIVATE_OBJ - *(skbcpy->len) = FrameSize; - memcpy(skbcpy->data, skb->data+cbHeaderOffset, FrameSize); - skb_queue_tail(&(pMgmt->sNodeDBTable[0].sTxPSQueue), skbcpy->skb); -#else skbcpy->len = FrameSize; memcpy(skbcpy->data, skb->data+cbHeaderOffset, FrameSize); skb_queue_tail(&(pMgmt->sNodeDBTable[0].sTxPSQueue), skbcpy); -#endif + pMgmt->sNodeDBTable[0].wEnQueueCnt++; // set tx map pMgmt->abyPSTxMap[0] |= byMask[0]; @@ -1623,20 +1491,14 @@ static BOOL s_bAPModeRxData ( if (pMgmt->sNodeDBTable[iDANodeIndex].bPSEnable) { // queue this skb until next PS tx, and then release. -#ifdef PRIVATE_OBJ - ref_skb_add_offset(skb->skb, cbHeaderOffset); - skb_put(skb->skb, FrameSize); - skb_queue_tail(&pMgmt->sNodeDBTable[iDANodeIndex].sTxPSQueue, skb->skb); -#else skb->data += cbHeaderOffset; skb->tail += cbHeaderOffset; skb_put(skb, FrameSize); skb_queue_tail(&pMgmt->sNodeDBTable[iDANodeIndex].sTxPSQueue, skb); -#endif pMgmt->sNodeDBTable[iDANodeIndex].wEnQueueCnt++; wAID = pMgmt->sNodeDBTable[iDANodeIndex].wAID; pMgmt->abyPSTxMap[wAID >> 3] |= byMask[wAID & 7]; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "relay: index= %d, pMgmt->abyPSTxMap[%d]= %d\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "relay: index= %d, pMgmt->abyPSTxMap[%d]= %d\n", iDANodeIndex, (wAID >> 3), pMgmt->abyPSTxMap[wAID >> 3]); return TRUE; } diff --git a/drivers/staging/vt6655/dpc.h b/drivers/staging/vt6655/dpc.h index 68447c4..51508b9 100644 --- a/drivers/staging/vt6655/dpc.h +++ b/drivers/staging/vt6655/dpc.h @@ -16,7 +16,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * File: whdr.h + * File: dpc.h * * Purpose: * @@ -26,20 +26,12 @@ * */ - #ifndef __DPC_H__ #define __DPC_H__ -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif -#if !defined(__DEVICE_H__) #include "device.h" -#endif -#if !defined(__WCMD_H__) #include "wcmd.h" -#endif - /*--------------------- Export Definitions -------------------------*/ @@ -49,26 +41,14 @@ /*--------------------- Export Functions --------------------------*/ - -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ - - BOOL device_receive_frame ( IN PSDevice pDevice, IN PSRxDesc pCurrRD ); - -#ifdef __cplusplus -} /* End of extern "C" { */ -#endif /* __cplusplus */ - - - VOID MngWorkItem(PVOID Context); + #endif // __RXTX_H__ diff --git a/drivers/staging/vt6655/hostap.c b/drivers/staging/vt6655/hostap.c index 91f189d..58abf44 100644 --- a/drivers/staging/vt6655/hostap.c +++ b/drivers/staging/vt6655/hostap.c @@ -30,32 +30,13 @@ * */ - -#if !defined(__HOSTAP_H__) #include "hostap.h" -#endif -#if !defined(__IOCMD_H__) #include "iocmd.h" -#endif -#if !defined(__MAC_H__) #include "mac.h" -#endif -#if !defined(__CARD_H__) #include "card.h" -#endif -#if !defined(__BASEBAND_H__) #include "baseband.h" -#endif -#if !defined(__WPACTL_H__) #include "wpactl.h" -#endif -#if !defined(__KEY_H__) #include "key.h" -#endif -#if !defined(__MAC_H__) -#include "mac.h" -#endif - #define VIAWGET_HOSTAPD_MAX_BUF_SIZE 1024 #define HOSTAP_CRYPT_FLAG_SET_TX_KEY BIT0 @@ -103,29 +84,13 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked) PSDevice apdev_priv; struct net_device *dev = pDevice->dev; int ret; + const struct net_device_ops apdev_netdev_ops = { + .ndo_start_xmit = pDevice->tx_80211, + }; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Enabling hostapd mode\n", dev->name); - -#ifdef PRIVATE_OBJ - pDevice->apdev = ref_init_apdev(dev); - - if (pDevice->apdev == NULL) - return -ENOMEM; - - if (rtnl_locked) - ret = register_netdevice(pDevice->apdev); - else - ret = register_netdev(pDevice->apdev); - if (ret) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: register_netdevice(AP) failed!\n", - dev->name); - return -1; - } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Registered netdevice %s for AP management\n", - dev->name, pDevice->apdev->name); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Enabling hostapd mode\n", dev->name); -#else - pDevice->apdev = (struct net_device *)kmalloc(sizeof(struct net_device), GFP_KERNEL); + pDevice->apdev = (struct net_device *)kmalloc(sizeof(struct net_device), GFP_KERNEL); if (pDevice->apdev == NULL) return -ENOMEM; memset(pDevice->apdev, 0, sizeof(struct net_device)); @@ -134,10 +99,7 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked) *apdev_priv = *pDevice; memcpy(pDevice->apdev->dev_addr, dev->dev_addr, ETH_ALEN); - const struct net_device_ops apdev_netdev_ops = { - .ndo_start_xmit = pDevice->tx_80211, - }; - pDevice->apdev->netdev_ops = &apdev_netdev_ops; + pDevice->apdev->netdev_ops = &apdev_netdev_ops; pDevice->apdev->type = ARPHRD_IEEE80211; @@ -151,16 +113,15 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked) else ret = register_netdev(pDevice->apdev); if (ret) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: register_netdevice(AP) failed!\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: register_netdevice(AP) failed!\n", dev->name); return -1; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Registered netdevice %s for AP management\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Registered netdevice %s for AP management\n", dev->name, pDevice->apdev->name); KeyvInitTable(&pDevice->sKey, pDevice->PortOffset); -#endif return 0; } @@ -182,14 +143,14 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked) static int hostap_disable_hostapd(PSDevice pDevice, int rtnl_locked) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: disabling hostapd mode\n", pDevice->dev->name); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: disabling hostapd mode\n", pDevice->dev->name); if (pDevice->apdev && pDevice->apdev->name && pDevice->apdev->name[0]) { if (rtnl_locked) unregister_netdevice(pDevice->apdev); else unregister_netdev(pDevice->apdev); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Netdevice %s unregistered\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Netdevice %s unregistered\n", pDevice->dev->name, pDevice->apdev->name); } kfree(pDevice->apdev); @@ -308,13 +269,11 @@ static int hostap_add_sta(PSDevice pDevice, WLAN_GET_CAP_INFO_SHORTPREAMBLE(pMgmt->sNodeDBTable[uNodeIndex].wCapInfo); pMgmt->sNodeDBTable[uNodeIndex].wAID = (WORD)param->u.add_sta.aid; -#ifdef PRIVATE_OBJ - pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer = get_jiffies(); -#else + pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer = jiffies; -#endif - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Add STA AID= %d \n", pMgmt->sNodeDBTable[uNodeIndex].wAID); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X \n", + + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Add STA AID= %d \n", pMgmt->sNodeDBTable[uNodeIndex].wAID); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X \n", param->sta_addr[0], param->sta_addr[1], param->sta_addr[2], @@ -322,7 +281,7 @@ static int hostap_add_sta(PSDevice pDevice, param->sta_addr[4], param->sta_addr[5] ) ; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Max Support rate = %d \n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Max Support rate = %d \n", pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate); return 0; @@ -349,13 +308,9 @@ static int hostap_get_info_sta(PSDevice pDevice, UINT uNodeIndex; if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) { -#ifdef PRIVATE_OBJ - param->u.get_info_sta.inactive_sec = - (get_jiffies() - pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer) / HZ; -#else param->u.get_info_sta.inactive_sec = (jiffies - pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer) / HZ; -#endif + //param->u.get_info_sta.txexc = pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts; } else { @@ -419,7 +374,7 @@ static int hostap_set_flags_sta(PSDevice pDevice, if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) { pMgmt->sNodeDBTable[uNodeIndex].dwFlags |= param->u.set_flags_sta.flags_or; pMgmt->sNodeDBTable[uNodeIndex].dwFlags &= param->u.set_flags_sta.flags_and; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " dwFlags = %x \n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " dwFlags = %x \n", (UINT)pMgmt->sNodeDBTable[uNodeIndex].dwFlags); } else { @@ -458,18 +413,18 @@ static int hostap_set_generic_element(PSDevice pDevice, pMgmt->wWPAIELen = param->u.generic_elem.len; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pMgmt->wWPAIELen = %d\n", pMgmt->wWPAIELen); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pMgmt->wWPAIELen = %d\n", pMgmt->wWPAIELen); // disable wpa if (pMgmt->wWPAIELen == 0) { pMgmt->eAuthenMode = WMAC_AUTH_OPEN; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " No WPAIE, Disable WPA \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " No WPAIE, Disable WPA \n"); } else { // enable wpa if ((pMgmt->abyWPAIE[0] == WLAN_EID_RSN_WPA) || (pMgmt->abyWPAIE[0] == WLAN_EID_RSN)) { pMgmt->eAuthenMode = WMAC_AUTH_WPANONE; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set WPAIE enable WPA\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set WPAIE enable WPA\n"); } else return -EINVAL; } @@ -543,7 +498,7 @@ static int hostap_set_encryption(PSDevice pDevice, if ((param->u.crypt.idx > 3) || (param->u.crypt.key_len > MAX_KEY_LEN)) { param->u.crypt.err = HOSTAP_CRYPT_ERR_KEY_SET_FAILED; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " HOSTAP_CRYPT_ERR_KEY_SET_FAILED\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " HOSTAP_CRYPT_ERR_KEY_SET_FAILED\n"); return -EINVAL; } @@ -557,12 +512,12 @@ static int hostap_set_encryption(PSDevice pDevice, } else { if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &iNodeIndex) == FALSE) { param->u.crypt.err = HOSTAP_CRYPT_ERR_UNKNOWN_ADDR; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " HOSTAP_CRYPT_ERR_UNKNOWN_ADDR\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " HOSTAP_CRYPT_ERR_UNKNOWN_ADDR\n"); return -EINVAL; } } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " hostap_set_encryption: sta_index %d \n", iNodeIndex); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " hostap_set_encryption: alg %d \n", param->u.crypt.alg); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " hostap_set_encryption: sta_index %d \n", iNodeIndex); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " hostap_set_encryption: alg %d \n", param->u.crypt.alg); if (param->u.crypt.alg == WPA_ALG_NONE) { @@ -571,7 +526,7 @@ static int hostap_set_encryption(PSDevice pDevice, param->sta_addr, pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex, pDevice->PortOffset) == FALSE) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybRemoveKey fail \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybRemoveKey fail \n"); } pMgmt->sNodeDBTable[iNodeIndex].bOnFly = FALSE; } @@ -706,7 +661,7 @@ static int hostap_set_encryption(PSDevice pDevice, // Key Table Full pMgmt->sNodeDBTable[iNodeIndex].bOnFly = FALSE; bKeyTableFull = TRUE; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Key Table Full\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Key Table Full\n"); } } @@ -720,10 +675,10 @@ static int hostap_set_encryption(PSDevice pDevice, MACvSetDefaultKeyCtl(pDevice->PortOffset, wKeyCtl, MAX_KEY_TABLE-1, pDevice->byLocalID); } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set key sta_index= %d \n", iNodeIndex); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " tx_index=%d len=%d \n", param->u.crypt.idx, + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set key sta_index= %d \n", iNodeIndex); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " tx_index=%d len=%d \n", param->u.crypt.idx, param->u.crypt.key_len ); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " key=%x-%x-%x-%x-%x-xxxxx \n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " key=%x-%x-%x-%x-%x-xxxxx \n", pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[0], pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[1], pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[2], @@ -775,11 +730,11 @@ static int hostap_get_encryption(PSDevice pDevice, } else { if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &iNodeIndex) == FALSE) { param->u.crypt.err = HOSTAP_CRYPT_ERR_UNKNOWN_ADDR; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "hostap_get_encryption: HOSTAP_CRYPT_ERR_UNKNOWN_ADDR\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "hostap_get_encryption: HOSTAP_CRYPT_ERR_UNKNOWN_ADDR\n"); return -EINVAL; } } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "hostap_get_encryption: %d\n", iNodeIndex); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "hostap_get_encryption: %d\n", iNodeIndex); memset(param->u.crypt.seq, 0, 8); for (ii = 0 ; ii < 8 ; ii++) { param->u.crypt.seq[ii] = (BYTE)pMgmt->sNodeDBTable[iNodeIndex].KeyRSC >> (ii * 8); @@ -824,74 +779,74 @@ int hostap_ioctl(PSDevice pDevice, struct iw_point *p) switch (param->cmd) { case VIAWGET_HOSTAPD_SET_ENCRYPTION: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_ENCRYPTION \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_ENCRYPTION \n"); spin_lock_irq(&pDevice->lock); ret = hostap_set_encryption(pDevice, param, p->length); spin_unlock_irq(&pDevice->lock); break; case VIAWGET_HOSTAPD_GET_ENCRYPTION: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_GET_ENCRYPTION \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_GET_ENCRYPTION \n"); spin_lock_irq(&pDevice->lock); ret = hostap_get_encryption(pDevice, param, p->length); spin_unlock_irq(&pDevice->lock); break; case VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR \n"); return -EOPNOTSUPP; break; case VIAWGET_HOSTAPD_FLUSH: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_FLUSH \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_FLUSH \n"); spin_lock_irq(&pDevice->lock); hostap_flush_sta(pDevice); spin_unlock_irq(&pDevice->lock); break; case VIAWGET_HOSTAPD_ADD_STA: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_ADD_STA \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_ADD_STA \n"); spin_lock_irq(&pDevice->lock); ret = hostap_add_sta(pDevice, param); spin_unlock_irq(&pDevice->lock); break; case VIAWGET_HOSTAPD_REMOVE_STA: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_REMOVE_STA \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_REMOVE_STA \n"); spin_lock_irq(&pDevice->lock); ret = hostap_remove_sta(pDevice, param); spin_unlock_irq(&pDevice->lock); break; case VIAWGET_HOSTAPD_GET_INFO_STA: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_GET_INFO_STA \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_GET_INFO_STA \n"); ret = hostap_get_info_sta(pDevice, param); ap_ioctl = 1; break; /* case VIAWGET_HOSTAPD_RESET_TXEXC_STA: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_RESET_TXEXC_STA \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_RESET_TXEXC_STA \n"); ret = hostap_reset_txexc_sta(pDevice, param); break; */ case VIAWGET_HOSTAPD_SET_FLAGS_STA: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_FLAGS_STA \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_FLAGS_STA \n"); ret = hostap_set_flags_sta(pDevice, param); break; case VIAWGET_HOSTAPD_MLME: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_MLME \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_MLME \n"); return -EOPNOTSUPP; case VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT \n"); ret = hostap_set_generic_element(pDevice, param); break; case VIAWGET_HOSTAPD_SCAN_REQ: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SCAN_REQ \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SCAN_REQ \n"); return -EOPNOTSUPP; case VIAWGET_HOSTAPD_STA_CLEAR_STATS: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_STA_CLEAR_STATS \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_STA_CLEAR_STATS \n"); return -EOPNOTSUPP; default: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "hostap_ioctl: unknown cmd=%d\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "hostap_ioctl: unknown cmd=%d\n", (int)param->cmd); return -EOPNOTSUPP; break; diff --git a/drivers/staging/vt6655/hostap.h b/drivers/staging/vt6655/hostap.h index 1fcb2f0..8fd667b 100644 --- a/drivers/staging/vt6655/hostap.h +++ b/drivers/staging/vt6655/hostap.h @@ -26,25 +26,13 @@ * */ - #ifndef __HOSTAP_H__ #define __HOSTAP_H__ -#if !defined(__DEVICE_H__) #include "device.h" -#endif - /*--------------------- Export Definitions -------------------------*/ -#if WIRELESS_EXT < 9 -struct iw_point { - caddr_t pointer; - __u16 length; - __u16 flags; -}; -#endif /* WIRELESS_EXT < 9 */ - #define WLAN_RATE_1M BIT0 #define WLAN_RATE_2M BIT1 #define WLAN_RATE_5M5 BIT2 @@ -65,11 +53,6 @@ struct iw_point { /*--------------------- Export Functions --------------------------*/ - -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ - #ifndef ETH_P_PAE #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ #endif /* ETH_P_PAE */ @@ -81,13 +64,6 @@ extern "C" { /* Assume C declarations for C++ */ int hostap_set_hostapd(PSDevice pDevice, int val, int rtnl_locked); int hostap_ioctl(PSDevice pDevice, struct iw_point *p); -#ifdef __cplusplus -} /* End of extern "C" { */ -#endif /* __cplusplus */ - - - - #endif // __HOSTAP_H__ diff --git a/drivers/staging/vt6655/iocmd.h b/drivers/staging/vt6655/iocmd.h index ada9ee9..60c0a36 100644 --- a/drivers/staging/vt6655/iocmd.h +++ b/drivers/staging/vt6655/iocmd.h @@ -1,5 +1,6 @@ /* - * Copyright (c) 1996, 2003 VIA Networking, Inc. All rights reserved. + * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. + * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,10 +29,7 @@ #ifndef __IOCMD_H__ #define __IOCMD_H__ -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif - /*--------------------- Export Definitions -------------------------*/ @@ -73,12 +71,12 @@ typedef enum tagWMAC_CMD { WLAN_CMD_SET_HOST_WEP, WLAN_CMD_SET_WPA, WLAN_CMD_GET_NODE_CNT, - WLAN_CMD_ZONETYPE_SET, + WLAN_CMD_ZONETYPE_SET, WLAN_CMD_GET_NODE_LIST -} WMAC_CMD, DEF* PWMAC_CMD; +} WMAC_CMD, *PWMAC_CMD; - typedef enum tagWZONETYPE { +typedef enum tagWZONETYPE { ZoneType_USA=0, ZoneType_Japan=1, ZoneType_Europe=2 @@ -106,7 +104,6 @@ typedef enum tagWMAC_CMD { #define WEP_104BIT_LEN 13 #define WEP_232BIT_LEN 16 - // Ioctl interface structure // Command structure // @@ -118,7 +115,6 @@ typedef struct tagSCmdRequest { U16 wCmdCode; } SCmdRequest, *PSCmdRequest; - // // Scan // @@ -145,6 +141,10 @@ typedef struct tagSCmdBSSJoin { } SCmdBSSJoin, *PSCmdBSSJoin; +// +// Zonetype Setting +// + typedef struct tagSCmdZoneTypeSet { BOOL bWrite; @@ -162,7 +162,6 @@ typedef struct tagSWPAResult { } SWPAResult, *PSWPAResult; #endif - typedef struct tagSCmdStartAP { U16 wBSSType; @@ -242,7 +241,7 @@ typedef struct tagSDot11MIBCount { U32 ReceivedFragmentCount; U32 MulticastReceivedFrameCount; U32 FCSErrorCount; -} SDot11MIBCount, DEF* PSDot11MIBCount; +} SDot11MIBCount, *PSDot11MIBCount; @@ -349,7 +348,7 @@ typedef struct tagSStatMIBCount { U32 ullTxBroadcastBytes[2]; U32 ullTxMulticastBytes[2]; U32 ullTxDirectedBytes[2]; -} SStatMIBCount, DEF* PSStatMIBCount; +} SStatMIBCount, *PSStatMIBCount; typedef struct tagSNodeItem { diff --git a/drivers/staging/vt6655/ioctl.c b/drivers/staging/vt6655/ioctl.c index 4869107..fc9cbe0 100644 --- a/drivers/staging/vt6655/ioctl.c +++ b/drivers/staging/vt6655/ioctl.c @@ -30,32 +30,13 @@ * */ - -#if !defined(__IOCTL_H__) #include "ioctl.h" -#endif -#if !defined(__IOCMD_H__) #include "iocmd.h" -#endif -#if !defined(__MAC_H__) #include "mac.h" -#endif -#if !defined(__CARD_H__) #include "card.h" -#endif -#if !defined(__HOSTAP_H__) #include "hostap.h" -#endif -#if !defined(__UMEM_H__) -#include "umem.h" -#endif -#if !defined(__WPACTL_H__) #include "wpactl.h" -#endif -#if !defined(__RF_H__) #include "rf.h" -#endif - /*--------------------- Static Definitions -------------------------*/ @@ -65,12 +46,11 @@ //static int msglevel =MSG_LEVEL_DEBUG; static int msglevel =MSG_LEVEL_INFO; -/*--------------------- Static Functions --------------------------*/ - #ifdef WPA_SM_Transtatus SWPAResult wpa_Result; #endif +/*--------------------- Static Functions --------------------------*/ /*--------------------- Export Variables --------------------------*/ @@ -101,14 +81,13 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; LONG ldBm; - pReq->wResult = 0; switch(pReq->wCmdCode) { case WLAN_CMD_BSS_SCAN: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_BSS_SCAN..begin \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_BSS_SCAN..begin \n"); if (copy_from_user(&sScanCmd, pReq->data, sizeof(SCmdScan))) { result = -EFAULT; break; @@ -214,31 +193,31 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { memcpy(pMgmt->abyDesireSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN); if (sJoinCmd.wBSSType == ADHOC) { pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to adhoc mode\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to adhoc mode\n"); } else { pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to STA mode\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to STA mode\n"); } if (sJoinCmd.bPSEnable == TRUE) { pDevice->ePSMode = WMAC_POWER_FAST; // pDevice->ePSMode = WMAC_POWER_MAX; pMgmt->wListenInterval = 2; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Power Saving On\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Power Saving On\n"); } else { pDevice->ePSMode = WMAC_POWER_CAM; pMgmt->wListenInterval = 1; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Power Saving Off \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Power Saving Off \n"); } if (sJoinCmd.bShareKeyAuth == TRUE){ pMgmt->bShareKeyAlgorithm = TRUE; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Share Key \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Share Key \n"); } else { pMgmt->bShareKeyAlgorithm = FALSE; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Open System \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Open System \n"); } pDevice->uChannel = sJoinCmd.uChannel; netif_stop_queue(pDevice->dev); @@ -250,8 +229,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { break; case WLAN_CMD_SET_WEP: - - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_WEP Key. \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_WEP Key. \n"); memset(&sWEPCmd, 0 ,sizeof(SCmdSetWEP)); if (copy_from_user(&sWEPCmd, pReq->data, sizeof(SCmdSetWEP))) { result = -EFAULT; @@ -261,7 +239,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { pDevice->bEncryptionEnable = FALSE; pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; MACvDisableDefaultKey(pDevice->PortOffset); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WEP function disable. \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WEP function disable. \n"); break; } @@ -293,7 +271,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { break; case WLAN_CMD_GET_LINK: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_GET_LINK status. \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_GET_LINK status. \n"); memset(sLinkStatus.abySSID, 0 , WLAN_SSID_MAXLEN + 1); @@ -314,7 +292,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { memcpy(sLinkStatus.abySSID, pItemSSID->abySSID, pItemSSID->len); memcpy(sLinkStatus.abyBSSID, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); sLinkStatus.uLinkRate = pMgmt->sNodeDBTable[0].wTxDataRate; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Link Success ! \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Link Success ! \n"); } else { sLinkStatus.bLink = FALSE; @@ -409,7 +387,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { break; case WLAN_CMD_STOP_MAC: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_STOP_MAC\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_STOP_MAC\n"); netif_stop_queue(pDevice->dev); spin_lock_irq(&pDevice->lock); @@ -430,7 +408,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { case WLAN_CMD_START_MAC: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_START_MAC\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_START_MAC\n"); if (pDevice->bMACSuspend == TRUE) { if (pDevice->bRadioOff == TRUE) @@ -444,7 +422,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { case WLAN_CMD_SET_HOSTAPD: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOSTAPD\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOSTAPD\n"); if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) { result = -EFAULT; @@ -452,7 +430,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { }; if (sValue.dwValue == 1) { if (hostap_set_hostapd(pDevice, 1, 1) == 0){ - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable HOSTAP\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable HOSTAP\n"); } else { result = -EFAULT; @@ -461,19 +439,19 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { } else { hostap_set_hostapd(pDevice, 0, 1); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable HOSTAP\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable HOSTAP\n"); } break; case WLAN_CMD_SET_HOSTAPD_STA: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOSTAPD_STA\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOSTAPD_STA\n"); break; case WLAN_CMD_SET_802_1X: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_802_1X\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_802_1X\n"); if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) { result = -EFAULT; break; @@ -481,11 +459,11 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { if (sValue.dwValue == 1) { pDevice->bEnable8021x = TRUE; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable 802.1x\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable 802.1x\n"); } else { pDevice->bEnable8021x = FALSE; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable 802.1x\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable 802.1x\n"); } break; @@ -493,7 +471,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { case WLAN_CMD_SET_HOST_WEP: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOST_WEP\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOST_WEP\n"); if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) { result = -EFAULT; break; @@ -501,29 +479,29 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { if (sValue.dwValue == 1) { pDevice->bEnableHostWEP = TRUE; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable HostWEP\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable HostWEP\n"); } else { pDevice->bEnableHostWEP = FALSE; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable HostWEP\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable HostWEP\n"); } break; case WLAN_CMD_SET_WPA: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_WPA\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_WPA\n"); if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) { result = -EFAULT; break; }; if (sValue.dwValue == 1) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "up wpadev\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "up wpadev\n"); memcpy(pDevice->wpadev->dev_addr, pDevice->dev->dev_addr, U_ETHER_ADDR_LEN); pDevice->bWPADEVUp = TRUE; } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "close wpadev\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "close wpadev\n"); pDevice->bWPADEVUp = FALSE; } @@ -531,7 +509,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { case WLAN_CMD_AP_START: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_AP_START\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_AP_START\n"); if (pDevice->bRadioOff == TRUE) { CARDbRadioPowerOn(pDevice); vMgrTimerInit(pDevice); @@ -545,10 +523,10 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { if (sStartAPCmd.wBSSType == AP) { pMgmt->eConfigMode = WMAC_CONFIG_AP; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to AP mode\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to AP mode\n"); } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct BSS type not set to AP mode\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct BSS type not set to AP mode\n"); result = -EFAULT; break; } @@ -578,11 +556,11 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { if (sStartAPCmd.bShareKeyAuth == TRUE){ pMgmt->bShareKeyAlgorithm = TRUE; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Share Key \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Share Key \n"); } else { pMgmt->bShareKeyAlgorithm = FALSE; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Open System \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Open System \n"); } memcpy(pMgmt->abyIBSSSuppRates, abySuppRates, 6); @@ -606,7 +584,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { pMgmt->abyIBSSSuppRates[3] |= BIT7; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Support Rate= %x %x %x %x\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Support Rate= %x %x %x %x\n", pMgmt->abyIBSSSuppRates[2], pMgmt->abyIBSSSuppRates[3], pMgmt->abyIBSSSuppRates[4], @@ -664,7 +642,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { pNodeList->sNodeList[jj].byKeyIndex = pNode->byKeyIndex; pNodeList->sNodeList[jj].wWepKeyLength = pNode->uWepKeyLength; memcpy(&(pNodeList->sNodeList[jj].abyWepKey[0]), &(pNode->abyWepKey[0]), WEP_KEYMAXLEN); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "key= %2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "key= %2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", pNodeList->sNodeList[jj].abyWepKey[0], pNodeList->sNodeList[jj].abyWepKey[1], pNodeList->sNodeList[jj].abyWepKey[2], @@ -695,13 +673,13 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { wpa_Result.key_mgmt = 0; wpa_Result.eap_type = 0; wpa_Result.authenticated = FALSE; - pDevice->fWPA_Authened = FALSE; + pDevice->fWPA_Authened = FALSE; if (copy_from_user(&wpa_Result, pReq->data, sizeof(wpa_Result))) { result = -EFAULT; break; } - if(wpa_Result.authenticated==TRUE) { +if(wpa_Result.authenticated==TRUE) { #ifdef SndEvt_ToAPI { union iwreq_data wrqu; @@ -728,9 +706,8 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { break; #endif - default: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Private command not support..\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Private command not support..\n"); } return result; @@ -748,8 +725,8 @@ vConfigWEPKey ( int ii; - ZERO_MEMORY(&pDevice->abyWepKey[dwKeyIndex][0], WLAN_WEPMAX_KEYLEN); - MEMvCopy(&pDevice->abyWepKey[dwKeyIndex][0], pbyKey, uKeyLength); + memset(&pDevice->abyWepKey[dwKeyIndex][0], 0, WLAN_WEPMAX_KEYLEN); + memcpy(&pDevice->abyWepKey[dwKeyIndex][0], pbyKey, uKeyLength); pDevice->bWepKeyAvailable[dwKeyIndex] = TRUE; pDevice->auWepKeyLength[dwKeyIndex] = uKeyLength; diff --git a/drivers/staging/vt6655/ioctl.h b/drivers/staging/vt6655/ioctl.h index 9c6816e..07d2283 100644 --- a/drivers/staging/vt6655/ioctl.h +++ b/drivers/staging/vt6655/ioctl.h @@ -26,14 +26,10 @@ * */ - #ifndef __IOCTL_H__ #define __IOCTL_H__ -#if !defined(__DEVICE_H__) #include "device.h" -#endif - /*--------------------- Export Definitions -------------------------*/ @@ -44,12 +40,6 @@ /*--------------------- Export Functions --------------------------*/ - -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ - - int private_ioctl(PSDevice pDevice, struct ifreq *rq); /* @@ -61,13 +51,6 @@ VOID vConfigWEPKey ( ); */ -#ifdef __cplusplus -} /* End of extern "C" { */ -#endif /* __cplusplus */ - - - - #endif // __IOCTL_H__ diff --git a/drivers/staging/vt6655/iowpa.h b/drivers/staging/vt6655/iowpa.h index 451e2ef..33ae054 100644 --- a/drivers/staging/vt6655/iowpa.h +++ b/drivers/staging/vt6655/iowpa.h @@ -1,5 +1,6 @@ /* - * Copyright (c) 1996, 2003 VIA Networking, Inc. All rights reserved. + * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. + * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,7 +29,6 @@ #ifndef __IOWPA_H__ #define __IOWPA_H__ - /*--------------------- Export Definitions -------------------------*/ diff --git a/drivers/staging/vt6655/iwctl.c b/drivers/staging/vt6655/iwctl.c index 4d5a1da..108830f 100644 --- a/drivers/staging/vt6655/iwctl.c +++ b/drivers/staging/vt6655/iwctl.c @@ -30,47 +30,21 @@ * */ - -#if !defined(__DEVICE_H__) #include "device.h" -#endif -#if !defined(__IOCTL_H__) #include "ioctl.h" -#endif -#if !defined(__IOCMD_H__) #include "iocmd.h" -#endif -#if !defined(__MAC_H__) #include "mac.h" -#endif -#if !defined(__CARD_H__) #include "card.h" -#endif -#if !defined(__HOSTAP_H__) #include "hostap.h" -#endif -#if !defined(__UMEM_H__) -#include "umem.h" -#endif -#if !defined(__POWER_H__) #include "power.h" -#endif -#if !defined(__RF_H__) #include "rf.h" -#endif #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT -#if !defined(__IOWPA_H__) #include "iowpa.h" -#endif -#if !defined(__WPACTL_H__) #include "wpactl.h" #endif -#endif -#if WIRELESS_EXT > 12 #include <net/iw_handler.h> -#endif extern WORD TxRate_iwconfig;//2008-5-8 <add> by chester /*--------------------- Static Definitions -------------------------*/ @@ -82,8 +56,6 @@ extern WORD TxRate_iwconfig;//2008-5-8 <add> by chester #define SUPPORTED_WIRELESS_EXT 17 #endif -#ifdef WIRELESS_EXT - static const long frequency_list[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2484, 4915, 4920, 4925, 4935, 4940, 4945, 4960, 4980, @@ -92,8 +64,6 @@ static const long frequency_list[] = { 5700, 5745, 5765, 5785, 5805, 5825 }; -#endif - /*--------------------- Static Classes ----------------------------*/ @@ -107,14 +77,11 @@ static int msglevel =MSG_LEVEL_INFO; /*--------------------- Export Variables --------------------------*/ -#ifdef WIRELESS_EXT - -#if WIRELESS_EXT > 12 - struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev) { PSDevice pDevice = netdev_priv(dev); long ldBm; + pDevice->wstats.status = pDevice->eOPMode; #ifdef Calcu_LinkQual #if 0 @@ -156,8 +123,6 @@ struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev) return &pDevice->wstats; } -#endif - /*------------------------------------------------------------------*/ @@ -168,12 +133,11 @@ static int iwctl_commit(struct net_device *dev, void *wrq, char *extra) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWCOMMIT \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWCOMMIT \n"); return 0; } - /* * Wireless Handler : get protocol name */ @@ -198,7 +162,6 @@ int iwctl_giwnwid(struct net_device *dev, //return 0; return -EOPNOTSUPP; } -#if WIRELESS_EXT > 13 /* * Wireless Handler : set scan @@ -210,24 +173,24 @@ int iwctl_siwscan(struct net_device *dev, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); - struct iw_scan_req *req = (struct iw_scan_req *)extra; - PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + PSMgmtObject pMgmt = &(pDevice->sMgmtObj); + struct iw_scan_req *req = (struct iw_scan_req *)extra; BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; PWLAN_IE_SSID pItemSSID=NULL; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSCAN \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSCAN \n"); if(pDevice->byReAssocCount > 0) { //reject scan when re-associating! //send scan event to wpa_Supplicant union iwreq_data wrqu; - printk("wireless_send_event--->SIOCGIWSCAN(scan done)\n"); + PRINT_K("wireless_send_event--->SIOCGIWSCAN(scan done)\n"); memset(&wrqu, 0, sizeof(wrqu)); wireless_send_event(pDevice->dev, SIOCGIWSCAN, &wrqu, NULL); return 0; } spin_lock_irq(&pDevice->lock); - BSSvClearBSSList((HANDLE)pDevice, pDevice->bLinkPass); + BSSvClearBSSList((HANDLE)pDevice, pDevice->bLinkPass); //mike add: active scan OR passive scan OR desire_ssid scan if(wrq->length == sizeof(struct iw_scan_req)) { @@ -243,7 +206,7 @@ if(pDevice->byReAssocCount > 0) { //reject scan when re-associating! else pItemSSID->len = req->essid_len; pMgmt->eScanType = WMAC_SCAN_PASSIVE; - printk("SIOCSIWSCAN:[desired_ssid=%s,len=%d]\n",((PWLAN_IE_SSID)abyScanSSID)->abySSID, + PRINT_K("SIOCSIWSCAN:[desired_ssid=%s,len=%d]\n",((PWLAN_IE_SSID)abyScanSSID)->abySSID, ((PWLAN_IE_SSID)abyScanSSID)->len); bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID); spin_unlock_irq(&pDevice->lock); @@ -259,6 +222,7 @@ if(pDevice->byReAssocCount > 0) { //reject scan when re-associating! } pMgmt->eScanType = WMAC_SCAN_PASSIVE; + //printk("SIOCSIWSCAN:WLAN_CMD_BSSID_SCAN\n"); bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, NULL); spin_unlock_irq(&pDevice->lock); @@ -286,12 +250,10 @@ int iwctl_giwscan(struct net_device *dev, char *current_val = NULL; struct iw_event iwe; long ldBm; -#if WIRELESS_EXT > 14 char buf[MAX_WPA_IE_LEN * 2 + 30]; -#endif /* WIRELESS_EXT > 14 */ - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSCAN \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSCAN \n"); if (pMgmt->eScanState == WMAC_IS_SCANNING) { // In scanning.. @@ -303,18 +265,19 @@ int iwctl_giwscan(struct net_device *dev, break; pBSS = &(pMgmt->sBSSList[jj]); if (pBSS->bActive) { + //ADD mac address memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWAP; iwe.u.ap_addr.sa_family = ARPHRD_ETHER; memcpy(iwe.u.ap_addr.sa_data, pBSS->abyBSSID, WLAN_BSSID_LEN); - current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_ADDR_LEN); + current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_ADDR_LEN); //ADD ssid memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWESSID; pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID; iwe.u.data.length = pItemSSID->len; iwe.u.data.flags = 1; - current_ev = iwe_stream_add_point(info,current_ev,end_buf, &iwe, pItemSSID->abySSID); + current_ev = iwe_stream_add_point(info,current_ev,end_buf, &iwe, pItemSSID->abySSID); //ADD mode memset(&iwe, 0, sizeof(iwe)); iwe.cmd = SIOCGIWMODE; @@ -325,7 +288,7 @@ int iwctl_giwscan(struct net_device *dev, iwe.u.mode = IW_MODE_ADHOC; } iwe.len = IW_EV_UINT_LEN; - current_ev = iwe_stream_add_event(info,current_ev, end_buf, &iwe, IW_EV_UINT_LEN); + current_ev = iwe_stream_add_event(info,current_ev, end_buf, &iwe, IW_EV_UINT_LEN); //ADD frequency pSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abySuppRates; pExtSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abyExtSuppRates; @@ -334,9 +297,7 @@ int iwctl_giwscan(struct net_device *dev, iwe.u.freq.m = pBSS->uChannel; iwe.u.freq.e = 0; iwe.u.freq.i = 0; - current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN); - - + current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN); //2008-0409-04, <Add> by Einsn Liu { int f = (int)pBSS->uChannel - 1; @@ -344,7 +305,7 @@ int iwctl_giwscan(struct net_device *dev, iwe.u.freq.m = frequency_list[f] * 100000; iwe.u.freq.e = 1; } - current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN); + current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN); //ADD quality memset(&iwe, 0, sizeof(iwe)); iwe.cmd = IWEVQUAL; @@ -384,27 +345,25 @@ int iwctl_giwscan(struct net_device *dev, break; // Bit rate given in 500 kb/s units (+ 0x80) iwe.u.bitrate.value = ((pSuppRates->abyRates[kk] & 0x7f) * 500000); - current_val = iwe_stream_add_value(info,current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); - } + current_val = iwe_stream_add_value(info,current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); + } for (kk = 0 ; kk < 8 ; kk++) { if (pExtSuppRates->abyRates[kk] == 0) break; // Bit rate given in 500 kb/s units (+ 0x80) iwe.u.bitrate.value = ((pExtSuppRates->abyRates[kk] & 0x7f) * 500000); - current_val = iwe_stream_add_value(info,current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); + current_val = iwe_stream_add_value(info,current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); } if((current_val - current_ev) > IW_EV_LCP_LEN) current_ev = current_val; -#if WIRELESS_EXT > 14 memset(&iwe, 0, sizeof(iwe)); iwe.cmd = IWEVCUSTOM; sprintf(buf, "bcn_int=%d", pBSS->wBeaconInterval); iwe.u.data.length = strlen(buf); - current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, buf); + current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, buf); -#if WIRELESS_EXT > 17 if ((pBSS->wWPALen > 0) && (pBSS->wWPALen <= MAX_WPA_IE_LEN)) { memset(&iwe, 0, sizeof(iwe)); iwe.cmd = IWEVGENIE; @@ -419,33 +378,6 @@ int iwctl_giwscan(struct net_device *dev, current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, pBSS->byRSNIE); } -#else // WIRELESS_EXT > 17 - if ((pBSS->wWPALen > 0) && (pBSS->wWPALen <= MAX_WPA_IE_LEN)) { - u8 *p = buf; - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVCUSTOM; - p += sprintf(p, "wpa_ie="); - for (ii = 0; ii < pBSS->wWPALen; ii++) { - p += sprintf(p, "%02x", pBSS->byWPAIE[ii]); - } - iwe.u.data.length = strlen(buf); - current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, buf); - } - - - if ((pBSS->wRSNLen > 0) && (pBSS->wRSNLen <= MAX_WPA_IE_LEN)) { - u8 *p = buf; - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVCUSTOM; - p += sprintf(p, "rsn_ie="); - for (ii = 0; ii < pBSS->wRSNLen; ii++) { - p += sprintf(p, "%02x", pBSS->byRSNIE[ii]); - } - iwe.u.data.length = strlen(buf); - current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, buf); - } -#endif -#endif } }// for @@ -454,8 +386,6 @@ int iwctl_giwscan(struct net_device *dev, } -#endif /* WIRELESS_EXT > 13 */ - /* * Wireless Handler : set frequence or channel @@ -469,7 +399,7 @@ int iwctl_siwfreq(struct net_device *dev, PSDevice pDevice = (PSDevice)netdev_priv(dev); int rc = 0; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n"); // If setting by frequency, convert to a channel if((wrq->e == 1) && @@ -488,11 +418,11 @@ int iwctl_siwfreq(struct net_device *dev, else { int channel = wrq->m; if((channel < 1) || (channel > 14)) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: New channel value of %d is invalid!\n", dev->name, wrq->m); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: New channel value of %d is invalid!\n", dev->name, wrq->m); rc = -EINVAL; } else { // Yes ! We can set it !!! - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set to channel = %d\n", channel); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set to channel = %d\n", channel); pDevice->uChannel = channel; //2007-0207-04,<Add> by EinsnLiu //Make change effect at once @@ -515,7 +445,7 @@ int iwctl_giwfreq(struct net_device *dev, PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ \n"); #ifdef WEXT_USECHANNELS wrq->m = (int)pMgmt->uCurrChannel; @@ -546,10 +476,10 @@ int iwctl_siwmode(struct net_device *dev, PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int rc = 0; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMODE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMODE \n"); if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP && pDevice->bEnableHostapd) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Can't set operation mode, hostapd is running \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Can't set operation mode, hostapd is running \n"); return rc; } @@ -562,7 +492,7 @@ int iwctl_siwmode(struct net_device *dev, pDevice->bCommit = TRUE; } } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to ad-hoc \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to ad-hoc \n"); break; case IW_MODE_AUTO: case IW_MODE_INFRA: @@ -572,7 +502,7 @@ int iwctl_siwmode(struct net_device *dev, pDevice->bCommit = TRUE; } } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to infrastructure \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to infrastructure \n"); break; case IW_MODE_MASTER: @@ -586,7 +516,7 @@ int iwctl_siwmode(struct net_device *dev, pDevice->bCommit = TRUE; } } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to Access Point \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to Access Point \n"); break; case IW_MODE_REPEAT: @@ -613,7 +543,7 @@ int iwctl_giwmode(struct net_device *dev, PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE \n"); // If not managed, assume it's ad-hoc switch (pMgmt->eConfigMode) { case WMAC_CONFIG_ESS_STA: @@ -650,7 +580,7 @@ int iwctl_giwrange(struct net_device *dev, BYTE abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90}; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRANGE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRANGE \n"); if (wrq->pointer) { wrq->length = sizeof(struct iw_range); memset(range, 0, sizeof(struct iw_range)); @@ -708,12 +638,9 @@ int iwctl_giwrange(struct net_device *dev, // 4 keys are allowed range->max_encoding_tokens = 4; -#if WIRELESS_EXT > 17 range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; -#endif -#if WIRELESS_EXT > 9 range->min_pmp = 0; range->max_pmp = 1000000;// 1 secs range->min_pmt = 0; @@ -727,8 +654,6 @@ int iwctl_giwrange(struct net_device *dev, range->txpower[0] = 100; range->num_txpower = 1; range->txpower_capa = IW_TXPOW_MWATT; -#endif // WIRELESS_EXT > 9 -#if WIRELESS_EXT > 10 range->we_version_source = SUPPORTED_WIRELESS_EXT; range->we_version_compiled = WIRELESS_EXT; range->retry_capa = IW_RETRY_LIMIT | IW_RETRY_LIFETIME; @@ -738,15 +663,12 @@ int iwctl_giwrange(struct net_device *dev, range->max_retry = 65535; range->min_r_time = 1024; range->max_r_time = 65535 * 1024; -#endif // WIRELESS_EXT > 10 -#if WIRELESS_EXT > 11 // Experimental measurements - boundary 11/5.5 Mb/s // Note : with or without the (local->rssi), results // are somewhat different. - Jean II range->avg_qual.qual = 6; range->avg_qual.level = 176; // -80 dBm range->avg_qual.noise = 0; -#endif // WIRELESS_EXT > 11 } @@ -766,9 +688,9 @@ int iwctl_siwap(struct net_device *dev, PSDevice pDevice = (PSDevice)netdev_priv(dev); PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int rc = 0; - BYTE ZeroBSSID[WLAN_BSSID_LEN]={0x00,0x00,0x00,0x00,0x00,0x00}; + BYTE ZeroBSSID[WLAN_BSSID_LEN]={0x00,0x00,0x00,0x00,0x00,0x00}; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAP \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAP \n"); if (pMgmt->eScanState == WMAC_IS_SCANNING) { // In scanning.. printk("SIOCSIWAP(??)-->In scanning...\n"); @@ -787,7 +709,7 @@ if (pMgmt->eScanState == WMAC_IS_SCANNING) { //mike :add if ((IS_BROADCAST_ADDRESS(pMgmt->abyDesireBSSID)) || (memcmp(pMgmt->abyDesireBSSID, ZeroBSSID, 6) == 0)){ - printk("SIOCSIWAP:invalid desired BSSID return!\n"); + PRINT_K("SIOCSIWAP:invalid desired BSSID return!\n"); return rc; } //mike add: if desired AP is hidden ssid(there are two same BSSID in list), @@ -801,10 +723,11 @@ if (pMgmt->eScanState == WMAC_IS_SCANNING) { } } if(uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!! - printk("SIOCSIWAP:ignore for desired AP in hidden mode\n"); + PRINT_K("SIOCSIWAP:ignore for desired AP in hidden mode\n"); return rc; } } + if (pDevice->flags & DEVICE_FLAGS_OPENED) { pDevice->bCommit = TRUE; } @@ -825,7 +748,7 @@ int iwctl_giwap(struct net_device *dev, PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP \n"); memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6); //2008-0410,<Modify> by Einsn Liu @@ -859,7 +782,7 @@ int iwctl_giwaplist(struct net_device *dev, PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAPLIST \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAPLIST \n"); // Only super-user can see AP list if (!capable(CAP_NET_ADMIN)) { @@ -911,7 +834,7 @@ int iwctl_siwessid(struct net_device *dev, BYTE len; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWESSID \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWESSID \n"); pDevice->fWPA_Authened = FALSE; if (pMgmt->eScanState == WMAC_IS_SCANNING) { // In scanning.. @@ -921,10 +844,9 @@ if (pMgmt->eScanState == WMAC_IS_SCANNING) { // Check if we asked for `any' if(wrq->flags == 0) { // Just send an empty SSID list - // Just send an empty SSID list memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); memset(pMgmt->abyDesireBSSID, 0xFF,6); - printk("set essid to 'any' \n"); + PRINT_K("set essid to 'any' \n"); #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT //Unknown desired AP,so here need not associate?? //if(pDevice->bWPASuppWextEnabled == TRUE) { @@ -936,8 +858,9 @@ if (pMgmt->eScanState == WMAC_IS_SCANNING) { memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; pItemSSID->byElementID = WLAN_EID_SSID; + memcpy(pItemSSID->abySSID, extra, wrq->length); - if (pItemSSID->abySSID[wrq->length - 1] == '\0') { + if (pItemSSID->abySSID[wrq->length - 1] == '\0') { if(wrq->length>0) pItemSSID->len = wrq->length - 1; } @@ -950,7 +873,7 @@ if (pMgmt->eScanState == WMAC_IS_SCANNING) { (memcmp(pItemSSID->abySSID,((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID,len)==0)) return 0; - //mike:need clear desiredBSSID + //mike:need clear desiredBSSID if(pItemSSID->len==0) { memset(pMgmt->abyDesireBSSID, 0xFF,6); return 0; @@ -975,7 +898,7 @@ if (pMgmt->eScanState == WMAC_IS_SCANNING) { ); if (pCurr == NULL){ - printk("SIOCSIWESSID:hidden ssid site survey before associate.......\n"); + PRINT_K("SIOCSIWESSID:hidden ssid site survey before associate.......\n"); vResetCommandTimer((HANDLE) pDevice); pMgmt->eScanType = WMAC_SCAN_ACTIVE; bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); @@ -1002,16 +925,7 @@ if (pMgmt->eScanState == WMAC_IS_SCANNING) { } #endif - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s \n", pItemSSID->abySSID); -/* - #if WIRELESS_EXT < 21 - DEVICE_PRT(MSG_LEVEL_INFO, KERN_INFO " SIOCSIWESSID1 \n"); - pItemSSID->len = wrq->length - 1; - #else - DEVICE_PRT(MSG_LEVEL_INFO, KERN_INFO " SIOCSIWESSID2 \n"); - pItemSSID->len = wrq->length; - #endif - */ + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s \n", pItemSSID->abySSID); } if (pDevice->flags & DEVICE_FLAGS_OPENED) { @@ -1037,7 +951,7 @@ int iwctl_giwessid(struct net_device *dev, PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PWLAN_IE_SSID pItemSSID; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWESSID \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWESSID \n"); // Note : if wrq->u.data.flags != 0, we should // get the relevant SSID from the SSID list... @@ -1049,11 +963,7 @@ int iwctl_giwessid(struct net_device *dev, extra[pItemSSID->len] = '\0'; wrq->length = pItemSSID->len + 1; //2008-0409-03, <Add> by Einsn Liu - #if WIRELESS_EXT < 21 - wrq->length = pItemSSID->len + 1; - #else wrq->length = pItemSSID->len; - #endif wrq->flags = 1; // active @@ -1076,7 +986,7 @@ int iwctl_siwrate(struct net_device *dev, BYTE abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90}; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRATE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRATE \n"); if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) { rc = -EINVAL; return rc; @@ -1127,12 +1037,11 @@ int iwctl_siwrate(struct net_device *dev, printk("Rate Fix\n"); pDevice->bFixRate = TRUE; if ((pDevice->byBBType == BB_TYPE_11B)&& (brate > 3)) { - - pDevice->uConnectionRate = 3; + pDevice->uConnectionRate = 3; } else { pDevice->uConnectionRate = brate; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d \n", pDevice->uConnectionRate); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d \n", pDevice->uConnectionRate); } } @@ -1140,7 +1049,7 @@ int iwctl_siwrate(struct net_device *dev, pDevice->bFixRate = FALSE; pDevice->uConnectionRate = 13; printk("auto rate:connection_rate is 13\n"); -} + } return rc; } @@ -1159,7 +1068,7 @@ int iwctl_giwrate(struct net_device *dev, //Mark the unnecessary sentences. // PSMgmtObject pMgmt = &(pDevice->sMgmtObj); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE \n"); { BYTE abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90}; int brate = 0; @@ -1223,7 +1132,7 @@ int iwctl_siwrts(struct net_device *dev, PSDevice pDevice = (PSDevice)netdev_priv(dev); int rc = 0; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRTS \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRTS \n"); { int rthr = wrq->value; @@ -1250,7 +1159,7 @@ int iwctl_giwrts(struct net_device *dev, { PSDevice pDevice = (PSDevice)netdev_priv(dev); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS \n"); wrq->value = pDevice->wRTSThreshold; wrq->disabled = (wrq->value >= 2312); wrq->fixed = 1; @@ -1272,7 +1181,7 @@ int iwctl_siwfrag(struct net_device *dev, int fthr = wrq->value; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFRAG \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFRAG \n"); if (wrq->disabled) @@ -1298,7 +1207,7 @@ int iwctl_giwfrag(struct net_device *dev, { PSDevice pDevice = (PSDevice)netdev_priv(dev); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG \n"); wrq->value = pDevice->wFragmentationThreshold; wrq->disabled = (wrq->value >= 2312); wrq->fixed = 1; @@ -1320,7 +1229,7 @@ int iwctl_siwretry(struct net_device *dev, int rc = 0; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRETRY \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRETRY \n"); if (wrq->disabled) { rc = -EINVAL; @@ -1355,7 +1264,7 @@ int iwctl_giwretry(struct net_device *dev, char *extra) { PSDevice pDevice = (PSDevice)netdev_priv(dev); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY \n"); wrq->disabled = 0; // Can't be disabled // Note : by default, display the min retry number @@ -1402,7 +1311,7 @@ int iwctl_siwencode(struct net_device *dev, PSKeyTable pkeytab; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE \n"); if((wrq->flags & IW_ENCODE_DISABLED)==0){ //Not disable encryption @@ -1429,13 +1338,13 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){ if(wrq->length>0){//have key if (wrq->length == WLAN_WEP232_KEYLEN) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n"); } else if (wrq->length == WLAN_WEP104_KEYLEN) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n"); } else if (wrq->length == WLAN_WEP40_KEYLEN) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex); }else {//no support length rc = -EINVAL; return rc; @@ -1443,9 +1352,9 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){ memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN); memcpy(pDevice->abyKey, extra, wrq->length); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyKey: "); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyKey: "); for (ii = 0; ii < wrq->length; ii++) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]); } if (pDevice->flags & DEVICE_FLAGS_OPENED) { @@ -1475,10 +1384,10 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){ rc = -EINVAL; return rc; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Just set Default key Index:\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Just set Default key Index:\n"); pkeytab=&(pDevice->sKey.KeyTable[MAX_KEY_TABLE-1]); if(pkeytab->GroupKey[(BYTE)dwKeyIndex].uKeyLength==0){ - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Default key len is 0\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Default key len is 0\n"); rc = -EINVAL; return rc; } @@ -1488,7 +1397,7 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){ } }else {//disable the key - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n"); if(pDevice->bEncryptionEnable==FALSE) return 0; pMgmt->bShareKeyAlgorithm = FALSE; @@ -1504,7 +1413,7 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){ //End Modify,Einsn /* - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE \n"); // Check the size of the key if (wrq->length > WLAN_WEP232_KEYLEN) { @@ -1524,20 +1433,20 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){ if (wrq->length > 0) { if (wrq->length == WLAN_WEP232_KEYLEN) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n"); } else if (wrq->length == WLAN_WEP104_KEYLEN) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n"); } else if (wrq->length == WLAN_WEP40_KEYLEN) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex); } memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN); memcpy(pDevice->abyKey, extra, wrq->length); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyKey: "); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyKey: "); for (ii = 0; ii < wrq->length; ii++) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]); } if (pDevice->flags & DEVICE_FLAGS_OPENED) { @@ -1571,7 +1480,7 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){ // Read the flags if(wrq->flags & IW_ENCODE_DISABLED){ - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n"); pMgmt->bShareKeyAlgorithm = FALSE; pDevice->bEncryptionEnable = FALSE; pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; @@ -1585,11 +1494,11 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){ */ if(wrq->flags & IW_ENCODE_RESTRICTED) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & ShareKey System\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & ShareKey System\n"); pMgmt->bShareKeyAlgorithm = TRUE; } if(wrq->flags & IW_ENCODE_OPEN) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & Open System\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & Open System\n"); pMgmt->bShareKeyAlgorithm = FALSE; } return rc; @@ -1611,7 +1520,7 @@ int iwctl_giwencode(struct net_device *dev, UINT index = (UINT)(wrq->flags & IW_ENCODE_INDEX); PSKeyItem pKey = NULL; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODE\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODE\n"); //2007-0207-06,<Add> by EinsnLiu //the key index in iwconfig is 1-4 when our driver is 0-3 //so it can't be used directly. @@ -1680,7 +1589,7 @@ int iwctl_giwencode(struct net_device *dev, UINT index = (UINT)(wrq->flags & IW_ENCODE_INDEX); PSKeyItem pKey = NULL; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODE\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODE\n"); if (index > WLAN_WEP_NKEYS) { return -EINVAL; @@ -1726,6 +1635,7 @@ int iwctl_giwencode(struct net_device *dev, return 0; } + /* * Wireless Handler : set power mode */ @@ -1738,7 +1648,7 @@ int iwctl_siwpower(struct net_device *dev, PSMgmtObject pMgmt = &(pDevice->sMgmtObj); int rc = 0; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER \n"); if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) { rc = -EINVAL; @@ -1760,14 +1670,14 @@ int iwctl_siwpower(struct net_device *dev, } switch (wrq->flags & IW_POWER_MODE) { case IW_POWER_UNICAST_R: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_UNICAST_R \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_UNICAST_R \n"); rc = -EINVAL; break; case IW_POWER_ALL_R: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ALL_R \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ALL_R \n"); rc = -EINVAL; case IW_POWER_ON: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ON \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ON \n"); break; default: rc = -EINVAL; @@ -1789,7 +1699,7 @@ int iwctl_giwpower(struct net_device *dev, int mode = pDevice->ePSMode; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPOWER \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPOWER \n"); if ((wrq->disabled = (mode == WMAC_POWER_CAM))) @@ -1819,7 +1729,7 @@ int iwctl_giwsens(struct net_device *dev, PSDevice pDevice = (PSDevice)netdev_priv(dev); long ldBm; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS \n"); if (pDevice->bLinkPass == TRUE) { RFvRSSITodBm(pDevice, (BYTE)(pDevice->uCurrRSSI), &ldBm); wrq->value = ldBm; @@ -1848,25 +1758,24 @@ int iwctl_siwauth(struct net_device *dev, static int wpa_version=0; //must be static to save the last value,einsn liu static int pairwise=0; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH \n"); switch (wrq->flags & IW_AUTH_INDEX) { case IW_AUTH_WPA_VERSION: wpa_version = wrq->value; if(wrq->value == IW_AUTH_WPA_VERSION_DISABLED) { - printk("iwctl_siwauth:set WPADEV to disable at 1??????\n"); + PRINT_K("iwctl_siwauth:set WPADEV to disable at 1??????\n"); //pDevice->bWPADevEnable = FALSE; } else if(wrq->value == IW_AUTH_WPA_VERSION_WPA) { - printk("iwctl_siwauth:set WPADEV to WPA1******\n"); + PRINT_K("iwctl_siwauth:set WPADEV to WPA1******\n"); } else { - printk("iwctl_siwauth:set WPADEV to WPA2******\n"); + PRINT_K("iwctl_siwauth:set WPADEV to WPA2******\n"); } //pDevice->bWPASuppWextEnabled =TRUE; break; case IW_AUTH_CIPHER_PAIRWISE: pairwise = wrq->value; - if(pairwise == IW_AUTH_CIPHER_CCMP){ pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; }else if(pairwise == IW_AUTH_CIPHER_TKIP){ @@ -1940,13 +1849,13 @@ int iwctl_siwauth(struct net_device *dev, break; } /* - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_version = %d\n",wpa_version); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pairwise = %d\n",pairwise); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->eEncryptionStatus = %d\n",pDevice->eEncryptionStatus); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->eAuthenMode = %d\n",pMgmt->eAuthenMode); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->bShareKeyAlgorithm = %s\n",pMgmt->bShareKeyAlgorithm?"TRUE":"FALSE"); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->bEncryptionEnable = %s\n",pDevice->bEncryptionEnable?"TRUE":"FALSE"); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->bWPADevEnable = %s\n",pDevice->bWPADevEnable?"TRUE":"FALSE"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_version = %d\n",wpa_version); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pairwise = %d\n",pairwise); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->eEncryptionStatus = %d\n",pDevice->eEncryptionStatus); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->eAuthenMode = %d\n",pMgmt->eAuthenMode); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->bShareKeyAlgorithm = %s\n",pMgmt->bShareKeyAlgorithm?"TRUE":"FALSE"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->bEncryptionEnable = %s\n",pDevice->bEncryptionEnable?"TRUE":"FALSE"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->bWPADevEnable = %s\n",pDevice->bWPADevEnable?"TRUE":"FALSE"); */ return ret; } @@ -2031,10 +1940,10 @@ int iwctl_siwencodeext(struct net_device *dev, //original member wpa_alg alg_name; u8 addr[6]; - int key_idx, set_tx; + int key_idx, set_tx=0; u8 seq[IW_ENCODE_SEQ_MAX_SIZE]; u8 key[64]; - size_t seq_len,key_len=0; + size_t seq_len=0,key_len=0; // // int ii; u8 *buf; @@ -2042,7 +1951,7 @@ int iwctl_siwencodeext(struct net_device *dev, u8 key_array[64]; int ret=0; -printk("SIOCSIWENCODEEXT...... \n"); +PRINT_K("SIOCSIWENCODEEXT...... \n"); blen = sizeof(*param); buf = kmalloc((int)blen, (int)GFP_KERNEL); @@ -2066,7 +1975,7 @@ switch (ext->alg) { alg_name = WPA_ALG_CCMP; break; default: - printk("Unknown alg = %d\n",ext->alg); + PRINT_K("Unknown alg = %d\n",ext->alg); ret= -ENOMEM; goto error; } @@ -2109,7 +2018,6 @@ param->u.wpa_key.seq = (u8 *)seq; param->u.wpa_key.seq_len = seq_len; #if 0 -int ii; printk("param->u.wpa_key.alg_name =%d\n",param->u.wpa_key.alg_name); printk("param->addr=%02x:%02x:%02x:%02x:%02x:%02x\n", param->addr[0],param->addr[1],param->addr[2], @@ -2217,8 +2125,6 @@ int iwctl_siwmlme(struct net_device *dev, */ -#if WIRELESS_EXT > 12 - /* static const iw_handler iwctl_handler[] = { @@ -2246,13 +2152,8 @@ static const iw_handler iwctl_handler[] = (iw_handler) iwctl_giwap, // SIOCGIWAP (iw_handler) NULL, // -- hole -- 0x16 (iw_handler) iwctl_giwaplist, // SIOCGIWAPLIST -#if WIRELESS_EXT > 13 (iw_handler) iwctl_siwscan, // SIOCSIWSCAN (iw_handler) iwctl_giwscan, // SIOCGIWSCAN -#else - (iw_handler) NULL, - (iw_handler) NULL, -#endif (iw_handler) iwctl_siwessid, // SIOCSIWESSID (iw_handler) iwctl_giwessid, // SIOCGIWESSID (iw_handler) NULL, // SIOCSIWNICKN @@ -2273,7 +2174,6 @@ static const iw_handler iwctl_handler[] = (iw_handler) iwctl_giwencode, // SIOCGIWENCODE (iw_handler) iwctl_siwpower, // SIOCSIWPOWER (iw_handler) iwctl_giwpower, // SIOCGIWPOWER -#if WIRELESS_EXT > 17 (iw_handler) NULL, // -- hole -- (iw_handler) NULL, // -- hole -- (iw_handler) iwctl_siwgenie, // SIOCSIWGENIE @@ -2284,7 +2184,6 @@ static const iw_handler iwctl_handler[] = (iw_handler) iwctl_giwencodeext, // SIOCGIWENCODEEXT (iw_handler) NULL, // SIOCSIWPMKSA (iw_handler) NULL, // -- hole -- -#endif // WIRELESS_EXT > 17 }; */ @@ -2315,13 +2214,8 @@ static const iw_handler iwctl_handler[] = (iw_handler) NULL, // SIOCGIWAP (iw_handler) NULL, // -- hole -- 0x16 (iw_handler) NULL, // SIOCGIWAPLIST -#if WIRELESS_EXT > 13 (iw_handler) iwctl_siwscan, // SIOCSIWSCAN (iw_handler) iwctl_giwscan, // SIOCGIWSCAN -#else - (iw_handler) NULL, - (iw_handler) NULL, -#endif (iw_handler) NULL, // SIOCSIWESSID (iw_handler) NULL, // SIOCGIWESSID (iw_handler) NULL, // SIOCSIWNICKN @@ -2344,7 +2238,6 @@ static const iw_handler iwctl_handler[] = (iw_handler) NULL, // SIOCGIWPOWER //2008-0409-07, <Add> by Einsn Liu -#if WIRELESS_EXT > 17 (iw_handler) NULL, // -- hole -- (iw_handler) NULL, // -- hole -- (iw_handler) NULL, // SIOCSIWGENIE @@ -2355,7 +2248,6 @@ static const iw_handler iwctl_handler[] = (iw_handler) NULL, // SIOCGIWENCODEEXT (iw_handler) NULL, // SIOCSIWPMKSA (iw_handler) NULL, // -- hole -- -#endif // WIRELESS_EXT > 17 }; @@ -2375,9 +2267,7 @@ struct iw_priv_args iwctl_private_args[] = { const struct iw_handler_def iwctl_handler_def = { -#if WIRELESS_EXT > 16 .get_wireless_stats = &iwctl_get_wireless_stats, -#endif .num_standard = sizeof(iwctl_handler)/sizeof(iw_handler), // .num_private = sizeof(iwctl_private_handler)/sizeof(iw_handler), // .num_private_args = sizeof(iwctl_private_args)/sizeof(struct iw_priv_args), @@ -2389,9 +2279,3 @@ const struct iw_handler_def iwctl_handler_def = .private = NULL, .private_args = NULL, }; - - -#endif // WIRELESS_EXT > 12 - - -#endif // WIRELESS_EXT diff --git a/drivers/staging/vt6655/iwctl.h b/drivers/staging/vt6655/iwctl.h index 07554e1..3096de0 100644 --- a/drivers/staging/vt6655/iwctl.h +++ b/drivers/staging/vt6655/iwctl.h @@ -26,14 +26,10 @@ * */ - #ifndef __IWCTL_H__ #define __IWCTL_H__ -#if !defined(__DEVICE_H__) #include "device.h" -#endif - /*--------------------- Export Definitions -------------------------*/ @@ -44,93 +40,6 @@ /*--------------------- Export Functions --------------------------*/ - -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ - - -#if WIRELESS_EXT < 18 - - -#define SIOCSIWMLME 0x8B16 -#define SIOCSIWGENIE 0x8B30 - -// WPA : Authentication mode parameters -#define SIOCSIWAUTH 0x8B32 -#define SIOCGIWAUTH 0x8B33 - -// WPA : Extended version of encoding configuration -#define SIOCSIWENCODEEXT 0x8B34 -#define SIOCGIWENCODEEXT 0x8B35 - -#define IW_AUTH_WPA_VERSION 0 -#define IW_AUTH_CIPHER_PAIRWISE 1 -#define IW_AUTH_CIPHER_GROUP 2 -#define IW_AUTH_KEY_MGMT 3 -#define IW_AUTH_TKIP_COUNTERMEASURES 4 -#define IW_AUTH_DROP_UNENCRYPTED 5 -#define IW_AUTH_80211_AUTH_ALG 6 -#define IW_AUTH_WPA_ENABLED 7 -#define IW_AUTH_RX_UNENCRYPTED_EAPOL 8 -#define IW_AUTH_ROAMING_CONTROL 9 -#define IW_AUTH_PRIVACY_INVOKED 10 - -#define IW_AUTH_WPA_VERSION_DISABLED 0x00000001 -#define IW_AUTH_WPA_VERSION_WPA 0x00000002 -#define IW_AUTH_WPA_VERSION_WPA2 0x00000004 - -#define IW_AUTH_CIPHER_NONE 0x00000001 -#define IW_AUTH_CIPHER_WEP40 0x00000002 -#define IW_AUTH_CIPHER_TKIP 0x00000004 -#define IW_AUTH_CIPHER_CCMP 0x00000008 -#define IW_AUTH_CIPHER_WEP104 0x00000010 - -#define IW_AUTH_KEY_MGMT_802_1X 1 -#define IW_AUTH_KEY_MGMT_PSK 2 - -#define IW_AUTH_ALG_OPEN_SYSTEM 0x00000001 -#define IW_AUTH_ALG_SHARED_KEY 0x00000002 -#define IW_AUTH_ALG_LEAP 0x00000004 - -#define IW_AUTH_ROAMING_ENABLE 0 -#define IW_AUTH_ROAMING_DISABLE 1 - -#define IW_ENCODE_SEQ_MAX_SIZE 8 - -#define IW_ENCODE_ALG_NONE 0 -#define IW_ENCODE_ALG_WEP 1 -#define IW_ENCODE_ALG_TKIP 2 -#define IW_ENCODE_ALG_CCMP 3 - - -struct iw_encode_ext -{ - __u32 ext_flags; // IW_ENCODE_EXT_* - __u8 tx_seq[IW_ENCODE_SEQ_MAX_SIZE]; // LSB first - __u8 rx_seq[IW_ENCODE_SEQ_MAX_SIZE]; // LSB first - struct sockaddr addr; // ff:ff:ff:ff:ff:ff for broadcast/multicast - // (group) keys or unicast address for - // individual keys - __u16 alg; // IW_ENCODE_ALG_* - __u16 key_len; - __u8 key[0]; -}; - - -struct iw_mlme -{ - __u16 cmd; /* IW_MLME_* */ - __u16 reason_code; - struct sockaddr addr; -}; - -#endif // WIRELESS_EXT < 18 - - - -#ifdef WIRELESS_EXT - struct iw_statistics *iwctl_get_wireless_stats (struct net_device *dev); @@ -308,23 +217,11 @@ int iwctl_siwmlme(struct net_device *dev, struct iw_point *wrq, char *extra); #endif // #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT +//End Add -- //2008-0409-07, <Add> by Einsn Liu -#endif - -#if WIRELESS_EXT > 12 extern const struct iw_handler_def iwctl_handler_def; extern const struct iw_priv_args iwctl_private_args; -#else -struct iw_request_info {}; -#endif //WIRELESS_EXT > 12 - -#ifdef __cplusplus -} /* End of extern "C" { */ -#endif /* __cplusplus */ - - - #endif // __IWCTL_H__ diff --git a/drivers/staging/vt6655/kcompat.h b/drivers/staging/vt6655/kcompat.h index 652c2c7..2cf634c 100644 --- a/drivers/staging/vt6655/kcompat.h +++ b/drivers/staging/vt6655/kcompat.h @@ -1,6 +1,5 @@ /* - * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. - * All rights reserved. + * Copyright (c) 1996, 2003 VIA Networking, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,59 +25,15 @@ * Date: Apr 8, 2002 * */ + #ifndef _KCOMPAT_H #define _KCOMPAT_H #include <linux/version.h> -#ifndef __init -#define __init -#endif - -#ifndef __exit -#define __exit -#endif - -#ifndef __devexit -#define __devexit -#endif - -#ifndef __devinitdata -#define __devinitdata -#endif - -#ifndef MODULE_LICENSE -#define MODULE_LICENSE(license) -#endif - -#ifndef MOD_INC_USE_COUNT -#define MOD_INC_USE_COUNT do {} while (0) -#endif - -#ifndef MOD_DEC_USE_COUNT -#define MOD_DEC_USE_COUNT do {} while (0) -#endif - #ifndef HAVE_NETDEV_PRIV #define netdev_priv(dev) (dev->priv) #endif -#ifndef IRQ_RETVAL -typedef void irqreturn_t; - -#ifdef PRIVATE_OBJ -#define IRQ_RETVAL(x) (int)x -#else -#define IRQ_RETVAL(x) -#endif - -#endif - - -#ifndef MODULE_LICESEN -#define MODULE_LICESEN(x) -#endif - - #endif diff --git a/drivers/staging/vt6655/key.c b/drivers/staging/vt6655/key.c index 168ebd3..a4d2184 100644 --- a/drivers/staging/vt6655/key.c +++ b/drivers/staging/vt6655/key.c @@ -36,23 +36,9 @@ * */ - -#if !defined(__TMACRO_H__) #include "tmacro.h" -#endif -#if !defined(__TBIT_H__) -#include "tbit.h" -#endif -#if !defined(__KEY_H__) #include "key.h" -#endif -#if !defined(__UMEM_H__) -#include "umem.h" -#endif -#if !defined(__MAC_H__) #include "mac.h" -#endif - /*--------------------- Static Definitions -------------------------*/ @@ -85,6 +71,7 @@ s_vCheckKeyTableValid (PSKeyManagement pTable, DWORD_PTR dwIoBase) (pTable->KeyTable[i].GroupKey[2].bKeyValid == FALSE) && (pTable->KeyTable[i].GroupKey[3].bKeyValid == FALSE) ) { + pTable->KeyTable[i].bInUse = FALSE; pTable->KeyTable[i].wKeyCtl = 0; pTable->KeyTable[i].bSoftWEP = FALSE; @@ -153,7 +140,7 @@ BOOL KeybGetKey ( { int i; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybGetKey() \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybGetKey() \n"); *pKey = NULL; for (i=0;i<MAX_KEY_TABLE;i++) { @@ -219,7 +206,7 @@ BOOL KeybSetKey ( PSKeyItem pKey; UINT uKeyIdx; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetKey: %lX\n", dwKeyIndex); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetKey: %lX\n", dwKeyIndex); j = (MAX_KEY_TABLE-1); for (i=0;i<(MAX_KEY_TABLE-1);i++) { @@ -245,7 +232,7 @@ BOOL KeybSetKey ( if ((dwKeyIndex & TRANSMIT_KEY) != 0) { // Group transmit key pTable->KeyTable[i].dwGTKeyIndex = dwKeyIndex; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Group transmit key(R)[%lX]: %d\n", pTable->KeyTable[i].dwGTKeyIndex, i); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Group transmit key(R)[%lX]: %d\n", pTable->KeyTable[i].dwGTKeyIndex, i); } pTable->KeyTable[i].wKeyCtl &= 0xFF0F; // clear group key control filed pTable->KeyTable[i].wKeyCtl |= (byKeyDecMode << 4); @@ -258,7 +245,7 @@ BOOL KeybSetKey ( pKey->uKeyLength = uKeyLength; pKey->dwKeyIndex = dwKeyIndex; pKey->byCipherSuite = byKeyDecMode; - MEMvCopy(pKey->abyKey, pbyKey, uKeyLength); + memcpy(pKey->abyKey, pbyKey, uKeyLength); if (byKeyDecMode == KEY_CTL_WEP) { if (uKeyLength == WLAN_WEP40_KEYLEN) pKey->abyKey[15] &= 0x7F; @@ -269,32 +256,32 @@ BOOL KeybSetKey ( if ((dwKeyIndex & USE_KEYRSC) == 0) { // RSC set by NIC - ZERO_MEMORY(&(pKey->KeyRSC), sizeof(QWORD)); + memset(&(pKey->KeyRSC), 0, sizeof(QWORD)); } else { - MEMvCopy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD)); + memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD)); } pKey->dwTSC47_16 = 0; pKey->wTSC15_0 = 0; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybSetKey(R): \n"); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->bKeyValid: %d\n ", pKey->bKeyValid); - //DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->uKeyLength: %d\n ", pKey->uKeyLength); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->abyKey: "); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybSetKey(R): \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->bKeyValid: %d\n ", pKey->bKeyValid); + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->uKeyLength: %d\n ", pKey->uKeyLength); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->abyKey: "); for (ii = 0; ii < pKey->uKeyLength; ii++) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pKey->abyKey[ii]); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pKey->abyKey[ii]); } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %lx\n ", pKey->dwTSC47_16); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->wTSC15_0: %x\n ", pKey->wTSC15_0); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %lx\n ", pKey->dwKeyIndex); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %lx\n ", pKey->dwTSC47_16); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->wTSC15_0: %x\n ", pKey->wTSC15_0); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %lx\n ", pKey->dwKeyIndex); return (TRUE); } } if (j < (MAX_KEY_TABLE-1)) { - MEMvCopy(pTable->KeyTable[j].abyBSSID,pbyBSSID,U_ETHER_ADDR_LEN); + memcpy(pTable->KeyTable[j].abyBSSID,pbyBSSID,U_ETHER_ADDR_LEN); pTable->KeyTable[j].bInUse = TRUE; if ((dwKeyIndex & PAIRWISE_KEY) != 0) { // Pairwise key @@ -310,7 +297,7 @@ BOOL KeybSetKey ( if ((dwKeyIndex & TRANSMIT_KEY) != 0) { // Group transmit key pTable->KeyTable[j].dwGTKeyIndex = dwKeyIndex; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Group transmit key(N)[%lX]: %d\n", pTable->KeyTable[j].dwGTKeyIndex, j); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Group transmit key(N)[%lX]: %d\n", pTable->KeyTable[j].dwGTKeyIndex, j); } pTable->KeyTable[j].wKeyCtl &= 0xFF0F; // clear group key control filed pTable->KeyTable[j].wKeyCtl |= (byKeyDecMode << 4); @@ -323,7 +310,7 @@ BOOL KeybSetKey ( pKey->uKeyLength = uKeyLength; pKey->dwKeyIndex = dwKeyIndex; pKey->byCipherSuite = byKeyDecMode; - MEMvCopy(pKey->abyKey, pbyKey, uKeyLength); + memcpy(pKey->abyKey, pbyKey, uKeyLength); if (byKeyDecMode == KEY_CTL_WEP) { if (uKeyLength == WLAN_WEP40_KEYLEN) pKey->abyKey[15] &= 0x7F; @@ -334,26 +321,26 @@ BOOL KeybSetKey ( if ((dwKeyIndex & USE_KEYRSC) == 0) { // RSC set by NIC - ZERO_MEMORY(&(pKey->KeyRSC), sizeof(QWORD)); + memset(&(pKey->KeyRSC), 0, sizeof(QWORD)); } else { - MEMvCopy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD)); + memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD)); } pKey->dwTSC47_16 = 0; pKey->wTSC15_0 = 0; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybSetKey(N): \n"); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->bKeyValid: %d\n ", pKey->bKeyValid); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->uKeyLength: %d\n ", (int)pKey->uKeyLength); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->abyKey: "); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybSetKey(N): \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->bKeyValid: %d\n ", pKey->bKeyValid); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->uKeyLength: %d\n ", (int)pKey->uKeyLength); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->abyKey: "); for (ii = 0; ii < pKey->uKeyLength; ii++) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pKey->abyKey[ii]); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pKey->abyKey[ii]); } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %lx\n ", pKey->dwTSC47_16); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->wTSC15_0: %x\n ", pKey->wTSC15_0); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %lx\n ", pKey->dwKeyIndex); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %lx\n ", pKey->dwTSC47_16); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->wTSC15_0: %x\n ", pKey->wTSC15_0); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %lx\n ", pKey->dwKeyIndex); return (TRUE); } @@ -549,51 +536,51 @@ BOOL KeybGetTransmitKey ( if (pTable->KeyTable[i].PairwiseKey.bKeyValid == TRUE) { *pKey = &(pTable->KeyTable[i].PairwiseKey); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybGetTransmitKey:"); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"PAIRWISE_KEY: KeyTable.abyBSSID: "); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybGetTransmitKey:"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"PAIRWISE_KEY: KeyTable.abyBSSID: "); for (ii = 0; ii < 6; ii++) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%x ", pTable->KeyTable[i].abyBSSID[ii]); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%x ", pTable->KeyTable[i].abyBSSID[ii]); } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); return (TRUE); } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"PairwiseKey.bKeyValid == FALSE\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"PairwiseKey.bKeyValid == FALSE\n"); return (FALSE); } } // End of Type == PAIRWISE else { if (pTable->KeyTable[i].dwGTKeyIndex == 0) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ERROR: dwGTKeyIndex == 0 !!!\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ERROR: dwGTKeyIndex == 0 !!!\n"); return FALSE; } if (pTable->KeyTable[i].GroupKey[(pTable->KeyTable[i].dwGTKeyIndex&0x000000FF)].bKeyValid == TRUE) { *pKey = &(pTable->KeyTable[i].GroupKey[(pTable->KeyTable[i].dwGTKeyIndex&0x000000FF)]); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybGetTransmitKey:"); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"GROUP_KEY: KeyTable.abyBSSID\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybGetTransmitKey:"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"GROUP_KEY: KeyTable.abyBSSID\n"); for (ii = 0; ii < 6; ii++) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%x ", pTable->KeyTable[i].abyBSSID[ii]); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%x ", pTable->KeyTable[i].abyBSSID[ii]); } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"dwGTKeyIndex: %lX\n", pTable->KeyTable[i].dwGTKeyIndex); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"dwGTKeyIndex: %lX\n", pTable->KeyTable[i].dwGTKeyIndex); return (TRUE); } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"GroupKey.bKeyValid == FALSE\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"GroupKey.bKeyValid == FALSE\n"); return (FALSE); } } // End of Type = GROUP } // BSSID match } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ERROR: NO Match BSSID !!! "); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ERROR: NO Match BSSID !!! "); for (ii = 0; ii < 6; ii++) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02x ", *(pbyBSSID+ii)); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02x ", *(pbyBSSID+ii)); } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); return (FALSE); } @@ -659,7 +646,7 @@ BOOL KeybSetDefaultKey ( PSKeyItem pKey; UINT uKeyIdx; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetDefaultKey: %1x, %d \n", (int)dwKeyIndex, (int)uKeyLength); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetDefaultKey: %1x, %d \n", (int)dwKeyIndex, (int)uKeyLength); if ((dwKeyIndex & PAIRWISE_KEY) != 0) { // Pairwise key @@ -677,7 +664,7 @@ BOOL KeybSetDefaultKey ( if ((dwKeyIndex & TRANSMIT_KEY) != 0) { // Group transmit key pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex = dwKeyIndex; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Group transmit key(R)[%lX]: %d\n", pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex, MAX_KEY_TABLE-1); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Group transmit key(R)[%lX]: %d\n", pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex, MAX_KEY_TABLE-1); } pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl &= 0x7F00; // clear all key control filed @@ -699,7 +686,7 @@ BOOL KeybSetDefaultKey ( pKey->uKeyLength = uKeyLength; pKey->dwKeyIndex = dwKeyIndex; pKey->byCipherSuite = byKeyDecMode; - MEMvCopy(pKey->abyKey, pbyKey, uKeyLength); + memcpy(pKey->abyKey, pbyKey, uKeyLength); if (byKeyDecMode == KEY_CTL_WEP) { if (uKeyLength == WLAN_WEP40_KEYLEN) pKey->abyKey[15] &= 0x7F; @@ -710,26 +697,26 @@ BOOL KeybSetDefaultKey ( if ((dwKeyIndex & USE_KEYRSC) == 0) { // RSC set by NIC - ZERO_MEMORY(&(pKey->KeyRSC), sizeof(QWORD)); + memset(&(pKey->KeyRSC), 0, sizeof(QWORD)); } else { - MEMvCopy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD)); + memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD)); } pKey->dwTSC47_16 = 0; pKey->wTSC15_0 = 0; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybSetKey(R): \n"); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->bKeyValid: %d\n", pKey->bKeyValid); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->uKeyLength: %d\n", (int)pKey->uKeyLength); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->abyKey: \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybSetKey(R): \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->bKeyValid: %d\n", pKey->bKeyValid); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->uKeyLength: %d\n", (int)pKey->uKeyLength); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->abyKey: \n"); for (ii = 0; ii < pKey->uKeyLength; ii++) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%x", pKey->abyKey[ii]); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%x", pKey->abyKey[ii]); } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %lx\n", pKey->dwTSC47_16); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->wTSC15_0: %x\n", pKey->wTSC15_0); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %lx\n", pKey->dwKeyIndex); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %lx\n", pKey->dwTSC47_16); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->wTSC15_0: %x\n", pKey->wTSC15_0); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %lx\n", pKey->dwKeyIndex); return (TRUE); } @@ -767,7 +754,7 @@ BOOL KeybSetAllGroupKey ( PSKeyItem pKey; UINT uKeyIdx; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetAllGroupKey: %lX\n", dwKeyIndex); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetAllGroupKey: %lX\n", dwKeyIndex); if ((dwKeyIndex & PAIRWISE_KEY) != 0) { // Pairwise key @@ -784,7 +771,7 @@ BOOL KeybSetAllGroupKey ( if ((dwKeyIndex & TRANSMIT_KEY) != 0) { // Group transmit key pTable->KeyTable[i].dwGTKeyIndex = dwKeyIndex; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Group transmit key(R)[%lX]: %d\n", pTable->KeyTable[i].dwGTKeyIndex, i); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Group transmit key(R)[%lX]: %d\n", pTable->KeyTable[i].dwGTKeyIndex, i); } pTable->KeyTable[i].wKeyCtl &= 0xFF0F; // clear group key control filed @@ -798,7 +785,7 @@ BOOL KeybSetAllGroupKey ( pKey->uKeyLength = uKeyLength; pKey->dwKeyIndex = dwKeyIndex; pKey->byCipherSuite = byKeyDecMode; - MEMvCopy(pKey->abyKey, pbyKey, uKeyLength); + memcpy(pKey->abyKey, pbyKey, uKeyLength); if (byKeyDecMode == KEY_CTL_WEP) { if (uKeyLength == WLAN_WEP40_KEYLEN) pKey->abyKey[15] &= 0x7F; @@ -809,22 +796,22 @@ BOOL KeybSetAllGroupKey ( if ((dwKeyIndex & USE_KEYRSC) == 0) { // RSC set by NIC - ZERO_MEMORY(&(pKey->KeyRSC), sizeof(QWORD)); + memset(&(pKey->KeyRSC), 0, sizeof(QWORD)); } else { - MEMvCopy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD)); + memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD)); } pKey->dwTSC47_16 = 0; pKey->wTSC15_0 = 0; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybSetKey(R): \n"); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->bKeyValid: %d\n ", pKey->bKeyValid); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->uKeyLength: %d\n ", (int)pKey->uKeyLength); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->abyKey: "); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybSetKey(R): \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->bKeyValid: %d\n ", pKey->bKeyValid); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->uKeyLength: %d\n ", (int)pKey->uKeyLength); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->abyKey: "); for (ii = 0; ii < pKey->uKeyLength; ii++) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02x ", pKey->abyKey[ii]); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02x ", pKey->abyKey[ii]); } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); //DBG_PRN_GRP12(("pKey->dwTSC47_16: %lX\n ", pKey->dwTSC47_16)); //DBG_PRN_GRP12(("pKey->wTSC15_0: %X\n ", pKey->wTSC15_0)); diff --git a/drivers/staging/vt6655/key.h b/drivers/staging/vt6655/key.h index 9c7d335..ba797c7 100644 --- a/drivers/staging/vt6655/key.h +++ b/drivers/staging/vt6655/key.h @@ -27,21 +27,12 @@ * */ - #ifndef __KEY_H__ #define __KEY_H__ -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif - -#if !defined(__TETHER_H__) #include "tether.h" -#endif - -#if !defined(__80211MGR_H__) #include "80211mgr.h" -#endif /*--------------------- Export Definitions -------------------------*/ #define MAX_GROUP_KEY 4 @@ -76,7 +67,7 @@ typedef struct tagSKeyItem BYTE byReserved0; DWORD dwKeyIndex; PVOID pvKeyTable; -} SKeyItem, DEF* PSKeyItem; //64 +} SKeyItem, *PSKeyItem; //64 typedef struct tagSKeyTable { @@ -93,12 +84,12 @@ typedef struct tagSKeyTable WORD wKeyCtl; // for address of wKeyCtl at align 4 BYTE byReserved1[6]; -} SKeyTable, DEF* PSKeyTable; //348 +} SKeyTable, *PSKeyTable; //348 typedef struct tagSKeyManagement { SKeyTable KeyTable[MAX_KEY_TABLE]; -} SKeyManagement, DEF* PSKeyManagement; +} SKeyManagement, * PSKeyManagement; /*--------------------- Export Types ------------------------------*/ @@ -109,9 +100,6 @@ typedef struct tagSKeyManagement /*--------------------- Export Variables --------------------------*/ /*--------------------- Export Functions --------------------------*/ -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ VOID KeyvInitTable(PSKeyManagement pTable, DWORD_PTR dwIoBase); @@ -192,11 +180,5 @@ BOOL KeybSetAllGroupKey ( BYTE byLocalID ); -#ifdef __cplusplus -} /* End of extern "C" { */ - -#endif /* __cplusplus */ - - #endif // __KEY_H__ diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c index 0283ed3..cdd7cd5 100644 --- a/drivers/staging/vt6655/mac.c +++ b/drivers/staging/vt6655/mac.c @@ -16,6 +16,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + * * File: mac.c * * Purpose: MAC routines @@ -67,19 +68,9 @@ * */ -#if !defined(__TMACRO_H__) #include "tmacro.h" -#endif -#if !defined(__TBIT_H__) -#include "tbit.h" -#endif -#if !defined(__TETHER_H__) #include "tether.h" -#endif -#if !defined(__MAC_H__) #include "mac.h" -#endif - WORD TxRate_iwconfig;//2008-5-8 <add> by chester /*--------------------- Static Definitions -------------------------*/ @@ -95,6 +86,10 @@ static int msglevel =MSG_LEVEL_INFO; /*--------------------- Export Functions --------------------------*/ + + + + /* * Description: * Read All MAC Registers to buffer @@ -150,7 +145,7 @@ BOOL MACbIsRegBitsOn (DWORD_PTR dwIoBase, BYTE byRegOfs, BYTE byTestBits) BYTE byData; VNSvInPortB(dwIoBase + byRegOfs, &byData); - return BITbIsAllBitsOn(byData, byTestBits); + return (byData & byTestBits) == byTestBits; } /* @@ -173,7 +168,7 @@ BOOL MACbIsRegBitsOff (DWORD_PTR dwIoBase, BYTE byRegOfs, BYTE byTestBits) BYTE byData; VNSvInPortB(dwIoBase + byRegOfs, &byData); - return BITbIsAllBitsOff(byData, byTestBits); + return !(byData & byTestBits); } /* @@ -569,7 +564,7 @@ BOOL MACbIsInLoopbackMode (DWORD_PTR dwIoBase) BYTE byOrgValue; VNSvInPortB(dwIoBase + MAC_REG_TEST, &byOrgValue); - if (BITbIsAnyBitsOn(byOrgValue, (TEST_LBINT | TEST_LBEXT))) + if (byOrgValue & (TEST_LBINT | TEST_LBEXT)) return TRUE; return FALSE; } @@ -596,7 +591,7 @@ void MACvSetPacketFilter (DWORD_PTR dwIoBase, WORD wFilterType) // if only in DIRECTED mode, multicast-address will set to zero, // but if other mode exist (e.g. PROMISCUOUS), multicast-address // will be open - if (BITbIsBitOn(wFilterType, PKT_TYPE_DIRECTED)) { + if (wFilterType & PKT_TYPE_DIRECTED) { // set multicast address to accept none MACvSelectPage1(dwIoBase); VNSvOutPortD(dwIoBase + MAC_REG_MAR0, 0L); @@ -604,7 +599,7 @@ void MACvSetPacketFilter (DWORD_PTR dwIoBase, WORD wFilterType) MACvSelectPage0(dwIoBase); } - if (BITbIsAnyBitsOn(wFilterType, PKT_TYPE_PROMISCUOUS | PKT_TYPE_ALL_MULTICAST)) { + if (wFilterType & (PKT_TYPE_PROMISCUOUS | PKT_TYPE_ALL_MULTICAST)) { // set multicast address to accept all MACvSelectPage1(dwIoBase); VNSvOutPortD(dwIoBase + MAC_REG_MAR0, 0xFFFFFFFFL); @@ -612,20 +607,20 @@ void MACvSetPacketFilter (DWORD_PTR dwIoBase, WORD wFilterType) MACvSelectPage0(dwIoBase); } - if (BITbIsBitOn(wFilterType, PKT_TYPE_PROMISCUOUS)) { + if (wFilterType & PKT_TYPE_PROMISCUOUS) { byNewRCR |= (RCR_RXALLTYPE | RCR_UNICAST | RCR_MULTICAST | RCR_BROADCAST); byNewRCR &= ~RCR_BSSID; } - if (BITbIsAnyBitsOn(wFilterType, (PKT_TYPE_ALL_MULTICAST | PKT_TYPE_MULTICAST))) + if (wFilterType & (PKT_TYPE_ALL_MULTICAST | PKT_TYPE_MULTICAST)) byNewRCR |= RCR_MULTICAST; - if (BITbIsBitOn(wFilterType, PKT_TYPE_BROADCAST)) + if (wFilterType & PKT_TYPE_BROADCAST) byNewRCR |= RCR_BROADCAST; - if (BITbIsBitOn(wFilterType, PKT_TYPE_ERROR_CRC)) + if (wFilterType & PKT_TYPE_ERROR_CRC) byNewRCR |= RCR_ERRCRC; VNSvInPortB(dwIoBase + MAC_REG_RCR, &byOldRCR); @@ -789,7 +784,7 @@ BOOL MACbSoftwareReset (DWORD_PTR dwIoBase) for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortB(dwIoBase + MAC_REG_HOSTCR, &byData); - if (BITbIsBitOff(byData, HOSTCR_SOFTRST)) + if ( !(byData & HOSTCR_SOFTRST)) break; } if (ww == W_MAX_TIMEOUT) @@ -857,22 +852,22 @@ BOOL MACbSafeRxOff (DWORD_PTR dwIoBase) VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, DMACTL_CLRRUN); for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortD(dwIoBase + MAC_REG_RXDMACTL0, &dwData); - if (BITbIsAllBitsOff(dwData, DMACTL_RUN)) + if (!(dwData & DMACTL_RUN)) break; } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x10); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x10)\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x10)\n"); return(FALSE); } for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortD(dwIoBase + MAC_REG_RXDMACTL1, &dwData); - if (BITbIsAllBitsOff(dwData, DMACTL_RUN)) + if ( !(dwData & DMACTL_RUN)) break; } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x11); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x11)\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x11)\n"); return(FALSE); } @@ -881,12 +876,12 @@ BOOL MACbSafeRxOff (DWORD_PTR dwIoBase) // W_MAX_TIMEOUT is the timeout period for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortB(dwIoBase + MAC_REG_HOSTCR, &byData); - if (BITbIsAllBitsOff(byData, HOSTCR_RXONST)) + if ( !(byData & HOSTCR_RXONST)) break; } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x12); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x12)\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x12)\n"); return(FALSE); } return TRUE; @@ -920,22 +915,22 @@ BOOL MACbSafeTxOff (DWORD_PTR dwIoBase) for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortD(dwIoBase + MAC_REG_TXDMACTL0, &dwData); - if (BITbIsAllBitsOff(dwData, DMACTL_RUN)) + if ( !(dwData & DMACTL_RUN)) break; } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x20); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x20)\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x20)\n"); return(FALSE); } for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortD(dwIoBase + MAC_REG_AC0DMACTL, &dwData); - if (BITbIsAllBitsOff(dwData, DMACTL_RUN)) + if ( !(dwData & DMACTL_RUN)) break; } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x21); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x21)\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x21)\n"); return(FALSE); } @@ -945,12 +940,12 @@ BOOL MACbSafeTxOff (DWORD_PTR dwIoBase) // W_MAX_TIMEOUT is the timeout period for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortB(dwIoBase + MAC_REG_HOSTCR, &byData); - if (BITbIsAllBitsOff(byData, HOSTCR_TXONST)) + if ( !(byData & HOSTCR_TXONST)) break; } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x24); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x24)\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x24)\n"); return(FALSE); } return TRUE; @@ -975,13 +970,13 @@ BOOL MACbSafeStop (DWORD_PTR dwIoBase) if (MACbSafeRxOff(dwIoBase) == FALSE) { DBG_PORT80(0xA1); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" MACbSafeRxOff == FALSE)\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" MACbSafeRxOff == FALSE)\n"); MACbSafeSoftwareReset(dwIoBase); return FALSE; } if (MACbSafeTxOff(dwIoBase) == FALSE) { DBG_PORT80(0xA2); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" MACbSafeTxOff == FALSE)\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" MACbSafeTxOff == FALSE)\n"); MACbSafeSoftwareReset(dwIoBase); return FALSE; } @@ -1053,7 +1048,7 @@ void MACvInitialize (DWORD_PTR dwIoBase) //while (TRUE) { // U8 u8Data; // VNSvInPortB(dwIoBase + MAC_REG_I2MCSR, &u8Data); - // if (BITbIsBitOff(u8Data, I2MCSR_AUTOLD)) + // if ( !(u8Data & I2MCSR_AUTOLD)) // break; //} @@ -1091,19 +1086,19 @@ BYTE byData; BYTE byOrgDMACtl; VNSvInPortB(dwIoBase + MAC_REG_RXDMACTL0, &byOrgDMACtl); - if (BITbIsAllBitsOn(byOrgDMACtl, DMACTL_RUN)) { + if (byOrgDMACtl & DMACTL_RUN) { VNSvOutPortB(dwIoBase + MAC_REG_RXDMACTL0+2, DMACTL_RUN); } for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortB(dwIoBase + MAC_REG_RXDMACTL0, &byData); - if (BITbIsAllBitsOff(byData, DMACTL_RUN)) + if ( !(byData & DMACTL_RUN)) break; } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x13); } VNSvOutPortD(dwIoBase + MAC_REG_RXDMAPTR0, dwCurrDescAddr); - if (BITbIsAllBitsOn(byOrgDMACtl, DMACTL_RUN)) { + if (byOrgDMACtl & DMACTL_RUN) { VNSvOutPortB(dwIoBase + MAC_REG_RXDMACTL0, DMACTL_RUN); } } @@ -1129,19 +1124,19 @@ BYTE byData; BYTE byOrgDMACtl; VNSvInPortB(dwIoBase + MAC_REG_RXDMACTL1, &byOrgDMACtl); - if (BITbIsAllBitsOn(byOrgDMACtl, DMACTL_RUN)) { + if (byOrgDMACtl & DMACTL_RUN) { VNSvOutPortB(dwIoBase + MAC_REG_RXDMACTL1+2, DMACTL_RUN); } for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortB(dwIoBase + MAC_REG_RXDMACTL1, &byData); - if (BITbIsAllBitsOff(byData, DMACTL_RUN)) + if ( !(byData & DMACTL_RUN)) break; } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x14); } VNSvOutPortD(dwIoBase + MAC_REG_RXDMAPTR1, dwCurrDescAddr); - if (BITbIsAllBitsOn(byOrgDMACtl, DMACTL_RUN)) { + if (byOrgDMACtl & DMACTL_RUN) { VNSvOutPortB(dwIoBase + MAC_REG_RXDMACTL1, DMACTL_RUN); } } @@ -1167,19 +1162,19 @@ BYTE byData; BYTE byOrgDMACtl; VNSvInPortB(dwIoBase + MAC_REG_TXDMACTL0, &byOrgDMACtl); - if (BITbIsAllBitsOn(byOrgDMACtl, DMACTL_RUN)) { + if (byOrgDMACtl & DMACTL_RUN) { VNSvOutPortB(dwIoBase + MAC_REG_TXDMACTL0+2, DMACTL_RUN); } for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortB(dwIoBase + MAC_REG_TXDMACTL0, &byData); - if (BITbIsAllBitsOff(byData, DMACTL_RUN)) + if ( !(byData & DMACTL_RUN)) break; } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x25); } VNSvOutPortD(dwIoBase + MAC_REG_TXDMAPTR0, dwCurrDescAddr); - if (BITbIsAllBitsOn(byOrgDMACtl, DMACTL_RUN)) { + if (byOrgDMACtl & DMACTL_RUN) { VNSvOutPortB(dwIoBase + MAC_REG_TXDMACTL0, DMACTL_RUN); } } @@ -1206,20 +1201,20 @@ BYTE byData; BYTE byOrgDMACtl; VNSvInPortB(dwIoBase + MAC_REG_AC0DMACTL, &byOrgDMACtl); - if (BITbIsAllBitsOn(byOrgDMACtl, DMACTL_RUN)) { + if (byOrgDMACtl & DMACTL_RUN) { VNSvOutPortB(dwIoBase + MAC_REG_AC0DMACTL+2, DMACTL_RUN); } for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortB(dwIoBase + MAC_REG_AC0DMACTL, &byData); - if (BITbIsAllBitsOff(byData, DMACTL_RUN)) + if (!(byData & DMACTL_RUN)) break; } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x26); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x26)\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x26)\n"); } VNSvOutPortD(dwIoBase + MAC_REG_AC0DMAPTR, dwCurrDescAddr); - if (BITbIsAllBitsOn(byOrgDMACtl, DMACTL_RUN)) { + if (byOrgDMACtl & DMACTL_RUN) { VNSvOutPortB(dwIoBase + MAC_REG_AC0DMACTL, DMACTL_RUN); } } @@ -1261,7 +1256,7 @@ UINT uu,ii; for (uu = 0; uu < uDelay; uu++) { VNSvInPortB(dwIoBase + MAC_REG_TMCTL0, &byValue); if ((byValue == 0) || - (BITbIsAllBitsOn(byValue, TMCTL_TSUSP))) { + (byValue & TMCTL_TSUSP)) { VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, 0); return; } @@ -1333,20 +1328,20 @@ UINT ww = 0; VNSvOutPortB(dwIoBase + MAC_REG_TXDMACTL0+2, DMACTL_RUN); for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortB(dwIoBase + MAC_REG_TXDMACTL0, &byData); - if (BITbIsAllBitsOff(byData, DMACTL_RUN)) + if ( !(byData & DMACTL_RUN)) break; } } else if (idx == TYPE_AC0DMA) { VNSvOutPortB(dwIoBase + MAC_REG_AC0DMACTL+2, DMACTL_RUN); for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortB(dwIoBase + MAC_REG_AC0DMACTL, &byData); - if (BITbIsAllBitsOff(byData, DMACTL_RUN)) + if ( !(byData & DMACTL_RUN)) break; } } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x29); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x29)\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x29)\n"); return FALSE; } return TRUE; @@ -1358,19 +1353,19 @@ void MACvClearBusSusInd (DWORD_PTR dwIoBase) UINT ww; // check if BcnSusInd enabled VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); - if(BITbIsBitOff(dwOrgValue, EnCFG_BcnSusInd)) + if( !(dwOrgValue & EnCFG_BcnSusInd)) return; //Set BcnSusClr dwOrgValue = dwOrgValue | EnCFG_BcnSusClr; VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); - if(BITbIsBitOff(dwOrgValue, EnCFG_BcnSusInd)) + if( !(dwOrgValue & EnCFG_BcnSusInd)) break; } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x33); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x33)\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x33)\n"); } } @@ -1387,12 +1382,12 @@ void MACvEnableBusSusEn (DWORD_PTR dwIoBase) VNSvOutPortB(dwIoBase + MAC_REG_ENCFG, byOrgValue); for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); - if(BITbIsBitOn(dwOrgValue, EnCFG_BcnSusInd)) + if(dwOrgValue & EnCFG_BcnSusInd) break; } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x34); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x34)\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x34)\n"); } } @@ -1410,12 +1405,12 @@ BOOL MACbFlushSYNCFifo (DWORD_PTR dwIoBase) // Check if SyncFlushOK for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortB(dwIoBase + MAC_REG_MACCR , &byOrgValue); - if(BITbIsBitOn(byOrgValue, MACCR_SYNCFLUSHOK)) + if(byOrgValue & MACCR_SYNCFLUSHOK) break; } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x35); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x33)\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x33)\n"); } return TRUE; } @@ -1434,12 +1429,12 @@ BOOL MACbPSWakeup (DWORD_PTR dwIoBase) // Check if SyncFlushOK for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortB(dwIoBase + MAC_REG_PSCTL , &byOrgValue); - if(BITbIsBitOn(byOrgValue, PSCTL_WAKEDONE)) + if(byOrgValue & PSCTL_WAKEDONE) break; } if (ww == W_MAX_TIMEOUT) { DBG_PORT80(0x36); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x33)\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x33)\n"); return FALSE; } return TRUE; @@ -1470,7 +1465,7 @@ int ii; return; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MACvSetKeyEntry\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MACvSetKeyEntry\n"); wOffset = MISCFIFO_KEYETRY0; wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE); @@ -1478,7 +1473,7 @@ int ii; dwData |= wKeyCtl; dwData <<= 16; dwData |= MAKEWORD(*(pbyAddr+4), *(pbyAddr+5)); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1. wOffset: %d, Data: %lX, KeyCtl:%X\n", wOffset, dwData, wKeyCtl); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1. wOffset: %d, Data: %lX, KeyCtl:%X\n", wOffset, dwData, wKeyCtl); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); @@ -1493,7 +1488,7 @@ int ii; dwData |= *(pbyAddr+1); dwData <<= 8; dwData |= *(pbyAddr+0); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"2. wOffset: %d, Data: %lX\n", wOffset, dwData); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"2. wOffset: %d, Data: %lX\n", wOffset, dwData); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); @@ -1503,7 +1498,7 @@ int ii; wOffset += (uKeyIdx * 4); for (ii=0;ii<4;ii++) { // alway push 128 bits - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"3.(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"3.(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); @@ -1563,7 +1558,7 @@ int ii; if (byLocalID <= 1) return; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MACvSetDefaultKeyEntry\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MACvSetDefaultKeyEntry\n"); wOffset = MISCFIFO_KEYETRY0; wOffset += (10 * MISCFIFO_KEYENTRYSIZE); @@ -1572,7 +1567,7 @@ int ii; wOffset += (uKeyIdx * 4); // alway push 128 bits for (ii=0; ii<3; ii++) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); @@ -1584,7 +1579,7 @@ int ii; VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+3); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"End. wOffset: %d, Data: %lX\n", wOffset+3, dwData); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"End. wOffset: %d, Data: %lX\n", wOffset+3, dwData); } @@ -1620,7 +1615,7 @@ DWORD dwData; VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MACvEnableDefaultKey: wOffset: %d, Data: %lX\n", wOffset, dwData); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MACvEnableDefaultKey: wOffset: %d, Data: %lX\n", wOffset, dwData); } */ @@ -1652,7 +1647,7 @@ DWORD dwData; VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MACvDisableDefaultKey: wOffset: %d, Data: %lX\n", wOffset, dwData); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MACvDisableDefaultKey: wOffset: %d, Data: %lX\n", wOffset, dwData); } /* @@ -1679,7 +1674,7 @@ int ii; return; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MACvSetDefaultTKIPKeyEntry\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MACvSetDefaultTKIPKeyEntry\n"); wOffset = MISCFIFO_KEYETRY0; // Kyle test : change offset from 10 -> 0 wOffset += (10 * MISCFIFO_KEYENTRYSIZE); @@ -1697,10 +1692,10 @@ int ii; wOffset++; wOffset += (uKeyIdx * 4); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1. wOffset: %d, Data: %lX, idx:%d\n", wOffset, *pdwKey, uKeyIdx); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1. wOffset: %d, Data: %lX, idx:%d\n", wOffset, *pdwKey, uKeyIdx); // alway push 128 bits for (ii=0; ii<4; ii++) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"2.(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"2.(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); @@ -1734,7 +1729,7 @@ DWORD dwData; return; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MACvSetKeyEntry\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MACvSetKeyEntry\n"); wOffset = MISCFIFO_KEYETRY0; wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE); @@ -1742,7 +1737,7 @@ DWORD dwData; dwData |= wKeyCtl; dwData <<= 16; dwData |= 0xffff; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1. wOffset: %d, Data: %lX, KeyCtl:%X\n", wOffset, dwData, wKeyCtl); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1. wOffset: %d, Data: %lX, KeyCtl:%X\n", wOffset, dwData, wKeyCtl); VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); diff --git a/drivers/staging/vt6655/mac.h b/drivers/staging/vt6655/mac.h index edb7096..3ba87fb 100644 --- a/drivers/staging/vt6655/mac.h +++ b/drivers/staging/vt6655/mac.h @@ -24,27 +24,19 @@ * Author: Tevin Chen * * Date: May 21, 1996 + * * Revision History: * 07-01-2003 Bryan YC Fan: Re-write codes to support VT3253 spec. * 08-25-2003 Kyle Hsu: Porting MAC functions from sim53. * 09-03-2003 Bryan YC Fan: Add MACvDisableProtectMD & MACvEnableProtectMD - * */ #ifndef __MAC_H__ #define __MAC_H__ - - -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif -#if !defined(__TMACRO_H__) #include "tmacro.h" -#endif -#if !defined(__UPC_H__) #include "upc.h" -#endif /*--------------------- Export Definitions -------------------------*/ // @@ -130,7 +122,7 @@ #define MAC_REG_IFREGCTL 0x70 // #define MAC_REG_IFDATA 0x71 // #define MAC_REG_ITRTMSET 0x74 // -#define MAC_REG_PAPEDELAY 0x77 // +#define MAC_REG_PAPEDELAY 0x77 #define MAC_REG_SOFTPWRCTL 0x78 // #define MAC_REG_GPIOCTL0 0x7A // #define MAC_REG_GPIOCTL1 0x7B // @@ -1081,9 +1073,6 @@ /*--------------------- Export Variables --------------------------*/ /*--------------------- Export Functions --------------------------*/ -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ extern WORD TxRate_iwconfig;//2008-5-8 <add> by chester VOID MACvReadAllRegs(DWORD_PTR dwIoBase, PBYTE pbyMacRegs); @@ -1158,9 +1147,5 @@ void MACvDisableDefaultKey(DWORD_PTR dwIoBase); void MACvSetDefaultTKIPKeyEntry(DWORD_PTR dwIoBase, UINT uKeyLen, UINT uKeyIdx, PDWORD pdwKey, BYTE byLocalID); void MACvSetDefaultKeyCtl(DWORD_PTR dwIoBase, WORD wKeyCtl, UINT uEntryIdx, BYTE byLocalID); -#ifdef __cplusplus -} /* End of extern "C" { */ -#endif /* __cplusplus */ - #endif // __MAC_H__ diff --git a/drivers/staging/vt6655/mib.c b/drivers/staging/vt6655/mib.c index 3f06de1..fb11595 100644 --- a/drivers/staging/vt6655/mib.c +++ b/drivers/staging/vt6655/mib.c @@ -37,31 +37,12 @@ * */ - -#if !defined(__UPC_H__) #include "upc.h" -#endif -#if !defined(__MAC_H__) #include "mac.h" -#endif -#if !defined(__TBIT_H__) -#include "tbit.h" -#endif -#if !defined(__TETHER_H__) #include "tether.h" -#endif -#if !defined(__MIB_H__) #include "mib.h" -#endif -#if !defined(__WCTL_H__) #include "wctl.h" -#endif -#if !defined(__UMEM_H__) -#include "umem.h" -#endif -#if !defined(__BASEBAND_H__) #include "baseband.h" -#endif /*--------------------- Static Definitions -------------------------*/ static int msglevel =MSG_LEVEL_INFO; @@ -92,7 +73,7 @@ static int msglevel =MSG_LEVEL_INFO; void STAvClearAllCounter (PSStatCounter pStatistic) { // set memory to zero - ZERO_MEMORY(pStatistic, sizeof(SStatCounter)); + memset(pStatistic, 0, sizeof(SStatCounter)); } @@ -122,58 +103,58 @@ void STAvUpdateIsrStatCounter (PSStatCounter pStatistic, DWORD dwIsr) } //Added by Kyle - if (BITbIsBitOn(dwIsr, ISR_TXDMA0)) // ISR, bit0 + if (dwIsr & ISR_TXDMA0) // ISR, bit0 pStatistic->ISRStat.dwIsrTx0OK++; // TXDMA0 successful - if (BITbIsBitOn(dwIsr, ISR_AC0DMA)) // ISR, bit1 + if (dwIsr & ISR_AC0DMA) // ISR, bit1 pStatistic->ISRStat.dwIsrAC0TxOK++; // AC0DMA successful - if (BITbIsBitOn(dwIsr, ISR_BNTX)) // ISR, bit2 + if (dwIsr & ISR_BNTX) // ISR, bit2 pStatistic->ISRStat.dwIsrBeaconTxOK++; // BeaconTx successful - if (BITbIsBitOn(dwIsr, ISR_RXDMA0)) // ISR, bit3 + if (dwIsr & ISR_RXDMA0) // ISR, bit3 pStatistic->ISRStat.dwIsrRx0OK++; // Rx0 successful - if (BITbIsBitOn(dwIsr, ISR_TBTT)) // ISR, bit4 + if (dwIsr & ISR_TBTT) // ISR, bit4 pStatistic->ISRStat.dwIsrTBTTInt++; // TBTT successful - if (BITbIsBitOn(dwIsr, ISR_SOFTTIMER)) // ISR, bit6 + if (dwIsr & ISR_SOFTTIMER) // ISR, bit6 pStatistic->ISRStat.dwIsrSTIMERInt++; - if (BITbIsBitOn(dwIsr, ISR_WATCHDOG)) // ISR, bit7 + if (dwIsr & ISR_WATCHDOG) // ISR, bit7 pStatistic->ISRStat.dwIsrWatchDog++; - if (BITbIsBitOn(dwIsr, ISR_FETALERR)) // ISR, bit8 + if (dwIsr & ISR_FETALERR) // ISR, bit8 pStatistic->ISRStat.dwIsrUnrecoverableError++; - if (BITbIsBitOn(dwIsr, ISR_SOFTINT)) // ISR, bit9 + if (dwIsr & ISR_SOFTINT) // ISR, bit9 pStatistic->ISRStat.dwIsrSoftInterrupt++; // software interrupt - if (BITbIsBitOn(dwIsr, ISR_MIBNEARFULL)) // ISR, bit10 + if (dwIsr & ISR_MIBNEARFULL) // ISR, bit10 pStatistic->ISRStat.dwIsrMIBNearfull++; - if (BITbIsBitOn(dwIsr, ISR_RXNOBUF)) // ISR, bit11 + if (dwIsr & ISR_RXNOBUF) // ISR, bit11 pStatistic->ISRStat.dwIsrRxNoBuf++; // Rx No Buff - if (BITbIsBitOn(dwIsr, ISR_RXDMA1)) // ISR, bit12 + if (dwIsr & ISR_RXDMA1) // ISR, bit12 pStatistic->ISRStat.dwIsrRx1OK++; // Rx1 successful -// if (BITbIsBitOn(dwIsr, ISR_ATIMTX)) // ISR, bit13 +// if (dwIsr & ISR_ATIMTX) // ISR, bit13 // pStatistic->ISRStat.dwIsrATIMTxOK++; // ATIMTX successful -// if (BITbIsBitOn(dwIsr, ISR_SYNCTX)) // ISR, bit14 +// if (dwIsr & ISR_SYNCTX) // ISR, bit14 // pStatistic->ISRStat.dwIsrSYNCTxOK++; // SYNCTX successful -// if (BITbIsBitOn(dwIsr, ISR_CFPEND)) // ISR, bit18 +// if (dwIsr & ISR_CFPEND) // ISR, bit18 // pStatistic->ISRStat.dwIsrCFPEnd++; -// if (BITbIsBitOn(dwIsr, ISR_ATIMEND)) // ISR, bit19 +// if (dwIsr & ISR_ATIMEND) // ISR, bit19 // pStatistic->ISRStat.dwIsrATIMEnd++; -// if (BITbIsBitOn(dwIsr, ISR_SYNCFLUSHOK)) // ISR, bit20 +// if (dwIsr & ISR_SYNCFLUSHOK) // ISR, bit20 // pStatistic->ISRStat.dwIsrSYNCFlushOK++; - if (BITbIsBitOn(dwIsr, ISR_SOFTTIMER1)) // ISR, bit21 + if (dwIsr & ISR_SOFTTIMER1) // ISR, bit21 pStatistic->ISRStat.dwIsrSTIMER1Int++; } @@ -202,20 +183,20 @@ void STAvUpdateRDStatCounter (PSStatCounter pStatistic, //need change PS802_11Header pHeader = (PS802_11Header)pbyBuffer; - if (BITbIsBitOn(byRSR, RSR_ADDROK)) + if (byRSR & RSR_ADDROK) pStatistic->dwRsrADDROk++; - if (BITbIsBitOn(byRSR, RSR_CRCOK)) { + if (byRSR & RSR_CRCOK) { pStatistic->dwRsrCRCOk++; pStatistic->ullRsrOK++; if (cbFrameLength >= U_ETHER_ADDR_LEN) { // update counters in case that successful transmit - if (BITbIsBitOn(byRSR, RSR_ADDRBROAD)) { + if (byRSR & RSR_ADDRBROAD) { pStatistic->ullRxBroadcastFrames++; pStatistic->ullRxBroadcastBytes += (ULONGLONG)cbFrameLength; } - else if (BITbIsBitOn(byRSR, RSR_ADDRMULTI)) { + else if (byRSR & RSR_ADDRMULTI) { pStatistic->ullRxMulticastFrames++; pStatistic->ullRxMulticastBytes += (ULONGLONG)cbFrameLength; } @@ -228,113 +209,113 @@ void STAvUpdateRDStatCounter (PSStatCounter pStatistic, if(byRxRate==22) { pStatistic->CustomStat.ullRsr11M++; - if(BITbIsBitOn(byRSR, RSR_CRCOK)) { + if(byRSR & RSR_CRCOK) { pStatistic->CustomStat.ullRsr11MCRCOk++; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"11M: ALL[%d], OK[%d]:[%02x]\n", (INT)pStatistic->CustomStat.ullRsr11M, (INT)pStatistic->CustomStat.ullRsr11MCRCOk, byRSR); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"11M: ALL[%d], OK[%d]:[%02x]\n", (INT)pStatistic->CustomStat.ullRsr11M, (INT)pStatistic->CustomStat.ullRsr11MCRCOk, byRSR); } else if(byRxRate==11) { pStatistic->CustomStat.ullRsr5M++; - if(BITbIsBitOn(byRSR, RSR_CRCOK)) { + if(byRSR & RSR_CRCOK) { pStatistic->CustomStat.ullRsr5MCRCOk++; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 5M: ALL[%d], OK[%d]:[%02x]\n", (INT)pStatistic->CustomStat.ullRsr5M, (INT)pStatistic->CustomStat.ullRsr5MCRCOk, byRSR); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 5M: ALL[%d], OK[%d]:[%02x]\n", (INT)pStatistic->CustomStat.ullRsr5M, (INT)pStatistic->CustomStat.ullRsr5MCRCOk, byRSR); } else if(byRxRate==4) { pStatistic->CustomStat.ullRsr2M++; - if(BITbIsBitOn(byRSR, RSR_CRCOK)) { + if(byRSR & RSR_CRCOK) { pStatistic->CustomStat.ullRsr2MCRCOk++; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 2M: ALL[%d], OK[%d]:[%02x]\n", (INT)pStatistic->CustomStat.ullRsr2M, (INT)pStatistic->CustomStat.ullRsr2MCRCOk, byRSR); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 2M: ALL[%d], OK[%d]:[%02x]\n", (INT)pStatistic->CustomStat.ullRsr2M, (INT)pStatistic->CustomStat.ullRsr2MCRCOk, byRSR); } else if(byRxRate==2){ pStatistic->CustomStat.ullRsr1M++; - if(BITbIsBitOn(byRSR, RSR_CRCOK)) { + if(byRSR & RSR_CRCOK) { pStatistic->CustomStat.ullRsr1MCRCOk++; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 1M: ALL[%d], OK[%d]:[%02x]\n", (INT)pStatistic->CustomStat.ullRsr1M, (INT)pStatistic->CustomStat.ullRsr1MCRCOk, byRSR); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 1M: ALL[%d], OK[%d]:[%02x]\n", (INT)pStatistic->CustomStat.ullRsr1M, (INT)pStatistic->CustomStat.ullRsr1MCRCOk, byRSR); } else if(byRxRate==12){ pStatistic->CustomStat.ullRsr6M++; - if(BITbIsBitOn(byRSR, RSR_CRCOK)) { + if(byRSR & RSR_CRCOK) { pStatistic->CustomStat.ullRsr6MCRCOk++; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 6M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr6M, (INT)pStatistic->CustomStat.ullRsr6MCRCOk); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 6M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr6M, (INT)pStatistic->CustomStat.ullRsr6MCRCOk); } else if(byRxRate==18){ pStatistic->CustomStat.ullRsr9M++; - if(BITbIsBitOn(byRSR, RSR_CRCOK)) { + if(byRSR & RSR_CRCOK) { pStatistic->CustomStat.ullRsr9MCRCOk++; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 9M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr9M, (INT)pStatistic->CustomStat.ullRsr9MCRCOk); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 9M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr9M, (INT)pStatistic->CustomStat.ullRsr9MCRCOk); } else if(byRxRate==24){ pStatistic->CustomStat.ullRsr12M++; - if(BITbIsBitOn(byRSR, RSR_CRCOK)) { + if(byRSR & RSR_CRCOK) { pStatistic->CustomStat.ullRsr12MCRCOk++; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"12M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr12M, (INT)pStatistic->CustomStat.ullRsr12MCRCOk); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"12M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr12M, (INT)pStatistic->CustomStat.ullRsr12MCRCOk); } else if(byRxRate==36){ pStatistic->CustomStat.ullRsr18M++; - if(BITbIsBitOn(byRSR, RSR_CRCOK)) { + if(byRSR & RSR_CRCOK) { pStatistic->CustomStat.ullRsr18MCRCOk++; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"18M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr18M, (INT)pStatistic->CustomStat.ullRsr18MCRCOk); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"18M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr18M, (INT)pStatistic->CustomStat.ullRsr18MCRCOk); } else if(byRxRate==48){ pStatistic->CustomStat.ullRsr24M++; - if(BITbIsBitOn(byRSR, RSR_CRCOK)) { + if(byRSR & RSR_CRCOK) { pStatistic->CustomStat.ullRsr24MCRCOk++; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"24M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr24M, (INT)pStatistic->CustomStat.ullRsr24MCRCOk); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"24M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr24M, (INT)pStatistic->CustomStat.ullRsr24MCRCOk); } else if(byRxRate==72){ pStatistic->CustomStat.ullRsr36M++; - if(BITbIsBitOn(byRSR, RSR_CRCOK)) { + if(byRSR & RSR_CRCOK) { pStatistic->CustomStat.ullRsr36MCRCOk++; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"36M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr36M, (INT)pStatistic->CustomStat.ullRsr36MCRCOk); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"36M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr36M, (INT)pStatistic->CustomStat.ullRsr36MCRCOk); } else if(byRxRate==96){ pStatistic->CustomStat.ullRsr48M++; - if(BITbIsBitOn(byRSR, RSR_CRCOK)) { + if(byRSR & RSR_CRCOK) { pStatistic->CustomStat.ullRsr48MCRCOk++; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"48M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr48M, (INT)pStatistic->CustomStat.ullRsr48MCRCOk); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"48M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr48M, (INT)pStatistic->CustomStat.ullRsr48MCRCOk); } else if(byRxRate==108){ pStatistic->CustomStat.ullRsr54M++; - if(BITbIsBitOn(byRSR, RSR_CRCOK)) { + if(byRSR & RSR_CRCOK) { pStatistic->CustomStat.ullRsr54MCRCOk++; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"54M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr54M, (INT)pStatistic->CustomStat.ullRsr54MCRCOk); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"54M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr54M, (INT)pStatistic->CustomStat.ullRsr54MCRCOk); } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Unknown: Total[%d], CRCOK[%d]\n", (INT)pStatistic->dwRsrRxPacket+1, (INT)pStatistic->dwRsrCRCOk); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Unknown: Total[%d], CRCOK[%d]\n", (INT)pStatistic->dwRsrRxPacket+1, (INT)pStatistic->dwRsrCRCOk); } - if (BITbIsBitOn(byRSR, RSR_BSSIDOK)) + if (byRSR & RSR_BSSIDOK) pStatistic->dwRsrBSSIDOk++; - if (BITbIsBitOn(byRSR, RSR_BCNSSIDOK)) + if (byRSR & RSR_BCNSSIDOK) pStatistic->dwRsrBCNSSIDOk++; - if (BITbIsBitOn(byRSR, RSR_IVLDLEN)) //invalid len (> 2312 byte) + if (byRSR & RSR_IVLDLEN) //invalid len (> 2312 byte) pStatistic->dwRsrLENErr++; - if (BITbIsBitOn(byRSR, RSR_IVLDTYP)) //invalid packet type + if (byRSR & RSR_IVLDTYP) //invalid packet type pStatistic->dwRsrTYPErr++; - if (BITbIsBitOn(byRSR, (RSR_IVLDTYP | RSR_IVLDLEN))) + if (byRSR & (RSR_IVLDTYP | RSR_IVLDLEN)) pStatistic->dwRsrErr++; - if (BITbIsBitOn(byNewRSR, NEWRSR_DECRYPTOK)) + if (byNewRSR & NEWRSR_DECRYPTOK) pStatistic->dwNewRsrDECRYPTOK++; - if (BITbIsBitOn(byNewRSR, NEWRSR_CFPIND)) + if (byNewRSR & NEWRSR_CFPIND) pStatistic->dwNewRsrCFP++; - if (BITbIsBitOn(byNewRSR, NEWRSR_HWUTSF)) + if (byNewRSR & NEWRSR_HWUTSF) pStatistic->dwNewRsrUTSF++; - if (BITbIsBitOn(byNewRSR, NEWRSR_BCNHITAID)) + if (byNewRSR & NEWRSR_BCNHITAID) pStatistic->dwNewRsrHITAID++; - if (BITbIsBitOn(byNewRSR, NEWRSR_BCNHITAID0)) + if (byNewRSR & NEWRSR_BCNHITAID0) pStatistic->dwNewRsrHITAID0++; // increase rx packet count @@ -350,9 +331,9 @@ void STAvUpdateRDStatCounter (PSStatCounter pStatistic, pStatistic->dwRsrRxControl++; } - if (BITbIsBitOn(byRSR, RSR_ADDRBROAD)) + if (byRSR & RSR_ADDRBROAD) pStatistic->dwRsrBroadcast++; - else if (BITbIsBitOn(byRSR, RSR_ADDRMULTI)) + else if (byRSR & RSR_ADDRMULTI) pStatistic->dwRsrMulticast++; else pStatistic->dwRsrDirected++; @@ -427,7 +408,7 @@ STAvUpdateRDStatCounterEx ( // rx length pStatistic->dwCntRxFrmLength = cbFrameLength; // rx pattern, we just see 10 bytes for sample - MEMvCopy(pStatistic->abyCntRxPattern, (PBYTE)pbyBuffer, 10); + memcpy(pStatistic->abyCntRxPattern, (PBYTE)pbyBuffer, 10); } @@ -504,13 +485,13 @@ STAvUpdateTDStatCounter ( } } else { - if (BITbIsBitOn(byTSR1, TSR1_TERR)) + if (byTSR1 & TSR1_TERR) pStatistic->dwTsrErr[uIdx]++; - if (BITbIsBitOn(byTSR1, TSR1_RETRYTMO)) + if (byTSR1 & TSR1_RETRYTMO) pStatistic->dwTsrRetryTimeout[uIdx]++; - if (BITbIsBitOn(byTSR1, TSR1_TMO)) + if (byTSR1 & TSR1_TMO) pStatistic->dwTsrTransmitTimeout[uIdx]++; - if (BITbIsBitOn(byTSR1, ACK_DATA)) + if (byTSR1 & ACK_DATA) pStatistic->dwTsrACKData[uIdx]++; } @@ -552,7 +533,7 @@ STAvUpdateTDStatCounterEx ( // tx length pStatistic->dwCntTxBufLength = uPktLength; // tx pattern, we just see 16 bytes for sample - MEMvCopy(pStatistic->abyCntTxPattern, pbyBuffer, 16); + memcpy(pStatistic->abyCntTxPattern, pbyBuffer, 16); } @@ -612,5 +593,5 @@ void STAvClear802_11Counter(PSDot11Counters p802_11Counter) { // set memory to zero - ZERO_MEMORY(p802_11Counter, sizeof(SDot11Counters)); + memset(p802_11Counter, 0, sizeof(SDot11Counters)); } diff --git a/drivers/staging/vt6655/mib.h b/drivers/staging/vt6655/mib.h index b4e1c4a..69e04f7 100644 --- a/drivers/staging/vt6655/mib.h +++ b/drivers/staging/vt6655/mib.h @@ -29,19 +29,9 @@ #ifndef __MIB_H__ #define __MIB_H__ -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif -#if !defined(__TETHER_H__) #include "tether.h" -#endif -#if !defined(__DESC_H__) #include "desc.h" -#endif - - - -//#define ULONGLONG ULONG /*--------------------- Export Definitions -------------------------*/ // @@ -75,7 +65,7 @@ typedef struct tagSDot11Counters { // ULONGLONG WEPICVErrorCount; // ULONGLONG DecryptSuccessCount; // ULONGLONG DecryptFailureCount; -} SDot11Counters, DEF* PSDot11Counters; +} SDot11Counters, *PSDot11Counters; // @@ -83,7 +73,7 @@ typedef struct tagSDot11Counters { // typedef struct tagSMib2Counter { LONG ifIndex; - TCHAR ifDescr[256]; // max size 255 plus zero ending + char ifDescr[256]; // max size 255 plus zero ending // e.g. "interface 1" LONG ifType; LONG ifMtu; @@ -105,7 +95,7 @@ typedef struct tagSMib2Counter { DWORD ifOutErrors; DWORD ifOutQLen; DWORD ifSpecific; -} SMib2Counter, DEF* PSMib2Counter; +} SMib2Counter, *PSMib2Counter; // Value in the ifType entry //#define ETHERNETCSMACD 6 // @@ -142,7 +132,7 @@ typedef struct tagSRmonCounter { DWORD etherStatsPkt1024to1518Octets; DWORD etherStatsOwners; DWORD etherStatsStatus; -} SRmonCounter, DEF* PSRmonCounter; +} SRmonCounter, *PSRmonCounter; // // Custom counter @@ -180,7 +170,7 @@ typedef struct tagSCustomCounters { ULONGLONG ullRsr9MCRCOk; ULONGLONG ullRsr6MCRCOk; -} SCustomCounters, DEF* PSCustomCounters; +} SCustomCounters, *PSCustomCounters; // @@ -211,7 +201,7 @@ typedef struct tagSISRCounters { DWORD dwIsrSYNCFlushOK; DWORD dwIsrSTIMER1Int; ///////////////////////////////////// -} SISRCounters, DEF* PSISRCounters; +} SISRCounters, *PSISRCounters; // Value in the etherStatsStatus entry @@ -344,17 +334,13 @@ typedef struct tagSStatCounter { ULONG SignalStren; ULONG LinkQuality; #endif -} SStatCounter, DEF* PSStatCounter; +} SStatCounter, *PSStatCounter; /*--------------------- Export Classes ----------------------------*/ /*--------------------- Export Variables --------------------------*/ /*--------------------- Export Functions --------------------------*/ -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ - void STAvClearAllCounter(PSStatCounter pStatistic); @@ -386,13 +372,6 @@ void STAvUpdate802_11Counter( void STAvClear802_11Counter(PSDot11Counters p802_11Counter); -#ifdef __cplusplus -} /* End of extern "C" { */ -#endif /* __cplusplus */ - - - - #endif // __MIB_H__ diff --git a/drivers/staging/vt6655/michael.c b/drivers/staging/vt6655/michael.c index 7bda4c1..c930e0cd 100644 --- a/drivers/staging/vt6655/michael.c +++ b/drivers/staging/vt6655/michael.c @@ -39,15 +39,8 @@ * */ -#if !defined(__TMACRO_H__) #include "tmacro.h" -#endif -#if !defined(__TBIT_H__) -#include "tbit.h" -#endif -#if !defined(__MICHAEL_H__) #include "michael.h" -#endif /*--------------------- Static Definitions -------------------------*/ diff --git a/drivers/staging/vt6655/michael.h b/drivers/staging/vt6655/michael.h index 62a24a6..3f79b52 100644 --- a/drivers/staging/vt6655/michael.h +++ b/drivers/staging/vt6655/michael.h @@ -28,13 +28,9 @@ * */ - #ifndef __MICHAEL_H__ #define __MICHAEL_H__ -#if !defined(__UMEM_H__) -#include "umem.h" -#endif /*--------------------- Export Definitions -------------------------*/ /*--------------------- Export Types ------------------------------*/ diff --git a/drivers/staging/vt6655/power.c b/drivers/staging/vt6655/power.c index edd8336..84eda04 100644 --- a/drivers/staging/vt6655/power.c +++ b/drivers/staging/vt6655/power.c @@ -16,9 +16,10 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + * * File: power.c * - * Purpose: Handles 802.11 power managment functions + * Purpose: Handles 802.11 power management functions * * Author: Lyndon Chen * @@ -36,44 +37,14 @@ * */ - - -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif -#if !defined(__TBIT_H__) -#include "tbit.h" -#endif -#if !defined(__MAC_H__) #include "mac.h" -#endif -#if !defined(__DEVICE_H__) #include "device.h" -#endif -#if !defined(__WMGR_H__) #include "wmgr.h" -#endif -#if !defined(__POWER_H__) #include "power.h" -#endif -#if !defined(__WCMD_H__) #include "wcmd.h" -#endif -#if !defined(__TBIT_H__) -#include "tbit.h" -#endif -#if !defined(__UMEM_H__) -#include "umem.h" -#endif -#if !defined(__RXTX_H__) #include "rxtx.h" -#endif -#if !defined(__CARD_H__) #include "card.h" -#endif - - - /*--------------------- Static Definitions -------------------------*/ @@ -154,7 +125,7 @@ PSvEnablePowerSaving( PSbSendNullPacket(pDevice); } pDevice->bPWBitOn = TRUE; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PS:Power Saving Mode Enable... \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PS:Power Saving Mode Enable... \n"); return; } @@ -261,7 +232,7 @@ PSbConsiderPowerDown( // no Tx, no Rx isr, now go to Doze MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_GO2DOZE); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Go to Doze ZZZZZZZZZZZZZZZ\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Go to Doze ZZZZZZZZZZZZZZZ\n"); return TRUE; } @@ -305,10 +276,10 @@ PSvSendPSPOLL( pTxPacket->cbPayloadLen = 0; // send the frame if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send PS-Poll packet failed..\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send PS-Poll packet failed..\n"); } else { -// DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send PS-Poll packet success..\n"); +// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send PS-Poll packet success..\n"); }; return; @@ -389,12 +360,12 @@ PSbSendNullPacket( pTxPacket->cbPayloadLen = 0; // send the frame if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send Null Packet failed !\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send Null Packet failed !\n"); return FALSE; } else { -// DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send Null Packet success....\n"); +// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send Null Packet success....\n"); } diff --git a/drivers/staging/vt6655/power.h b/drivers/staging/vt6655/power.h index a01e7e9..30634fa 100644 --- a/drivers/staging/vt6655/power.h +++ b/drivers/staging/vt6655/power.h @@ -16,10 +16,9 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * * File: power.h * - * Purpose: Handles 802.11 power managment functions + * Purpose: Handles 802.11 power management functions * * Author: Lyndon Chen * diff --git a/drivers/staging/vt6655/rc4.c b/drivers/staging/vt6655/rc4.c index 0345e32..e6c6131 100644 --- a/drivers/staging/vt6655/rc4.c +++ b/drivers/staging/vt6655/rc4.c @@ -1,5 +1,6 @@ /* - * File: rc4.c + * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. + * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,6 +16,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + * File: rc4.c + * * Purpose: * * Functions: @@ -27,9 +30,7 @@ * */ -#if !defined(__RC4_H__) #include "rc4.h" -#endif VOID rc4_init(PRC4Ext pRC4, PBYTE pbyKey, UINT cbKey_len) { diff --git a/drivers/staging/vt6655/rc4.h b/drivers/staging/vt6655/rc4.h index 4e3ccc5..bf607c9 100644 --- a/drivers/staging/vt6655/rc4.h +++ b/drivers/staging/vt6655/rc4.h @@ -30,11 +30,7 @@ #ifndef __RC4_H__ #define __RC4_H__ -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif - - /*--------------------- Export Definitions -------------------------*/ /*--------------------- Export Types ------------------------------*/ @@ -42,7 +38,7 @@ typedef struct { UINT ux; UINT uy; BYTE abystate[256]; -} RC4Ext, DEF* PRC4Ext; +} RC4Ext, *PRC4Ext; VOID rc4_init(PRC4Ext pRC4, PBYTE pbyKey, UINT cbKey_len); UINT rc4_byte(PRC4Ext pRC4); diff --git a/drivers/staging/vt6655/rf.c b/drivers/staging/vt6655/rf.c index 9d4e3eb..01ab73f 100644 --- a/drivers/staging/vt6655/rf.c +++ b/drivers/staging/vt6655/rf.c @@ -31,21 +31,11 @@ * Revision History: * */ -#if !defined(__MAC_H__) + #include "mac.h" -#endif -#if !defined(__SROM_H__) #include "srom.h" -#endif -#if !defined(__TBIT_H__) -#include "tbit.h" -#endif -#if !defined(__RF_H__) #include "rf.h" -#endif -#if !defined(__BASEBAND_H__) #include "baseband.h" -#endif /*--------------------- Static Definitions -------------------------*/ @@ -642,7 +632,7 @@ BOOL IFRFbWriteEmbeded (DWORD_PTR dwIoBase, DWORD dwData) // W_MAX_TIMEOUT is the timeout period for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortD(dwIoBase + MAC_REG_IFREGCTL, &dwValue); - if (BITbIsBitOn(dwValue, IFREGCTL_DONE)) + if (dwValue & IFREGCTL_DONE) break; } @@ -1215,7 +1205,7 @@ VOID RFvRSSITodBm ( IN PSDevice pDevice, IN BYTE byCurrRSSI, - OUT PLONG pldBm + long * pldBm ) { BYTE byIdx = (((byCurrRSSI & 0xC0) >> 6) & 0x03); diff --git a/drivers/staging/vt6655/rf.h b/drivers/staging/vt6655/rf.h index 05fe17b..f316bcc 100644 --- a/drivers/staging/vt6655/rf.h +++ b/drivers/staging/vt6655/rf.h @@ -27,16 +27,12 @@ * */ - #ifndef __RF_H__ #define __RF_H__ -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif -#if !defined(__DEVICE_H__) #include "device.h" -#endif + /*--------------------- Export Definitions -------------------------*/ // // Baseband RF pair definition in eeprom (Bits 6..0) @@ -79,9 +75,6 @@ /*--------------------- Export Variables --------------------------*/ /*--------------------- Export Functions --------------------------*/ -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ BOOL IFRFbWriteEmbeded(DWORD_PTR dwIoBase, DWORD dwData); BOOL RFbSelectChannel(DWORD_PTR dwIoBase, BYTE byRFType, BYTE byChannel); @@ -100,18 +93,13 @@ VOID RFvRSSITodBm( IN PSDevice pDevice, IN BYTE byCurrRSSI, - OUT PLONG pldBm + long *pldBm ); //{{ RobertYu: 20050104 BOOL RFbAL7230SelectChannelPostProcess(DWORD_PTR dwIoBase, BYTE byOldChannel, BYTE byNewChannel); //}} RobertYu -#ifdef __cplusplus -} /* End of extern "C" { */ -#endif /* __cplusplus */ - - #endif // __RF_H__ diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index c8a4a55..ed3070e 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c @@ -48,55 +48,20 @@ * */ - -#if !defined(__DEVICE_H__) #include "device.h" -#endif -#if !defined(__RXTX_H__) #include "rxtx.h" -#endif -#if !defined(__TETHER_H__) #include "tether.h" -#endif -#if !defined(__CARD_H__) #include "card.h" -#endif -#if !defined(__BSSDB_H__) #include "bssdb.h" -#endif -#if !defined(__MAC_H__) #include "mac.h" -#endif -#if !defined(__BASEBAND_H__) #include "baseband.h" -#endif -#if !defined(__UMEM_H__) -#include "umem.h" -#endif -#if !defined(__MICHAEL_H__) #include "michael.h" -#endif -#if !defined(__TKIP_H__) #include "tkip.h" -#endif -#if !defined(__TCRC_H__) #include "tcrc.h" -#endif -#if !defined(__WCTL_H__) #include "wctl.h" -#endif -#if !defined(__WROUTE_H__) #include "wroute.h" -#endif -#if !defined(__TBIT_H__) -#include "tbit.h" -#endif -#if !defined(__HOSTAP_H__) #include "hostap.h" -#endif -#if !defined(__RF_H__) #include "rf.h" -#endif /*--------------------- Static Definitions -------------------------*/ @@ -167,7 +132,7 @@ static VOID s_vFillRTSHead( IN PSDevice pDevice, - IN BYTE byPktTyp, + IN BYTE byPktType, IN PVOID pvRTS, IN UINT cbFrameLength, IN BOOL bNeedAck, @@ -181,7 +146,7 @@ static VOID s_vGenerateTxParameter( IN PSDevice pDevice, - IN BYTE byPktTyp, + IN BYTE byPktType, IN PVOID pTxBufHead, IN PVOID pvRrvTime, IN PVOID pvRTS, @@ -209,7 +174,7 @@ static UINT s_cbFillTxBufHead ( IN PSDevice pDevice, - IN BYTE byPktTyp, + IN BYTE byPktType, IN PBYTE pbyTxBufferAddr, IN UINT cbFrameBodySize, IN UINT uDMAIdx, @@ -227,7 +192,7 @@ static UINT s_uFillDataHead ( IN PSDevice pDevice, - IN BYTE byPktTyp, + IN BYTE byPktType, IN PVOID pTxDataHead, IN UINT cbFrameLength, IN UINT uDMAIdx, @@ -275,16 +240,16 @@ s_vFillTxKey ( if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) { if (pTransmitKey->uKeyLength == WLAN_WEP232_KEYLEN ){ - MEMvCopy(pDevice->abyPRNG, (PBYTE)&(dwRevIVCounter), 3); - MEMvCopy(pDevice->abyPRNG+3, pTransmitKey->abyKey, pTransmitKey->uKeyLength); + memcpy(pDevice->abyPRNG, (PBYTE)&(dwRevIVCounter), 3); + memcpy(pDevice->abyPRNG+3, pTransmitKey->abyKey, pTransmitKey->uKeyLength); } else { - MEMvCopy(pbyBuf, (PBYTE)&(dwRevIVCounter), 3); - MEMvCopy(pbyBuf+3, pTransmitKey->abyKey, pTransmitKey->uKeyLength); + memcpy(pbyBuf, (PBYTE)&(dwRevIVCounter), 3); + memcpy(pbyBuf+3, pTransmitKey->abyKey, pTransmitKey->uKeyLength); if(pTransmitKey->uKeyLength == WLAN_WEP40_KEYLEN) { - MEMvCopy(pbyBuf+8, (PBYTE)&(dwRevIVCounter), 3); - MEMvCopy(pbyBuf+11, pTransmitKey->abyKey, pTransmitKey->uKeyLength); + memcpy(pbyBuf+8, (PBYTE)&(dwRevIVCounter), 3); + memcpy(pbyBuf+11, pTransmitKey->abyKey, pTransmitKey->uKeyLength); } - MEMvCopy(pDevice->abyPRNG, pbyBuf, 16); + memcpy(pDevice->abyPRNG, pbyBuf, 16); } // Append IV after Mac Header *pdwIV &= WEP_IV_MASK;//00000000 11111111 11111111 11111111 @@ -301,21 +266,21 @@ s_vFillTxKey ( } TKIPvMixKey(pTransmitKey->abyKey, pDevice->abyCurrentNetAddr, pTransmitKey->wTSC15_0, pTransmitKey->dwTSC47_16, pDevice->abyPRNG); - MEMvCopy(pbyBuf, pDevice->abyPRNG, 16); + memcpy(pbyBuf, pDevice->abyPRNG, 16); // Make IV - MEMvCopy(pdwIV, pDevice->abyPRNG, 3); + memcpy(pdwIV, pDevice->abyPRNG, 3); *(pbyIVHead+3) = (BYTE)(((byKeyIndex << 6) & 0xc0) | 0x20); // 0x20 is ExtIV // Append IV&ExtIV after Mac Header *pdwExtIV = cpu_to_le32(pTransmitKey->dwTSC47_16); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"vFillTxKey()---- pdwExtIV: %lx\n", *pdwExtIV); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"vFillTxKey()---- pdwExtIV: %lx\n", *pdwExtIV); } else if (pTransmitKey->byCipherSuite == KEY_CTL_CCMP) { pTransmitKey->wTSC15_0++; if (pTransmitKey->wTSC15_0 == 0) { pTransmitKey->dwTSC47_16++; } - MEMvCopy(pbyBuf, pTransmitKey->abyKey, 16); + memcpy(pbyBuf, pTransmitKey->abyKey, 16); // Make IV *pdwIV = 0; @@ -327,7 +292,7 @@ s_vFillTxKey ( //Fill MICHDR0 *pMICHDR = 0x59; *((PBYTE)(pMICHDR+1)) = 0; // TxPriority - MEMvCopy(pMICHDR+2, &(pMACHeader->abyAddr2[0]), 6); + memcpy(pMICHDR+2, &(pMACHeader->abyAddr2[0]), 6); *((PBYTE)(pMICHDR+8)) = HIBYTE(HIWORD(pTransmitKey->dwTSC47_16)); *((PBYTE)(pMICHDR+9)) = LOBYTE(HIWORD(pTransmitKey->dwTSC47_16)); *((PBYTE)(pMICHDR+10)) = HIBYTE(LOWORD(pTransmitKey->dwTSC47_16)); @@ -345,18 +310,18 @@ s_vFillTxKey ( *((PBYTE)(pMICHDR+17)) = 22; // HLEN[7:0] } wValue = cpu_to_le16(pMACHeader->wFrameCtl & 0xC78F); - MEMvCopy(pMICHDR+18, (PBYTE)&wValue, 2); // MSKFRACTL - MEMvCopy(pMICHDR+20, &(pMACHeader->abyAddr1[0]), 6); - MEMvCopy(pMICHDR+26, &(pMACHeader->abyAddr2[0]), 6); + memcpy(pMICHDR+18, (PBYTE)&wValue, 2); // MSKFRACTL + memcpy(pMICHDR+20, &(pMACHeader->abyAddr1[0]), 6); + memcpy(pMICHDR+26, &(pMACHeader->abyAddr2[0]), 6); //Fill MICHDR2 - MEMvCopy(pMICHDR+32, &(pMACHeader->abyAddr3[0]), 6); + memcpy(pMICHDR+32, &(pMACHeader->abyAddr3[0]), 6); wValue = pMACHeader->wSeqCtl; wValue &= 0x000F; wValue = cpu_to_le16(wValue); - MEMvCopy(pMICHDR+38, (PBYTE)&wValue, 2); // MSKSEQCTL + memcpy(pMICHDR+38, (PBYTE)&wValue, 2); // MSKSEQCTL if (pDevice->bLongHeader) { - MEMvCopy(pMICHDR+40, &(pMACHeader->abyAddr4[0]), 6); + memcpy(pMICHDR+40, &(pMACHeader->abyAddr4[0]), 6); } } } @@ -406,7 +371,7 @@ s_vSWencryption ( -/*byPktTyp : PK_TYPE_11A 0 +/*byPktType : PK_TYPE_11A 0 PK_TYPE_11B 1 PK_TYPE_11GB 2 PK_TYPE_11GA 3 @@ -415,7 +380,7 @@ static UINT s_uGetTxRsvTime ( IN PSDevice pDevice, - IN BYTE byPktTyp, + IN BYTE byPktType, IN UINT cbFrameLength, IN WORD wRate, IN BOOL bNeedAck @@ -423,14 +388,14 @@ s_uGetTxRsvTime ( { UINT uDataTime, uAckTime; - uDataTime = BBuGetFrameTime(pDevice->byPreambleType, byPktTyp, cbFrameLength, wRate); + uDataTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, cbFrameLength, wRate); #ifdef PLICE_DEBUG //printk("s_uGetTxRsvTime is %d\n",uDataTime); #endif - if (byPktTyp == PK_TYPE_11B) {//llb,CCK mode - uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktTyp, 14, (WORD)pDevice->byTopCCKBasicRate); + if (byPktType == PK_TYPE_11B) {//llb,CCK mode + uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, (WORD)pDevice->byTopCCKBasicRate); } else {//11g 2.4G OFDM mode & 11a 5G OFDM mode - uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktTyp, 14, (WORD)pDevice->byTopOFDMBasicRate); + uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, (WORD)pDevice->byTopOFDMBasicRate); } if (bNeedAck) { @@ -447,7 +412,7 @@ UINT s_uGetRTSCTSRsvTime ( IN PSDevice pDevice, IN BYTE byRTSRsvType, - IN BYTE byPktTyp, + IN BYTE byPktType, IN UINT cbFrameLength, IN WORD wCurrentRate ) @@ -457,23 +422,23 @@ s_uGetRTSCTSRsvTime ( uRrvTime = uRTSTime = uCTSTime = uAckTime = uDataTime = 0; - uDataTime = BBuGetFrameTime(pDevice->byPreambleType, byPktTyp, cbFrameLength, wCurrentRate); + uDataTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, cbFrameLength, wCurrentRate); if (byRTSRsvType == 0) { //RTSTxRrvTime_bb - uRTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktTyp, 20, pDevice->byTopCCKBasicRate); - uCTSTime = uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktTyp, 14, pDevice->byTopCCKBasicRate); + uRTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 20, pDevice->byTopCCKBasicRate); + uCTSTime = uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate); } else if (byRTSRsvType == 1){ //RTSTxRrvTime_ba, only in 2.4GHZ - uRTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktTyp, 20, pDevice->byTopCCKBasicRate); - uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktTyp, 14, pDevice->byTopCCKBasicRate); - uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktTyp, 14, pDevice->byTopOFDMBasicRate); + uRTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 20, pDevice->byTopCCKBasicRate); + uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate); + uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate); } else if (byRTSRsvType == 2) { //RTSTxRrvTime_aa - uRTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktTyp, 20, pDevice->byTopOFDMBasicRate); - uCTSTime = uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktTyp, 14, pDevice->byTopOFDMBasicRate); + uRTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 20, pDevice->byTopOFDMBasicRate); + uCTSTime = uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate); } else if (byRTSRsvType == 3) { //CTSTxRrvTime_ba, only in 2.4GHZ - uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktTyp, 14, pDevice->byTopCCKBasicRate); - uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktTyp, 14, pDevice->byTopOFDMBasicRate); + uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate); + uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate); uRrvTime = uCTSTime + uAckTime + uDataTime + 2*pDevice->uSIFS; return uRrvTime; } @@ -757,7 +722,7 @@ static UINT s_uFillDataHead ( IN PSDevice pDevice, - IN BYTE byPktTyp, + IN BYTE byPktType, IN PVOID pTxDataHead, IN UINT cbFrameLength, IN UINT uDMAIdx, @@ -775,11 +740,11 @@ s_uFillDataHead ( return 0; } - if (byPktTyp == PK_TYPE_11GB || byPktTyp == PK_TYPE_11GA) { + if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) { if (byFBOption == AUTO_FB_NONE) { PSTxDataHead_g pBuf = (PSTxDataHead_g)pTxDataHead; //Get SignalField,ServiceField,Length - BBvCaculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktTyp, + BBvCaculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType, (PWORD)&(wLen), (PBYTE)&(pBuf->byServiceField_a), (PBYTE)&(pBuf->bySignalField_a) ); pBuf->wTransmitLength_a = cpu_to_le16(wLen); @@ -789,7 +754,7 @@ s_uFillDataHead ( pBuf->wTransmitLength_b = cpu_to_le16(wLen); //Get Duration and TimeStamp pBuf->wDuration_a = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, - byPktTyp, wCurrentRate, bNeedAck, uFragIdx, + byPktType, wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //1: 2.4GHz pBuf->wDuration_b = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, @@ -805,7 +770,7 @@ s_uFillDataHead ( // Auto Fallback PSTxDataHead_g_FB pBuf = (PSTxDataHead_g_FB)pTxDataHead; //Get SignalField,ServiceField,Length - BBvCaculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktTyp, + BBvCaculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType, (PWORD)&(wLen), (PBYTE)&(pBuf->byServiceField_a), (PBYTE)&(pBuf->bySignalField_a) ); pBuf->wTransmitLength_a = cpu_to_le16(wLen); @@ -814,13 +779,13 @@ s_uFillDataHead ( ); pBuf->wTransmitLength_b = cpu_to_le16(wLen); //Get Duration and TimeStamp - pBuf->wDuration_a = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktTyp, + pBuf->wDuration_a = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //1: 2.4GHz pBuf->wDuration_b = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, PK_TYPE_11B, pDevice->byTopCCKBasicRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //1: 2.4GHz - pBuf->wDuration_a_f0 = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktTyp, + pBuf->wDuration_a_f0 = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //1: 2.4GHz - pBuf->wDuration_a_f1 = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktTyp, + pBuf->wDuration_a_f1 = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //1: 2.4GHz pBuf->wTimeStampOff_a = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]); @@ -829,35 +794,35 @@ s_uFillDataHead ( return (pBuf->wDuration_a); } //if (byFBOption == AUTO_FB_NONE) } - else if (byPktTyp == PK_TYPE_11A) { + else if (byPktType == PK_TYPE_11A) { if ((byFBOption != AUTO_FB_NONE)) { // Auto Fallback PSTxDataHead_a_FB pBuf = (PSTxDataHead_a_FB)pTxDataHead; //Get SignalField,ServiceField,Length - BBvCaculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktTyp, + BBvCaculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType, (PWORD)&(wLen), (PBYTE)&(pBuf->byServiceField), (PBYTE)&(pBuf->bySignalField) ); pBuf->wTransmitLength = cpu_to_le16(wLen); //Get Duration and TimeStampOff - pBuf->wDuration = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktTyp, + pBuf->wDuration = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //0: 5GHz - pBuf->wDuration_f0 = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktTyp, + pBuf->wDuration_f0 = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //0: 5GHz - pBuf->wDuration_f1 = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktTyp, + pBuf->wDuration_f1 = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //0: 5GHz pBuf->wTimeStampOff = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]); return (pBuf->wDuration); } else { PSTxDataHead_ab pBuf = (PSTxDataHead_ab)pTxDataHead; //Get SignalField,ServiceField,Length - BBvCaculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktTyp, + BBvCaculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType, (PWORD)&(wLen), (PBYTE)&(pBuf->byServiceField), (PBYTE)&(pBuf->bySignalField) ); pBuf->wTransmitLength = cpu_to_le16(wLen); //Get Duration and TimeStampOff - pBuf->wDuration = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktTyp, + pBuf->wDuration = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); @@ -869,12 +834,12 @@ s_uFillDataHead ( else { PSTxDataHead_ab pBuf = (PSTxDataHead_ab)pTxDataHead; //Get SignalField,ServiceField,Length - BBvCaculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktTyp, + BBvCaculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType, (PWORD)&(wLen), (PBYTE)&(pBuf->byServiceField), (PBYTE)&(pBuf->bySignalField) ); pBuf->wTransmitLength = cpu_to_le16(wLen); //Get Duration and TimeStampOff - pBuf->wDuration = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, byPktTyp, + pBuf->wDuration = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, byPktType, wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); @@ -889,7 +854,7 @@ static VOID s_vFillRTSHead ( IN PSDevice pDevice, - IN BYTE byPktTyp, + IN BYTE byPktType, IN PVOID pvRTS, IN UINT cbFrameLength, IN BOOL bNeedAck, @@ -902,9 +867,6 @@ s_vFillRTSHead ( UINT uRTSFrameLen = 20; WORD wLen = 0x0000; - // dummy code, only to avoid compiler warning message - UNREFERENCED_PARAMETER(bNeedAck); - if (pvRTS == NULL) return; @@ -916,7 +878,7 @@ s_vFillRTSHead ( // Note: So far RTSHead dosen't appear in ATIM & Beacom DMA, so we don't need to take them into account. // Otherwise, we need to modified codes for them. - if (byPktTyp == PK_TYPE_11GB || byPktTyp == PK_TYPE_11GA) { + if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) { if (byFBOption == AUTO_FB_NONE) { PSRTS_g pBuf = (PSRTS_g)pvRTS; //Get SignalField,ServiceField,Length @@ -924,30 +886,30 @@ s_vFillRTSHead ( (PWORD)&(wLen), (PBYTE)&(pBuf->byServiceField_b), (PBYTE)&(pBuf->bySignalField_b) ); pBuf->wTransmitLength_b = cpu_to_le16(wLen); - BBvCaculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktTyp, + BBvCaculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType, (PWORD)&(wLen), (PBYTE)&(pBuf->byServiceField_a), (PBYTE)&(pBuf->bySignalField_a) ); pBuf->wTransmitLength_a = cpu_to_le16(wLen); //Get Duration pBuf->wDuration_bb = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, PK_TYPE_11B, pDevice->byTopCCKBasicRate, bNeedAck, byFBOption)); //0:RTSDuration_bb, 1:2.4G, 1:CCKData - pBuf->wDuration_aa = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktTyp, wCurrentRate, bNeedAck, byFBOption)); //2:RTSDuration_aa, 1:2.4G, 2,3: 2.4G OFDMData - pBuf->wDuration_ba = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, cbFrameLength, byPktTyp, wCurrentRate, bNeedAck, byFBOption)); //1:RTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data + pBuf->wDuration_aa = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //2:RTSDuration_aa, 1:2.4G, 2,3: 2.4G OFDMData + pBuf->wDuration_ba = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //1:RTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data pBuf->Data.wDurationID = pBuf->wDuration_aa; //Get RTS Frame body pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4 if ((pDevice->eOPMode == OP_MODE_ADHOC) || (pDevice->eOPMode == OP_MODE_AP)) { - MEMvCopy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); } else { - MEMvCopy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); } if (pDevice->eOPMode == OP_MODE_AP) { - MEMvCopy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); } else { - MEMvCopy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); } } else { @@ -957,101 +919,101 @@ s_vFillRTSHead ( (PWORD)&(wLen), (PBYTE)&(pBuf->byServiceField_b), (PBYTE)&(pBuf->bySignalField_b) ); pBuf->wTransmitLength_b = cpu_to_le16(wLen); - BBvCaculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktTyp, + BBvCaculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType, (PWORD)&(wLen), (PBYTE)&(pBuf->byServiceField_a), (PBYTE)&(pBuf->bySignalField_a) ); pBuf->wTransmitLength_a = cpu_to_le16(wLen); //Get Duration pBuf->wDuration_bb = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, PK_TYPE_11B, pDevice->byTopCCKBasicRate, bNeedAck, byFBOption)); //0:RTSDuration_bb, 1:2.4G, 1:CCKData - pBuf->wDuration_aa = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktTyp, wCurrentRate, bNeedAck, byFBOption)); //2:RTSDuration_aa, 1:2.4G, 2,3:2.4G OFDMData - pBuf->wDuration_ba = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, cbFrameLength, byPktTyp, wCurrentRate, bNeedAck, byFBOption)); //1:RTSDuration_ba, 1:2.4G, 2,3:2.4G OFDMData - pBuf->wRTSDuration_ba_f0 = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F0, cbFrameLength, byPktTyp, wCurrentRate, bNeedAck, byFBOption)); //4:wRTSDuration_ba_f0, 1:2.4G, 1:CCKData - pBuf->wRTSDuration_aa_f0 = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, cbFrameLength, byPktTyp, wCurrentRate, bNeedAck, byFBOption)); //5:wRTSDuration_aa_f0, 1:2.4G, 1:CCKData - pBuf->wRTSDuration_ba_f1 = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F1, cbFrameLength, byPktTyp, wCurrentRate, bNeedAck, byFBOption)); //6:wRTSDuration_ba_f1, 1:2.4G, 1:CCKData - pBuf->wRTSDuration_aa_f1 = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, cbFrameLength, byPktTyp, wCurrentRate, bNeedAck, byFBOption)); //7:wRTSDuration_aa_f1, 1:2.4G, 1:CCKData + pBuf->wDuration_aa = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //2:RTSDuration_aa, 1:2.4G, 2,3:2.4G OFDMData + pBuf->wDuration_ba = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //1:RTSDuration_ba, 1:2.4G, 2,3:2.4G OFDMData + pBuf->wRTSDuration_ba_f0 = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //4:wRTSDuration_ba_f0, 1:2.4G, 1:CCKData + pBuf->wRTSDuration_aa_f0 = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //5:wRTSDuration_aa_f0, 1:2.4G, 1:CCKData + pBuf->wRTSDuration_ba_f1 = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //6:wRTSDuration_ba_f1, 1:2.4G, 1:CCKData + pBuf->wRTSDuration_aa_f1 = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //7:wRTSDuration_aa_f1, 1:2.4G, 1:CCKData pBuf->Data.wDurationID = pBuf->wDuration_aa; //Get RTS Frame body pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4 if ((pDevice->eOPMode == OP_MODE_ADHOC) || (pDevice->eOPMode == OP_MODE_AP)) { - MEMvCopy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); } else { - MEMvCopy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); } if (pDevice->eOPMode == OP_MODE_AP) { - MEMvCopy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); } else { - MEMvCopy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); } } // if (byFBOption == AUTO_FB_NONE) } - else if (byPktTyp == PK_TYPE_11A) { + else if (byPktType == PK_TYPE_11A) { if (byFBOption == AUTO_FB_NONE) { PSRTS_ab pBuf = (PSRTS_ab)pvRTS; //Get SignalField,ServiceField,Length - BBvCaculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktTyp, + BBvCaculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType, (PWORD)&(wLen), (PBYTE)&(pBuf->byServiceField), (PBYTE)&(pBuf->bySignalField) ); pBuf->wTransmitLength = cpu_to_le16(wLen); //Get Duration - pBuf->wDuration = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktTyp, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_aa, 0:5G, 0: 5G OFDMData + pBuf->wDuration = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_aa, 0:5G, 0: 5G OFDMData pBuf->Data.wDurationID = pBuf->wDuration; //Get RTS Frame body pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4 if ((pDevice->eOPMode == OP_MODE_ADHOC) || (pDevice->eOPMode == OP_MODE_AP)) { - MEMvCopy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); } else { - MEMvCopy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); } if (pDevice->eOPMode == OP_MODE_AP) { - MEMvCopy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); } else { - MEMvCopy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); } } else { PSRTS_a_FB pBuf = (PSRTS_a_FB)pvRTS; //Get SignalField,ServiceField,Length - BBvCaculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktTyp, + BBvCaculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType, (PWORD)&(wLen), (PBYTE)&(pBuf->byServiceField), (PBYTE)&(pBuf->bySignalField) ); pBuf->wTransmitLength = cpu_to_le16(wLen); //Get Duration - pBuf->wDuration = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktTyp, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_aa, 0:5G, 0: 5G OFDMData - pBuf->wRTSDuration_f0 = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, cbFrameLength, byPktTyp, wCurrentRate, bNeedAck, byFBOption)); //5:RTSDuration_aa_f0, 0:5G, 0: 5G OFDMData - pBuf->wRTSDuration_f1 = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, cbFrameLength, byPktTyp, wCurrentRate, bNeedAck, byFBOption)); //7:RTSDuration_aa_f1, 0:5G, 0: + pBuf->wDuration = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_aa, 0:5G, 0: 5G OFDMData + pBuf->wRTSDuration_f0 = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //5:RTSDuration_aa_f0, 0:5G, 0: 5G OFDMData + pBuf->wRTSDuration_f1 = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //7:RTSDuration_aa_f1, 0:5G, 0: pBuf->Data.wDurationID = pBuf->wDuration; //Get RTS Frame body pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4 if ((pDevice->eOPMode == OP_MODE_ADHOC) || (pDevice->eOPMode == OP_MODE_AP)) { - MEMvCopy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); } else { - MEMvCopy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); } if (pDevice->eOPMode == OP_MODE_AP) { - MEMvCopy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); } else { - MEMvCopy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); } } } - else if (byPktTyp == PK_TYPE_11B) { + else if (byPktType == PK_TYPE_11B) { PSRTS_ab pBuf = (PSRTS_ab)pvRTS; //Get SignalField,ServiceField,Length BBvCaculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B, @@ -1059,7 +1021,7 @@ s_vFillRTSHead ( ); pBuf->wTransmitLength = cpu_to_le16(wLen); //Get Duration - pBuf->wDuration = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, byPktTyp, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_bb, 1:2.4G, 1:CCKData + pBuf->wDuration = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_bb, 1:2.4G, 1:CCKData pBuf->Data.wDurationID = pBuf->wDuration; //Get RTS Frame body pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4 @@ -1067,17 +1029,17 @@ s_vFillRTSHead ( if ((pDevice->eOPMode == OP_MODE_ADHOC) || (pDevice->eOPMode == OP_MODE_AP)) { - MEMvCopy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); } else { - MEMvCopy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); } if (pDevice->eOPMode == OP_MODE_AP) { - MEMvCopy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); } else { - MEMvCopy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); } } } @@ -1087,7 +1049,7 @@ VOID s_vFillCTSHead ( IN PSDevice pDevice, IN UINT uDMAIdx, - IN BYTE byPktTyp, + IN BYTE byPktType, IN PVOID pvCTS, IN UINT cbFrameLength, IN BOOL bNeedAck, @@ -1109,7 +1071,7 @@ s_vFillCTSHead ( uCTSFrameLen -= 4; } - if (byPktTyp == PK_TYPE_11GB || byPktTyp == PK_TYPE_11GA) { + if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) { if (byFBOption != AUTO_FB_NONE && uDMAIdx != TYPE_ATIMDMA && uDMAIdx != TYPE_BEACONDMA) { // Auto Fall back PSCTS_FB pBuf = (PSCTS_FB)pvCTS; @@ -1121,22 +1083,22 @@ s_vFillCTSHead ( pBuf->wTransmitLength_b = cpu_to_le16(wLen); - pBuf->wDuration_ba = (WORD)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength, byPktTyp, wCurrentRate, bNeedAck, byFBOption); //3:CTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data + pBuf->wDuration_ba = (WORD)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //3:CTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data pBuf->wDuration_ba += pDevice->wCTSDuration; pBuf->wDuration_ba = cpu_to_le16(pBuf->wDuration_ba); //Get CTSDuration_ba_f0 - pBuf->wCTSDuration_ba_f0 = (WORD)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F0, cbFrameLength, byPktTyp, wCurrentRate, bNeedAck, byFBOption); //8:CTSDuration_ba_f0, 1:2.4G, 2,3:2.4G OFDM Data + pBuf->wCTSDuration_ba_f0 = (WORD)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //8:CTSDuration_ba_f0, 1:2.4G, 2,3:2.4G OFDM Data pBuf->wCTSDuration_ba_f0 += pDevice->wCTSDuration; pBuf->wCTSDuration_ba_f0 = cpu_to_le16(pBuf->wCTSDuration_ba_f0); //Get CTSDuration_ba_f1 - pBuf->wCTSDuration_ba_f1 = (WORD)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F1, cbFrameLength, byPktTyp, wCurrentRate, bNeedAck, byFBOption); //9:CTSDuration_ba_f1, 1:2.4G, 2,3:2.4G OFDM Data + pBuf->wCTSDuration_ba_f1 = (WORD)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //9:CTSDuration_ba_f1, 1:2.4G, 2,3:2.4G OFDM Data pBuf->wCTSDuration_ba_f1 += pDevice->wCTSDuration; pBuf->wCTSDuration_ba_f1 = cpu_to_le16(pBuf->wCTSDuration_ba_f1); //Get CTS Frame body pBuf->Data.wDurationID = pBuf->wDuration_ba; pBuf->Data.wFrameControl = TYPE_CTL_CTS;//0x00C4 pBuf->Data.wReserved = 0x0000; - MEMvCopy(&(pBuf->Data.abyRA[0]), &(pDevice->abyCurrentNetAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyCurrentNetAddr[0]), U_ETHER_ADDR_LEN); } else { //if (byFBOption != AUTO_FB_NONE && uDMAIdx != TYPE_ATIMDMA && uDMAIdx != TYPE_BEACONDMA) PSCTS pBuf = (PSCTS)pvCTS; @@ -1146,7 +1108,7 @@ s_vFillCTSHead ( ); pBuf->wTransmitLength_b = cpu_to_le16(wLen); //Get CTSDuration_ba - pBuf->wDuration_ba = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength, byPktTyp, wCurrentRate, bNeedAck, byFBOption)); //3:CTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data + pBuf->wDuration_ba = cpu_to_le16((WORD)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //3:CTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data pBuf->wDuration_ba += pDevice->wCTSDuration; pBuf->wDuration_ba = cpu_to_le16(pBuf->wDuration_ba); @@ -1154,7 +1116,7 @@ s_vFillCTSHead ( pBuf->Data.wDurationID = pBuf->wDuration_ba; pBuf->Data.wFrameControl = TYPE_CTL_CTS;//0x00C4 pBuf->Data.wReserved = 0x0000; - MEMvCopy(&(pBuf->Data.abyRA[0]), &(pDevice->abyCurrentNetAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyCurrentNetAddr[0]), U_ETHER_ADDR_LEN); } } } @@ -1191,7 +1153,7 @@ static VOID s_vGenerateTxParameter ( IN PSDevice pDevice, - IN BYTE byPktTyp, + IN BYTE byPktType, IN PVOID pTxBufHead, IN PVOID pvRrvTime, IN PVOID pvRTS, @@ -1209,7 +1171,7 @@ s_vGenerateTxParameter ( BYTE byFBOption = AUTO_FB_NONE; // WORD wCurrentRate = pDevice->wCurrentRate; - //DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_vGenerateTxParameter...\n"); + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_vGenerateTxParameter...\n"); PSTxBufHead pFifoHead = (PSTxBufHead)pTxBufHead; pFifoHead->wReserved = wCurrentRate; wFifoCtl = pFifoHead->wFIFOCtl; @@ -1228,47 +1190,47 @@ s_vGenerateTxParameter ( if (pDevice->bLongHeader) cbMACHdLen = WLAN_HDR_ADDR3_LEN + 6; - if (byPktTyp == PK_TYPE_11GB || byPktTyp == PK_TYPE_11GA) { + if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) { if (pvRTS != NULL) { //RTS_need //Fill RsvTime if (pvRrvTime) { PSRrvTime_gRTS pBuf = (PSRrvTime_gRTS)pvRrvTime; - pBuf->wRTSTxRrvTime_aa = cpu_to_le16((WORD)s_uGetRTSCTSRsvTime(pDevice, 2, byPktTyp, cbFrameSize, wCurrentRate));//2:RTSTxRrvTime_aa, 1:2.4GHz - pBuf->wRTSTxRrvTime_ba = cpu_to_le16((WORD)s_uGetRTSCTSRsvTime(pDevice, 1, byPktTyp, cbFrameSize, wCurrentRate));//1:RTSTxRrvTime_ba, 1:2.4GHz - pBuf->wRTSTxRrvTime_bb = cpu_to_le16((WORD)s_uGetRTSCTSRsvTime(pDevice, 0, byPktTyp, cbFrameSize, wCurrentRate));//0:RTSTxRrvTime_bb, 1:2.4GHz - pBuf->wTxRrvTime_a = cpu_to_le16((WORD) s_uGetTxRsvTime(pDevice, byPktTyp, cbFrameSize, wCurrentRate, bNeedACK));//2.4G OFDM + pBuf->wRTSTxRrvTime_aa = cpu_to_le16((WORD)s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate));//2:RTSTxRrvTime_aa, 1:2.4GHz + pBuf->wRTSTxRrvTime_ba = cpu_to_le16((WORD)s_uGetRTSCTSRsvTime(pDevice, 1, byPktType, cbFrameSize, wCurrentRate));//1:RTSTxRrvTime_ba, 1:2.4GHz + pBuf->wRTSTxRrvTime_bb = cpu_to_le16((WORD)s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate));//0:RTSTxRrvTime_bb, 1:2.4GHz + pBuf->wTxRrvTime_a = cpu_to_le16((WORD) s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));//2.4G OFDM pBuf->wTxRrvTime_b = cpu_to_le16((WORD) s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK));//1:CCK } //Fill RTS - s_vFillRTSHead(pDevice, byPktTyp, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption); + s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption); } else {//RTS_needless, PCF mode //Fill RsvTime if (pvRrvTime) { PSRrvTime_gCTS pBuf = (PSRrvTime_gCTS)pvRrvTime; - pBuf->wTxRrvTime_a = cpu_to_le16((WORD)s_uGetTxRsvTime(pDevice, byPktTyp, cbFrameSize, wCurrentRate, bNeedACK));//2.4G OFDM + pBuf->wTxRrvTime_a = cpu_to_le16((WORD)s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));//2.4G OFDM pBuf->wTxRrvTime_b = cpu_to_le16((WORD)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK));//1:CCK - pBuf->wCTSTxRrvTime_ba = cpu_to_le16((WORD)s_uGetRTSCTSRsvTime(pDevice, 3, byPktTyp, cbFrameSize, wCurrentRate));//3:CTSTxRrvTime_Ba, 1:2.4GHz + pBuf->wCTSTxRrvTime_ba = cpu_to_le16((WORD)s_uGetRTSCTSRsvTime(pDevice, 3, byPktType, cbFrameSize, wCurrentRate));//3:CTSTxRrvTime_Ba, 1:2.4GHz } //Fill CTS - s_vFillCTSHead(pDevice, uDMAIdx, byPktTyp, pvCTS, cbFrameSize, bNeedACK, bDisCRC, wCurrentRate, byFBOption); + s_vFillCTSHead(pDevice, uDMAIdx, byPktType, pvCTS, cbFrameSize, bNeedACK, bDisCRC, wCurrentRate, byFBOption); } } - else if (byPktTyp == PK_TYPE_11A) { + else if (byPktType == PK_TYPE_11A) { if (pvRTS != NULL) {//RTS_need, non PCF mode //Fill RsvTime if (pvRrvTime) { PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime; - pBuf->wRTSTxRrvTime = cpu_to_le16((WORD)s_uGetRTSCTSRsvTime(pDevice, 2, byPktTyp, cbFrameSize, wCurrentRate));//2:RTSTxRrvTime_aa, 0:5GHz - pBuf->wTxRrvTime = cpu_to_le16((WORD)s_uGetTxRsvTime(pDevice, byPktTyp, cbFrameSize, wCurrentRate, bNeedACK));//0:OFDM + pBuf->wRTSTxRrvTime = cpu_to_le16((WORD)s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate));//2:RTSTxRrvTime_aa, 0:5GHz + pBuf->wTxRrvTime = cpu_to_le16((WORD)s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));//0:OFDM } //Fill RTS - s_vFillRTSHead(pDevice, byPktTyp, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption); + s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption); } else if (pvRTS == NULL) {//RTS_needless, non PCF mode //Fill RsvTime @@ -1278,17 +1240,17 @@ s_vGenerateTxParameter ( } } } - else if (byPktTyp == PK_TYPE_11B) { + else if (byPktType == PK_TYPE_11B) { if ((pvRTS != NULL)) {//RTS_need, non PCF mode //Fill RsvTime if (pvRrvTime) { PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime; - pBuf->wRTSTxRrvTime = cpu_to_le16((WORD)s_uGetRTSCTSRsvTime(pDevice, 0, byPktTyp, cbFrameSize, wCurrentRate));//0:RTSTxRrvTime_bb, 1:2.4GHz + pBuf->wRTSTxRrvTime = cpu_to_le16((WORD)s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate));//0:RTSTxRrvTime_bb, 1:2.4GHz pBuf->wTxRrvTime = cpu_to_le16((WORD)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK));//1:CCK } //Fill RTS - s_vFillRTSHead(pDevice, byPktTyp, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption); + s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption); } else { //RTS_needless, non PCF mode //Fill RsvTime @@ -1298,7 +1260,7 @@ s_vGenerateTxParameter ( } } } - //DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_vGenerateTxParameter END.\n"); + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_vGenerateTxParameter END.\n"); } /* PBYTE pbyBuffer,//point to pTxBufHead @@ -1317,7 +1279,7 @@ s_vFillFragParameter( ) { PSTxBufHead pTxBufHead = (PSTxBufHead) pbyBuffer; - //DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_vFillFragParameter...\n"); + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_vFillFragParameter...\n"); if (uTxType == TYPE_SYNCDMA) { //PSTxSyncDesc ptdCurr = (PSTxSyncDesc)s_pvGetTxDescHead(pDevice, uTxType, uCurIdx); @@ -1350,14 +1312,14 @@ s_vFillFragParameter( pTxBufHead->wFragCtl |= (WORD)wFragType;//0x0001; //0000 0000 0000 0001 - //DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_vFillFragParameter END\n"); + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_vFillFragParameter END\n"); } static UINT s_cbFillTxBufHead ( IN PSDevice pDevice, - IN BYTE byPktTyp, + IN BYTE byPktType, IN PBYTE pbyTxBufferAddr, IN UINT cbFrameBodySize, IN UINT uDMAIdx, @@ -1428,7 +1390,7 @@ s_cbFillTxBufHead ( pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd = NULL; - //DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_cbFillTxBufHead...\n"); + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_cbFillTxBufHead...\n"); if ((pDevice->eOPMode == OP_MODE_ADHOC) || (pDevice->eOPMode == OP_MODE_AP)) { @@ -1504,7 +1466,7 @@ s_cbFillTxBufHead ( ////////////////////////////////////////////////////// //Set RrvTime/RTS/CTS Buffer wTxBufSize = sizeof(STxBufHead); - if (byPktTyp == PK_TYPE_11GB || byPktTyp == PK_TYPE_11GA) {//802.11g packet + if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet if (byFBOption == AUTO_FB_NONE) { if (bRTS == TRUE) {//RTS_need @@ -1582,7 +1544,7 @@ s_cbFillTxBufHead ( } } // Auto Fall Back } - ZERO_MEMORY((PVOID)(pbyTxBufferAddr + wTxBufSize), (cbHeaderLength - wTxBufSize)); + memset((PVOID)(pbyTxBufferAddr + wTxBufSize), 0, (cbHeaderLength - wTxBufSize)); ////////////////////////////////////////////////////////////////// if ((bNeedEncrypt == TRUE) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) { @@ -1603,7 +1565,7 @@ s_cbFillTxBufHead ( MIC_vAppend((PBYTE)&(psEthHeader->abyDstAddr[0]), 12); dwMIC_Priority = 0; MIC_vAppend((PBYTE)&dwMIC_Priority, 4); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC KEY: %lX, %lX\n", dwMICKey0, dwMICKey1); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC KEY: %lX, %lX\n", dwMICKey0, dwMICKey1); } /////////////////////////////////////////////////////////////////// @@ -1633,15 +1595,15 @@ s_cbFillTxBufHead ( //========================= // Start Fragmentation //========================= - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Start Fragmentation...\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Start Fragmentation...\n"); wFragType = FRAGCTL_STAFRAG; //Fill FIFO,RrvTime,RTS,and CTS - s_vGenerateTxParameter(pDevice, byPktTyp, (PVOID)psTxBufHd, pvRrvTime, pvRTS, pvCTS, + s_vGenerateTxParameter(pDevice, byPktType, (PVOID)psTxBufHd, pvRrvTime, pvRTS, pvCTS, cbFragmentSize, bNeedACK, uDMAIdx, psEthHeader, pDevice->wCurrentRate); //Fill DataHead - uDuration = s_uFillDataHead(pDevice, byPktTyp, pvTxDataHd, cbFragmentSize, uDMAIdx, bNeedACK, + uDuration = s_uFillDataHead(pDevice, byPktType, pvTxDataHd, cbFragmentSize, uDMAIdx, bNeedACK, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption, pDevice->wCurrentRate); // Generate TX MAC Header vGenerateMACHeader(pDevice, pbyMacHdr, (WORD)uDuration, psEthHeader, bNeedEncrypt, @@ -1663,13 +1625,13 @@ s_cbFillTxBufHead ( if (ntohs(psEthHeader->wType) > MAX_DATA_LEN) { if ((psEthHeader->wType == TYPE_PKT_IPX) || (psEthHeader->wType == cpu_to_le16(0xF380))) { - MEMvCopy((PBYTE) (pbyPayloadHead), &pDevice->abySNAP_Bridgetunnel[0], 6); + memcpy((PBYTE) (pbyPayloadHead), &pDevice->abySNAP_Bridgetunnel[0], 6); } else { - MEMvCopy((PBYTE) (pbyPayloadHead), &pDevice->abySNAP_RFC1042[0], 6); + memcpy((PBYTE) (pbyPayloadHead), &pDevice->abySNAP_RFC1042[0], 6); } pbyType = (PBYTE) (pbyPayloadHead + 6); - MEMvCopy(pbyType, &(psEthHeader->wType), sizeof(WORD)); + memcpy(pbyType, &(psEthHeader->wType), sizeof(WORD)); cb802_1_H_len = 8; } @@ -1691,16 +1653,16 @@ s_cbFillTxBufHead ( uLength = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen + cb802_1_H_len; //copy TxBufferHeader + MacHeader to desc - MEMvCopy(pbyBuffer, (PVOID)psTxBufHd, uLength); + memcpy(pbyBuffer, (PVOID)psTxBufHd, uLength); // Copy the Packet into a tx Buffer - MEMvCopy((pbyBuffer + uLength), (pPacket + 14), (cbFragPayloadSize - cb802_1_H_len)); + memcpy((pbyBuffer + uLength), (pPacket + 14), (cbFragPayloadSize - cb802_1_H_len)); uTotalCopyLength += cbFragPayloadSize - cb802_1_H_len; if ((bNeedEncrypt == TRUE) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Start MIC: %d\n", cbFragPayloadSize); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Start MIC: %d\n", cbFragPayloadSize); MIC_vAppend((pbyBuffer + uLength - cb802_1_H_len), cbFragPayloadSize); } @@ -1736,16 +1698,16 @@ s_cbFillTxBufHead ( //========================= // Last Fragmentation //========================= - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Last Fragmentation...\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Last Fragmentation...\n"); //tmpDescIdx = (uDescIdx + uFragIdx) % pDevice->cbTD[uDMAIdx]; wFragType = FRAGCTL_ENDFRAG; //Fill FIFO,RrvTime,RTS,and CTS - s_vGenerateTxParameter(pDevice, byPktTyp, (PVOID)psTxBufHd, pvRrvTime, pvRTS, pvCTS, + s_vGenerateTxParameter(pDevice, byPktType, (PVOID)psTxBufHd, pvRrvTime, pvRTS, pvCTS, cbLastFragmentSize, bNeedACK, uDMAIdx, psEthHeader, pDevice->wCurrentRate); //Fill DataHead - uDuration = s_uFillDataHead(pDevice, byPktTyp, pvTxDataHd, cbLastFragmentSize, uDMAIdx, bNeedACK, + uDuration = s_uFillDataHead(pDevice, byPktType, pvTxDataHd, cbLastFragmentSize, uDMAIdx, bNeedACK, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption, pDevice->wCurrentRate); // Generate TX MAC Header @@ -1778,12 +1740,12 @@ s_cbFillTxBufHead ( uLength = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen; //copy TxBufferHeader + MacHeader to desc - MEMvCopy(pbyBuffer, (PVOID)psTxBufHd, uLength); + memcpy(pbyBuffer, (PVOID)psTxBufHd, uLength); // Copy the Packet into a tx Buffer if (bMIC2Frag == FALSE) { - MEMvCopy((pbyBuffer + uLength), + memcpy((pbyBuffer + uLength), (pPacket + 14 + uTotalCopyLength), (cbLastFragPayloadSize - cbMIClen) ); @@ -1792,7 +1754,7 @@ s_cbFillTxBufHead ( } if ((bNeedEncrypt == TRUE) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"LAST: uMICFragLen:%d, cbLastFragPayloadSize:%d, uTmpLen:%d\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"LAST: uMICFragLen:%d, cbLastFragPayloadSize:%d, uTmpLen:%d\n", uMICFragLen, cbLastFragPayloadSize, uTmpLen); if (bMIC2Frag == FALSE) { @@ -1801,28 +1763,28 @@ s_cbFillTxBufHead ( pdwMIC_L = (PDWORD)(pbyBuffer + uLength + uTmpLen); pdwMIC_R = (PDWORD)(pbyBuffer + uLength + uTmpLen + 4); MIC_vGetMIC(pdwMIC_L, pdwMIC_R); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Last MIC:%lX, %lX\n", *pdwMIC_L, *pdwMIC_R); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Last MIC:%lX, %lX\n", *pdwMIC_L, *pdwMIC_R); } else { if (uMICFragLen >= 4) { - MEMvCopy((pbyBuffer + uLength), ((PBYTE)&dwSafeMIC_R + (uMICFragLen - 4)), + memcpy((pbyBuffer + uLength), ((PBYTE)&dwSafeMIC_R + (uMICFragLen - 4)), (cbMIClen - uMICFragLen)); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"LAST: uMICFragLen >= 4: %X, %d\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"LAST: uMICFragLen >= 4: %X, %d\n", *(PBYTE)((PBYTE)&dwSafeMIC_R + (uMICFragLen - 4)), (cbMIClen - uMICFragLen)); } else { - MEMvCopy((pbyBuffer + uLength), ((PBYTE)&dwSafeMIC_L + uMICFragLen), + memcpy((pbyBuffer + uLength), ((PBYTE)&dwSafeMIC_L + uMICFragLen), (4 - uMICFragLen)); - MEMvCopy((pbyBuffer + uLength + (4 - uMICFragLen)), &dwSafeMIC_R, 4); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"LAST: uMICFragLen < 4: %X, %d\n", + memcpy((pbyBuffer + uLength + (4 - uMICFragLen)), &dwSafeMIC_R, 4); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"LAST: uMICFragLen < 4: %X, %d\n", *(PBYTE)((PBYTE)&dwSafeMIC_R + uMICFragLen - 4), (cbMIClen - uMICFragLen)); } /* for (ii = 0; ii < cbLastFragPayloadSize + 8 + 24; ii++) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02x ", *((PBYTE)((pbyBuffer + uLength) + ii - 8 - 24))); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02x ", *((PBYTE)((pbyBuffer + uLength) + ii - 8 - 24))); } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n\n"); */ } MIC_vUnInit(); @@ -1866,16 +1828,16 @@ s_cbFillTxBufHead ( //========================= // Middle Fragmentation //========================= - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Middle Fragmentation...\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Middle Fragmentation...\n"); //tmpDescIdx = (uDescIdx + uFragIdx) % pDevice->cbTD[uDMAIdx]; wFragType = FRAGCTL_MIDFRAG; //Fill FIFO,RrvTime,RTS,and CTS - s_vGenerateTxParameter(pDevice, byPktTyp, (PVOID)psTxBufHd, pvRrvTime, pvRTS, pvCTS, + s_vGenerateTxParameter(pDevice, byPktType, (PVOID)psTxBufHd, pvRrvTime, pvRTS, pvCTS, cbFragmentSize, bNeedACK, uDMAIdx, psEthHeader, pDevice->wCurrentRate); //Fill DataHead - uDuration = s_uFillDataHead(pDevice, byPktTyp, pvTxDataHd, cbFragmentSize, uDMAIdx, bNeedACK, + uDuration = s_uFillDataHead(pDevice, byPktType, pvTxDataHd, cbFragmentSize, uDMAIdx, bNeedACK, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption, pDevice->wCurrentRate); // Generate TX MAC Header @@ -1913,10 +1875,10 @@ s_cbFillTxBufHead ( uLength = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen; //copy TxBufferHeader + MacHeader to desc - MEMvCopy(pbyBuffer, (PVOID)psTxBufHd, uLength); + memcpy(pbyBuffer, (PVOID)psTxBufHd, uLength); // Copy the Packet into a tx Buffer - MEMvCopy((pbyBuffer + uLength), + memcpy((pbyBuffer + uLength), (pPacket + 14 + uTotalCopyLength), cbFragPayloadSize ); @@ -1939,23 +1901,23 @@ s_cbFillTxBufHead ( dwSafeMIC_L = *pdwMIC_L; dwSafeMIC_R = *pdwMIC_R; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIDDLE: uMICFragLen:%d, cbFragPayloadSize:%d, uTmpLen:%d\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIDDLE: uMICFragLen:%d, cbFragPayloadSize:%d, uTmpLen:%d\n", uMICFragLen, cbFragPayloadSize, uTmpLen); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Fill MIC in Middle frag [%d]\n", uMICFragLen); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Fill MIC in Middle frag [%d]\n", uMICFragLen); /* for (ii = 0; ii < uMICFragLen; ii++) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02x ", *((PBYTE)((pbyBuffer + uLength + uTmpLen) + ii))); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02x ", *((PBYTE)((pbyBuffer + uLength + uTmpLen) + ii))); } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); */ - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Get MIC:%lX, %lX\n", *pdwMIC_L, *pdwMIC_R); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Get MIC:%lX, %lX\n", *pdwMIC_L, *pdwMIC_R); } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Middle frag len: %d\n", uTmpLen); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Middle frag len: %d\n", uTmpLen); /* for (ii = 0; ii < uTmpLen; ii++) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02x ", *((PBYTE)((pbyBuffer + uLength) + ii))); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02x ", *((PBYTE)((pbyBuffer + uLength) + ii))); } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n\n"); */ } else { @@ -1994,18 +1956,18 @@ s_cbFillTxBufHead ( //========================= // No Fragmentation //========================= - //DEVICE_PRTGRP03(("No Fragmentation...\n")); - //DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"No Fragmentation...\n"); + //DBG_PRTGRP03(("No Fragmentation...\n")); + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"No Fragmentation...\n"); wFragType = FRAGCTL_NONFRAG; //Set FragCtl in TxBufferHead psTxBufHd->wFragCtl |= (WORD)wFragType; //Fill FIFO,RrvTime,RTS,and CTS - s_vGenerateTxParameter(pDevice, byPktTyp, (PVOID)psTxBufHd, pvRrvTime, pvRTS, pvCTS, + s_vGenerateTxParameter(pDevice, byPktType, (PVOID)psTxBufHd, pvRrvTime, pvRTS, pvCTS, cbFrameSize, bNeedACK, uDMAIdx, psEthHeader, pDevice->wCurrentRate); //Fill DataHead - uDuration = s_uFillDataHead(pDevice, byPktTyp, pvTxDataHd, cbFrameSize, uDMAIdx, bNeedACK, + uDuration = s_uFillDataHead(pDevice, byPktType, pvTxDataHd, cbFrameSize, uDMAIdx, bNeedACK, 0, 0, uMACfragNum, byFBOption, pDevice->wCurrentRate); // Generate TX MAC Header @@ -2027,13 +1989,13 @@ s_cbFillTxBufHead ( if (ntohs(psEthHeader->wType) > MAX_DATA_LEN) { if ((psEthHeader->wType == TYPE_PKT_IPX) || (psEthHeader->wType == cpu_to_le16(0xF380))) { - MEMvCopy((PBYTE) (pbyPayloadHead), &pDevice->abySNAP_Bridgetunnel[0], 6); + memcpy((PBYTE) (pbyPayloadHead), &pDevice->abySNAP_Bridgetunnel[0], 6); } else { - MEMvCopy((PBYTE) (pbyPayloadHead), &pDevice->abySNAP_RFC1042[0], 6); + memcpy((PBYTE) (pbyPayloadHead), &pDevice->abySNAP_RFC1042[0], 6); } pbyType = (PBYTE) (pbyPayloadHead + 6); - MEMvCopy(pbyType, &(psEthHeader->wType), sizeof(WORD)); + memcpy(pbyType, &(psEthHeader->wType), sizeof(WORD)); cb802_1_H_len = 8; } @@ -2043,7 +2005,7 @@ s_cbFillTxBufHead ( //--------------------------- //Fill MICHDR //if (pDevice->bAES) { - // DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Fill MICHDR...\n"); + // DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Fill MICHDR...\n"); // s_vFillMICHDR(pDevice, (PBYTE)pMICHDR, pbyMacHdr, (WORD)cbFrameBodySize); //} @@ -2053,22 +2015,22 @@ s_cbFillTxBufHead ( uLength = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen + cb802_1_H_len; //copy TxBufferHeader + MacHeader to desc - MEMvCopy(pbyBuffer, (PVOID)psTxBufHd, uLength); + memcpy(pbyBuffer, (PVOID)psTxBufHd, uLength); // Copy the Packet into a tx Buffer - MEMvCopy((pbyBuffer + uLength), + memcpy((pbyBuffer + uLength), (pPacket + 14), cbFrameBodySize - cb802_1_H_len ); if ((bNeedEncrypt == TRUE) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)){ - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Length:%d, %d\n", cbFrameBodySize - cb802_1_H_len, uLength); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Length:%d, %d\n", cbFrameBodySize - cb802_1_H_len, uLength); /* for (ii = 0; ii < (cbFrameBodySize - cb802_1_H_len); ii++) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02x ", *((PBYTE)((pbyBuffer + uLength) + ii))); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02x ", *((PBYTE)((pbyBuffer + uLength) + ii))); } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); */ MIC_vAppend((pbyBuffer + uLength - cb802_1_H_len), cbFrameBodySize); @@ -2086,14 +2048,14 @@ s_cbFillTxBufHead ( pDevice->bTxMICFail = FALSE; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"uLength: %d, %d\n", uLength, cbFrameBodySize); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"cbReqCount:%d, %d, %d, %d\n", cbReqCount, cbHeaderLength, uPadding, cbIVlen); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC:%lx, %lx\n", *pdwMIC_L, *pdwMIC_R); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"uLength: %d, %d\n", uLength, cbFrameBodySize); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"cbReqCount:%d, %d, %d, %d\n", cbReqCount, cbHeaderLength, uPadding, cbIVlen); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC:%lx, %lx\n", *pdwMIC_L, *pdwMIC_R); /* for (ii = 0; ii < 8; ii++) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02x ", *(((PBYTE)(pdwMIC_L) + ii))); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02x ", *(((PBYTE)(pdwMIC_L) + ii))); } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); */ } @@ -2121,12 +2083,12 @@ s_cbFillTxBufHead ( pDevice->iTDUsed[uDMAIdx]++; -// DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" ptdCurr->m_dwReserved0[%d] ptdCurr->m_dwReserved1[%d].\n", ptdCurr->pTDInfo->dwReqCount, ptdCurr->pTDInfo->dwHeaderLength); -// DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" cbHeaderLength[%d]\n", cbHeaderLength); +// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" ptdCurr->m_dwReserved0[%d] ptdCurr->m_dwReserved1[%d].\n", ptdCurr->pTDInfo->dwReqCount, ptdCurr->pTDInfo->dwHeaderLength); +// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" cbHeaderLength[%d]\n", cbHeaderLength); } *puMACfragNum = uMACfragNum; - //DEVICE_PRTGRP03(("s_cbFillTxBufHead END\n")); + //DBG_PRTGRP03(("s_cbFillTxBufHead END\n")); return cbHeaderLength; } @@ -2134,7 +2096,7 @@ s_cbFillTxBufHead ( VOID vGenerateFIFOHeader ( IN PSDevice pDevice, - IN BYTE byPktTyp, + IN BYTE byPktType, IN PBYTE pbyTxBufferAddr, IN BOOL bNeedEncrypt, IN UINT cbPayloadSize, @@ -2156,7 +2118,7 @@ vGenerateFIFOHeader ( wTxBufSize = sizeof(STxBufHead); - ZERO_MEMORY(pTxBufHead, wTxBufSize); + memset(pTxBufHead, 0, wTxBufSize); //Set FIFOCTL_NEEDACK if ((pDevice->eOPMode == OP_MODE_ADHOC) || @@ -2206,16 +2168,16 @@ vGenerateFIFOHeader ( pTxBufHead->wFragCtl |= cpu_to_le16((WORD)(cbMacHdLen << 10)); //Set packet type - if (byPktTyp == PK_TYPE_11A) {//0000 0000 0000 0000 + if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000 ; } - else if (byPktTyp == PK_TYPE_11B) {//0000 0001 0000 0000 + else if (byPktType == PK_TYPE_11B) {//0000 0001 0000 0000 pTxBufHead->wFIFOCtl |= FIFOCTL_11B; } - else if (byPktTyp == PK_TYPE_11GB) {//0000 0010 0000 0000 + else if (byPktType == PK_TYPE_11GB) {//0000 0010 0000 0000 pTxBufHead->wFIFOCtl |= FIFOCTL_11GB; } - else if (byPktTyp == PK_TYPE_11GA) {//0000 0011 0000 0000 + else if (byPktType == PK_TYPE_11GA) {//0000 0011 0000 0000 pTxBufHead->wFIFOCtl |= FIFOCTL_11GA; } //Set FIFOCTL_GrpAckPolicy @@ -2273,7 +2235,7 @@ vGenerateFIFOHeader ( if(pDevice->bEnableHostWEP) pTxBufHead->wFragCtl &= ~(FRAGCTL_TKIP | FRAGCTL_LEGACY |FRAGCTL_AES); */ - *pcbHeaderSize = s_cbFillTxBufHead(pDevice, byPktTyp, pbyTxBufferAddr, cbPayloadSize, + *pcbHeaderSize = s_cbFillTxBufHead(pDevice, byPktType, pbyTxBufferAddr, cbPayloadSize, uDMAIdx, pHeadTD, psEthHeader, pPacket, bNeedEncrypt, pTransmitKey, uNodeIndex, puMACfragNum); @@ -2316,7 +2278,7 @@ vGenerateMACHeader ( { PS802_11Header pMACHeader = (PS802_11Header)pbyBufferAddr; - ZERO_MEMORY(pMACHeader, (sizeof(S802_11Header))); //- sizeof(pMACHeader->dwIV))); + memset(pMACHeader, 0, (sizeof(S802_11Header))); //- sizeof(pMACHeader->dwIV))); if (uDMAIdx == TYPE_ATIMDMA) { pMACHeader->wFrameCtl = TYPE_802_11_ATIM; @@ -2325,21 +2287,21 @@ vGenerateMACHeader ( } if (pDevice->eOPMode == OP_MODE_AP) { - MEMvCopy(&(pMACHeader->abyAddr1[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); - MEMvCopy(&(pMACHeader->abyAddr2[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); - MEMvCopy(&(pMACHeader->abyAddr3[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pMACHeader->abyAddr1[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pMACHeader->abyAddr2[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); + memcpy(&(pMACHeader->abyAddr3[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); pMACHeader->wFrameCtl |= FC_FROMDS; } else { if (pDevice->eOPMode == OP_MODE_ADHOC) { - MEMvCopy(&(pMACHeader->abyAddr1[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); - MEMvCopy(&(pMACHeader->abyAddr2[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); - MEMvCopy(&(pMACHeader->abyAddr3[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); + memcpy(&(pMACHeader->abyAddr1[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pMACHeader->abyAddr2[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pMACHeader->abyAddr3[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); } else { - MEMvCopy(&(pMACHeader->abyAddr3[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); - MEMvCopy(&(pMACHeader->abyAddr2[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); - MEMvCopy(&(pMACHeader->abyAddr1[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); + memcpy(&(pMACHeader->abyAddr3[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pMACHeader->abyAddr2[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pMACHeader->abyAddr1[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); pMACHeader->wFrameCtl |= FC_TODS; } } @@ -2352,7 +2314,7 @@ vGenerateMACHeader ( if (pDevice->bLongHeader) { PWLAN_80211HDR_A4 pMACA4Header = (PWLAN_80211HDR_A4) pbyBufferAddr; pMACHeader->wFrameCtl |= (FC_TODS | FC_FROMDS); - MEMvCopy(pMACA4Header->abyAddr4, pDevice->abyBSSID, WLAN_ADDR_LEN); + memcpy(pMACA4Header->abyAddr4, pDevice->abyBSSID, WLAN_ADDR_LEN); } pMACHeader->wSeqCtl = cpu_to_le16(pDevice->wSeqCounter << 4); @@ -2378,7 +2340,7 @@ vGenerateMACHeader ( CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) { PSTxDesc pFrstTD; - BYTE byPktTyp; + BYTE byPktType; PBYTE pbyTxBufferAddr; PVOID pvRTS; PSCTS pCTS; @@ -2419,10 +2381,10 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) { if (pDevice->eCurrentPHYType == PHY_TYPE_11A) { wCurrentRate = RATE_6M; - byPktTyp = PK_TYPE_11A; + byPktType = PK_TYPE_11A; } else { wCurrentRate = RATE_1M; - byPktTyp = PK_TYPE_11B; + byPktType = PK_TYPE_11B; } // SetPower will cause error power TX state for OFDM Date packet in TX buffer. @@ -2440,21 +2402,21 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) { if (pDevice->byFOETuning) { if ((pPacket->p80211Header->sA3.wFrameCtl & TYPE_DATE_NULL) == TYPE_DATE_NULL) { wCurrentRate = RATE_24M; - byPktTyp = PK_TYPE_11GA; + byPktType = PK_TYPE_11GA; } } //Set packet type - if (byPktTyp == PK_TYPE_11A) {//0000 0000 0000 0000 + if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000 pTxBufHead->wFIFOCtl = 0; } - else if (byPktTyp == PK_TYPE_11B) {//0000 0001 0000 0000 + else if (byPktType == PK_TYPE_11B) {//0000 0001 0000 0000 pTxBufHead->wFIFOCtl |= FIFOCTL_11B; } - else if (byPktTyp == PK_TYPE_11GB) {//0000 0010 0000 0000 + else if (byPktType == PK_TYPE_11GB) {//0000 0010 0000 0000 pTxBufHead->wFIFOCtl |= FIFOCTL_11GB; } - else if (byPktTyp == PK_TYPE_11GA) {//0000 0011 0000 0000 + else if (byPktType == PK_TYPE_11GA) {//0000 0011 0000 0000 pTxBufHead->wFIFOCtl |= FIFOCTL_11GA; } @@ -2536,7 +2498,7 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) { //the rest of pTxBufHead->wFragCtl:FragTyp will be set later in s_vFillFragParameter() //Set RrvTime/RTS/CTS Buffer - if (byPktTyp == PK_TYPE_11GB || byPktTyp == PK_TYPE_11GA) {//802.11g packet + if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize); pMICHDR = NULL; @@ -2554,10 +2516,10 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) { cbHeaderSize = wTxBufSize + sizeof(SRrvTime_ab) + sizeof(STxDataHead_ab); } - ZERO_MEMORY((PVOID)(pbyTxBufferAddr + wTxBufSize), (cbHeaderSize - wTxBufSize)); + memset((PVOID)(pbyTxBufferAddr + wTxBufSize), 0, (cbHeaderSize - wTxBufSize)); - MEMvCopy(&(sEthHeader.abyDstAddr[0]), &(pPacket->p80211Header->sA3.abyAddr1[0]), U_ETHER_ADDR_LEN); - MEMvCopy(&(sEthHeader.abySrcAddr[0]), &(pPacket->p80211Header->sA3.abyAddr2[0]), U_ETHER_ADDR_LEN); + memcpy(&(sEthHeader.abyDstAddr[0]), &(pPacket->p80211Header->sA3.abyAddr1[0]), U_ETHER_ADDR_LEN); + memcpy(&(sEthHeader.abySrcAddr[0]), &(pPacket->p80211Header->sA3.abyAddr2[0]), U_ETHER_ADDR_LEN); //========================= // No Fragmentation //========================= @@ -2565,11 +2527,11 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) { //Fill FIFO,RrvTime,RTS,and CTS - s_vGenerateTxParameter(pDevice, byPktTyp, pbyTxBufferAddr, pvRrvTime, pvRTS, pCTS, + s_vGenerateTxParameter(pDevice, byPktType, pbyTxBufferAddr, pvRrvTime, pvRTS, pCTS, cbFrameSize, bNeedACK, TYPE_TXDMA0, &sEthHeader, wCurrentRate); //Fill DataHead - uDuration = s_uFillDataHead(pDevice, byPktTyp, pvTxDataHd, cbFrameSize, TYPE_TXDMA0, bNeedACK, + uDuration = s_uFillDataHead(pDevice, byPktType, pvTxDataHd, cbFrameSize, TYPE_TXDMA0, bNeedACK, 0, 0, 1, AUTO_FB_NONE, wCurrentRate); pMACHeader = (PS802_11Header) (pbyTxBufferAddr + cbHeaderSize); @@ -2606,11 +2568,11 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) { if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, PAIRWISE_KEY, &pTransmitKey) == FALSE) { // get group key if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == TRUE) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Get GTK.\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Get GTK.\n"); break; } } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Get PTK.\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Get PTK.\n"); break; } } @@ -2618,22 +2580,22 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) { pbyBSSID = pDevice->abyBroadcastAddr; if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == FALSE) { pTransmitKey = NULL; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KEY is NULL. OP Mode[%d]\n", pDevice->eOPMode); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KEY is NULL. OP Mode[%d]\n", pDevice->eOPMode); } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Get GTK.\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Get GTK.\n"); } } while(FALSE); //Fill TXKEY s_vFillTxKey(pDevice, (PBYTE)(pTxBufHead->adwTxKey), pbyIVHead, pTransmitKey, (PBYTE)pMACHeader, (WORD)cbFrameBodySize, NULL); - MEMvCopy(pMACHeader, pPacket->p80211Header, cbMacHdLen); - MEMvCopy(pbyPayloadHead, ((PBYTE)(pPacket->p80211Header) + cbMacHdLen), + memcpy(pMACHeader, pPacket->p80211Header, cbMacHdLen); + memcpy(pbyPayloadHead, ((PBYTE)(pPacket->p80211Header) + cbMacHdLen), cbFrameBodySize); } else { // Copy the Packet into a tx Buffer - MEMvCopy(pMACHeader, pPacket->p80211Header, pPacket->cbMPDULen); + memcpy(pMACHeader, pPacket->p80211Header, pPacket->cbMPDULen); } pMACHeader->wSeqCtl = cpu_to_le16(pDevice->wSeqCounter << 4); @@ -2647,7 +2609,7 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) { // This will cause AID-field of PS-POLL packet be incorrect (Because PS-POLL's AID field is // in the same place of other packet's Duration-field). // And it will cause Cisco-AP to issue Disassociation-packet - if (byPktTyp == PK_TYPE_11GB || byPktTyp == PK_TYPE_11GA) { + if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) { ((PSTxDataHead_g)pvTxDataHd)->wDuration_a = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID); ((PSTxDataHead_g)pvTxDataHd)->wDuration_b = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID); } else { @@ -2677,7 +2639,7 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) { pDevice->iTDUsed[TYPE_TXDMA0]++; if (AVAIL_TD(pDevice, TYPE_TXDMA0) <= 1) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " available td0 <= 1\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " available td0 <= 1\n"); } pDevice->apCurrTD[TYPE_TXDMA0] = pFrstTD->next; @@ -2699,7 +2661,7 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) { CMD_STATUS csBeacon_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) { - BYTE byPktTyp; + BYTE byPktType; PBYTE pbyBuffer = (PBYTE)pDevice->tx_beacon_bufs; UINT cbFrameSize = pPacket->cbMPDULen + WLAN_FCS_LEN; UINT cbHeaderSize = 0; @@ -2715,10 +2677,10 @@ CMD_STATUS csBeacon_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) { if (pDevice->eCurrentPHYType == PHY_TYPE_11A) { wCurrentRate = RATE_6M; - byPktTyp = PK_TYPE_11A; + byPktType = PK_TYPE_11A; } else { wCurrentRate = RATE_2M; - byPktTyp = PK_TYPE_11B; + byPktType = PK_TYPE_11B; } //Set Preamble type always long @@ -2730,17 +2692,17 @@ CMD_STATUS csBeacon_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) { //Set packet type & Get Duration - if (byPktTyp == PK_TYPE_11A) {//0000 0000 0000 0000 - pTxDataHead->wDuration = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameSize, byPktTyp, + if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000 + pTxDataHead->wDuration = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameSize, byPktType, wCurrentRate, FALSE, 0, 0, 1, AUTO_FB_NONE)); } - else if (byPktTyp == PK_TYPE_11B) {//0000 0001 0000 0000 + else if (byPktType == PK_TYPE_11B) {//0000 0001 0000 0000 pTxBufHead->wFIFOCtl |= FIFOCTL_11B; - pTxDataHead->wDuration = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameSize, byPktTyp, + pTxDataHead->wDuration = cpu_to_le16((WORD)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameSize, byPktType, wCurrentRate, FALSE, 0, 0, 1, AUTO_FB_NONE)); } - BBvCaculateParameter(pDevice, cbFrameSize, wCurrentRate, byPktTyp, + BBvCaculateParameter(pDevice, cbFrameSize, wCurrentRate, byPktType, (PWORD)&(wLen), (PBYTE)&(pTxDataHead->byServiceField), (PBYTE)&(pTxDataHead->bySignalField) ); pTxDataHead->wTransmitLength = cpu_to_le16(wLen); @@ -2750,7 +2712,7 @@ CMD_STATUS csBeacon_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) { //Generate Beacon Header pMACHeader = (PS802_11Header)(pbyBuffer + cbHeaderSize); - MEMvCopy(pMACHeader, pPacket->p80211Header, pPacket->cbMPDULen); + memcpy(pMACHeader, pPacket->p80211Header, pPacket->cbMPDULen); pMACHeader->wDurationID = 0; pMACHeader->wSeqCtl = cpu_to_le16(pDevice->wSeqCounter << 4); @@ -2867,7 +2829,7 @@ VOID vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, PBYTE pbMPDU, UINT cbMPDULen) { PSTxDesc pFrstTD; - BYTE byPktTyp; + BYTE byPktType; PBYTE pbyTxBufferAddr; PVOID pvRTS; PVOID pvCTS; @@ -2931,10 +2893,10 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, PBYTE pbMPDU, UINT cbMPDU if (pDevice->eCurrentPHYType == PHY_TYPE_11A) { wCurrentRate = RATE_6M; - byPktTyp = PK_TYPE_11A; + byPktType = PK_TYPE_11A; } else { wCurrentRate = RATE_1M; - byPktTyp = PK_TYPE_11B; + byPktType = PK_TYPE_11B; } // SetPower will cause error power TX state for OFDM Date packet in TX buffer. @@ -2952,23 +2914,23 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, PBYTE pbMPDU, UINT cbMPDU if (pDevice->byFOETuning) { if ((p80211Header->sA3.wFrameCtl & TYPE_DATE_NULL) == TYPE_DATE_NULL) { wCurrentRate = RATE_24M; - byPktTyp = PK_TYPE_11GA; + byPktType = PK_TYPE_11GA; } } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"vDMA0_tx_80211: p80211Header->sA3.wFrameCtl = %x \n", p80211Header->sA3.wFrameCtl); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"vDMA0_tx_80211: p80211Header->sA3.wFrameCtl = %x \n", p80211Header->sA3.wFrameCtl); //Set packet type - if (byPktTyp == PK_TYPE_11A) {//0000 0000 0000 0000 + if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000 pTxBufHead->wFIFOCtl = 0; } - else if (byPktTyp == PK_TYPE_11B) {//0000 0001 0000 0000 + else if (byPktType == PK_TYPE_11B) {//0000 0001 0000 0000 pTxBufHead->wFIFOCtl |= FIFOCTL_11B; } - else if (byPktTyp == PK_TYPE_11GB) {//0000 0010 0000 0000 + else if (byPktType == PK_TYPE_11GB) {//0000 0010 0000 0000 pTxBufHead->wFIFOCtl |= FIFOCTL_11GB; } - else if (byPktTyp == PK_TYPE_11GA) {//0000 0011 0000 0000 + else if (byPktType == PK_TYPE_11GA) {//0000 0011 0000 0000 pTxBufHead->wFIFOCtl |= FIFOCTL_11GA; } @@ -3078,7 +3040,7 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, PBYTE pbMPDU, UINT cbMPDU //the rest of pTxBufHead->wFragCtl:FragTyp will be set later in s_vFillFragParameter() - if (byPktTyp == PK_TYPE_11GB || byPktTyp == PK_TYPE_11GA) {//802.11g packet + if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize); pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS)); @@ -3099,9 +3061,9 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, PBYTE pbMPDU, UINT cbMPDU } - ZERO_MEMORY((PVOID)(pbyTxBufferAddr + wTxBufSize), (cbHeaderSize - wTxBufSize)); - MEMvCopy(&(sEthHeader.abyDstAddr[0]), &(p80211Header->sA3.abyAddr1[0]), U_ETHER_ADDR_LEN); - MEMvCopy(&(sEthHeader.abySrcAddr[0]), &(p80211Header->sA3.abyAddr2[0]), U_ETHER_ADDR_LEN); + memset((PVOID)(pbyTxBufferAddr + wTxBufSize), 0, (cbHeaderSize - wTxBufSize)); + memcpy(&(sEthHeader.abyDstAddr[0]), &(p80211Header->sA3.abyAddr1[0]), U_ETHER_ADDR_LEN); + memcpy(&(sEthHeader.abySrcAddr[0]), &(p80211Header->sA3.abyAddr2[0]), U_ETHER_ADDR_LEN); //========================= // No Fragmentation //========================= @@ -3109,11 +3071,11 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, PBYTE pbMPDU, UINT cbMPDU //Fill FIFO,RrvTime,RTS,and CTS - s_vGenerateTxParameter(pDevice, byPktTyp, pbyTxBufferAddr, pvRrvTime, pvRTS, pvCTS, + s_vGenerateTxParameter(pDevice, byPktType, pbyTxBufferAddr, pvRrvTime, pvRTS, pvCTS, cbFrameSize, bNeedACK, TYPE_TXDMA0, &sEthHeader, wCurrentRate); //Fill DataHead - uDuration = s_uFillDataHead(pDevice, byPktTyp, pvTxDataHd, cbFrameSize, TYPE_TXDMA0, bNeedACK, + uDuration = s_uFillDataHead(pDevice, byPktType, pvTxDataHd, cbFrameSize, TYPE_TXDMA0, bNeedACK, 0, 0, 1, AUTO_FB_NONE, wCurrentRate); pMACHeader = (PS802_11Header) (pbyTxBufferAddr + cbHeaderSize); @@ -3173,7 +3135,7 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, PBYTE pbMPDU, UINT cbMPDU MIC_vAppend((PBYTE)&(sEthHeader.abyDstAddr[0]), 12); dwMIC_Priority = 0; MIC_vAppend((PBYTE)&dwMIC_Priority, 4); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"DMA0_tx_8021:MIC KEY: %lX, %lX\n", dwMICKey0, dwMICKey1); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"DMA0_tx_8021:MIC KEY: %lX, %lX\n", dwMICKey0, dwMICKey1); uLength = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen; @@ -3191,9 +3153,9 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, PBYTE pbMPDU, UINT cbMPDU pDevice->bTxMICFail = FALSE; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"uLength: %d, %d\n", uLength, cbFrameBodySize); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"cbReqCount:%d, %d, %d, %d\n", cbReqCount, cbHeaderSize, uPadding, cbIVlen); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC:%lx, %lx\n", *pdwMIC_L, *pdwMIC_R); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"uLength: %d, %d\n", uLength, cbFrameBodySize); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"cbReqCount:%d, %d, %d, %d\n", cbReqCount, cbHeaderSize, uPadding, cbIVlen); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC:%lx, %lx\n", *pdwMIC_L, *pdwMIC_R); } @@ -3223,7 +3185,7 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, PBYTE pbMPDU, UINT cbMPDU // This will cause AID-field of PS-POLL packet be incorrect (Because PS-POLL's AID field is // in the same place of other packet's Duration-field). // And it will cause Cisco-AP to issue Disassociation-packet - if (byPktTyp == PK_TYPE_11GB || byPktTyp == PK_TYPE_11GA) { + if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) { ((PSTxDataHead_g)pvTxDataHd)->wDuration_a = cpu_to_le16(p80211Header->sA2.wDurationID); ((PSTxDataHead_g)pvTxDataHd)->wDuration_b = cpu_to_le16(p80211Header->sA2.wDurationID); } else { @@ -3255,7 +3217,7 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, PBYTE pbMPDU, UINT cbMPDU pDevice->iTDUsed[TYPE_TXDMA0]++; if (AVAIL_TD(pDevice, TYPE_TXDMA0) <= 1) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " available td0 <= 1\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " available td0 <= 1\n"); } pDevice->apCurrTD[TYPE_TXDMA0] = pFrstTD->next; diff --git a/drivers/staging/vt6655/rxtx.h b/drivers/staging/vt6655/rxtx.h index 3e85264..17bd1b1 100644 --- a/drivers/staging/vt6655/rxtx.h +++ b/drivers/staging/vt6655/rxtx.h @@ -16,7 +16,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * File: whdr.h + * File: rxtx.h * * Purpose: * @@ -26,20 +26,12 @@ * */ - #ifndef __RXTX_H__ #define __RXTX_H__ -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif -#if !defined(__DEVICE_H__) #include "device.h" -#endif -#if !defined(__WCMD_H__) #include "wcmd.h" -#endif - /*--------------------- Export Definitions -------------------------*/ diff --git a/drivers/staging/vt6655/srom.c b/drivers/staging/vt6655/srom.c index 655d685..5a7c6ca 100644 --- a/drivers/staging/vt6655/srom.c +++ b/drivers/staging/vt6655/srom.c @@ -42,28 +42,11 @@ * */ - -#if !defined(__UPC_H__) #include "upc.h" -#endif -#if !defined(__TMACRO_H__) #include "tmacro.h" -#endif -#if !defined(__TBIT_H__) -#include "tbit.h" -#endif -#if !defined(__TETHER_H__) #include "tether.h" -#endif -#if !defined(__MAC_H__) #include "mac.h" -#endif -#if !defined(__SROM_H__) #include "srom.h" -#endif - - - /*--------------------- Static Definitions -------------------------*/ @@ -113,12 +96,12 @@ BYTE SROMbyReadEmbedded(DWORD_PTR dwIoBase, BYTE byContntOffset) // wait DONE be set for (wDelay = 0; wDelay < W_MAX_TIMEOUT; wDelay++) { VNSvInPortB(dwIoBase + MAC_REG_I2MCSR, &byWait); - if (BITbIsAnyBitsOn(byWait, (I2MCSR_DONE | I2MCSR_NACK))) + if (byWait & (I2MCSR_DONE | I2MCSR_NACK)) break; PCAvDelayByIO(CB_DELAY_LOOP_WAIT); } if ((wDelay < W_MAX_TIMEOUT) && - (BITbIsBitOff(byWait, I2MCSR_NACK))) { + ( !(byWait & I2MCSR_NACK))) { break; } } @@ -162,13 +145,13 @@ BOOL SROMbWriteEmbedded (DWORD_PTR dwIoBase, BYTE byContntOffset, BYTE byData) // wait DONE be set for (wDelay = 0; wDelay < W_MAX_TIMEOUT; wDelay++) { VNSvInPortB(dwIoBase + MAC_REG_I2MCSR, &byWait); - if (BITbIsAnyBitsOn(byWait, (I2MCSR_DONE | I2MCSR_NACK))) + if (byWait & (I2MCSR_DONE | I2MCSR_NACK)) break; PCAvDelayByIO(CB_DELAY_LOOP_WAIT); } if ((wDelay < W_MAX_TIMEOUT) && - (BITbIsBitOff(byWait, I2MCSR_NACK))) { + ( !(byWait & I2MCSR_NACK))) { break; } } @@ -244,7 +227,7 @@ BOOL SROMbIsRegBitsOn (DWORD_PTR dwIoBase, BYTE byContntOffset, BYTE byTestBits) BYTE byOrgData; byOrgData = SROMbyReadEmbedded(dwIoBase, byContntOffset); - return BITbIsAllBitsOn(byOrgData, byTestBits); + return (byOrgData & byTestBits) == byTestBits; } @@ -267,7 +250,7 @@ BOOL SROMbIsRegBitsOff (DWORD_PTR dwIoBase, BYTE byContntOffset, BYTE byTestBits BYTE byOrgData; byOrgData = SROMbyReadEmbedded(dwIoBase, byContntOffset); - return BITbIsAllBitsOff(byOrgData, byTestBits); + return !(byOrgData & byTestBits); } @@ -423,7 +406,7 @@ BOOL SROMbAutoLoad (DWORD_PTR dwIoBase) for (ii = 0; ii < EEP_MAX_CONTEXT_SIZE; ii++) { MACvTimer0MicroSDelay(dwIoBase, CB_EEPROM_READBYTE_WAIT); VNSvInPortB(dwIoBase + MAC_REG_I2MCSR, &byWait); - if (BITbIsBitOff(byWait, I2MCSR_AUTOLD)) + if ( !(byWait & I2MCSR_AUTOLD)) break; } diff --git a/drivers/staging/vt6655/srom.h b/drivers/staging/vt6655/srom.h index a4ca5f0..ba123ee 100644 --- a/drivers/staging/vt6655/srom.h +++ b/drivers/staging/vt6655/srom.h @@ -27,18 +27,13 @@ * */ - #ifndef __SROM_H__ #define __SROM_H__ -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif - /*--------------------- Export Definitions -------------------------*/ - #define EEP_MAX_CONTEXT_SIZE 256 #define CB_EEPROM_READBYTE_WAIT 900 //us @@ -48,7 +43,6 @@ // // Contents in the EEPROM // - #define EEP_OFS_PAR 0x00 // physical address #define EEP_OFS_ANTENNA 0x16 #define EEP_OFS_RADIOCTL 0x17 @@ -97,8 +91,6 @@ #define EEP_RADIOCTL_ENABLE 0x80 #define EEP_RADIOCTL_INV 0x01 - - /*--------------------- Export Types ------------------------------*/ // AT24C02 eeprom contents @@ -133,7 +125,7 @@ typedef struct tagSSromReg { BYTE abyReserved0[96]; // 0x10 (WORD) BYTE abyCIS[128]; // 0x80 (WORD) -} SSromReg, DEF* PSSromReg; +} SSromReg, *PSSromReg; /*--------------------- Export Macros ------------------------------*/ @@ -142,10 +134,6 @@ typedef struct tagSSromReg { /*--------------------- Export Variables --------------------------*/ /*--------------------- Export Functions --------------------------*/ -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ - BYTE SROMbyReadEmbedded(DWORD_PTR dwIoBase, BYTE byContntOffset); BOOL SROMbWriteEmbedded(DWORD_PTR dwIoBase, BYTE byContntOffset, BYTE byData); @@ -166,14 +154,4 @@ VOID SROMvReadSubSysVenId(DWORD_PTR dwIoBase, PDWORD pdwSubSysVenId); BOOL SROMbAutoLoad (DWORD_PTR dwIoBase); - -#ifdef __cplusplus -} /* End of extern "C" { */ -#endif /* __cplusplus */ - - - - #endif // __EEPROM_H__ - - diff --git a/drivers/staging/vt6655/tbit.h b/drivers/staging/vt6655/tbit.h deleted file mode 100644 index 7c3a82e..0000000 --- a/drivers/staging/vt6655/tbit.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * - * File: tbit.h - * - * Purpose: Bit routines - * - * Author: Tevin Chen - * - * Date: May 21, 1996 - * - */ - - -#ifndef __TBIT_H__ -#define __TBIT_H__ - -#if !defined(__TTYPE_H__) -#include "ttype.h" -#endif - - - -/*--------------------- Export Definitions -------------------------*/ - -/*--------------------- Export Types ------------------------------*/ - -/*--------------------- Export Macros ------------------------------*/ - -// test single bit on -#define BITbIsBitOn(tData, tTestBit) \ - (((tData) & (tTestBit)) != 0) - -// test single bit off -#define BITbIsBitOff(tData, tTestBit) \ - (((tData) & (tTestBit)) == 0) - - -#define BITbIsAllBitsOn(tData, tTestBit) \ - (((tData) & (tTestBit)) == (tTestBit)) - -#define BITbIsAllBitsOff(tData, tTestBit) \ - (((tData) & (tTestBit)) == 0) - -#define BITbIsAnyBitsOn(tData, tTestBit) \ - (((tData) & (tTestBit)) != 0) - -#define BITbIsAnyBitsOff(tData, tTestBit) \ - (((tData) & (tTestBit)) != (tTestBit)) - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - - - -#endif // __TBIT_H__ - - - diff --git a/drivers/staging/vt6655/tcrc.c b/drivers/staging/vt6655/tcrc.c index b70080c..5f0c747 100644 --- a/drivers/staging/vt6655/tcrc.c +++ b/drivers/staging/vt6655/tcrc.c @@ -33,16 +33,7 @@ * */ - -#if !defined(__TBIT_H__) -#include "tbit.h" -#endif -#if !defined(__TCRC_H__) #include "tcrc.h" -#endif - - - /*--------------------- Static Definitions -------------------------*/ diff --git a/drivers/staging/vt6655/tcrc.h b/drivers/staging/vt6655/tcrc.h index ebea22e..5faa48b 100644 --- a/drivers/staging/vt6655/tcrc.h +++ b/drivers/staging/vt6655/tcrc.h @@ -26,16 +26,10 @@ * */ - #ifndef __TCRC_H__ #define __TCRC_H__ -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif - - - /*--------------------- Export Definitions -------------------------*/ @@ -48,23 +42,11 @@ /*--------------------- Export Variables --------------------------*/ /*--------------------- Export Functions --------------------------*/ -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ - DWORD CRCdwCrc32(PBYTE pbyData, UINT cbByte, DWORD dwCrcSeed); DWORD CRCdwGetCrc32(PBYTE pbyData, UINT cbByte); DWORD CRCdwGetCrc32Ex(PBYTE pbyData, UINT cbByte, DWORD dwPreCRC); - -#ifdef __cplusplus -} /* End of extern "C" { */ -#endif /* __cplusplus */ - - - - #endif // __TCRC_H__ diff --git a/drivers/staging/vt6655/tether.c b/drivers/staging/vt6655/tether.c index fd69423..c90b469 100644 --- a/drivers/staging/vt6655/tether.c +++ b/drivers/staging/vt6655/tether.c @@ -32,24 +32,10 @@ * */ -#if !defined(__DEVICE_H__) #include "device.h" -#endif -#if !defined(__TMACRO_H__) #include "tmacro.h" -#endif -#if !defined(__TBIT_H__) -#include "tbit.h" -#endif -#if !defined(__TCRC_H__) #include "tcrc.h" -#endif -#if !defined(__TETHER_H__) #include "tether.h" -#endif - - - /*--------------------- Static Definitions -------------------------*/ @@ -87,7 +73,7 @@ BYTE ETHbyGetHashIndexByCrc32 (PBYTE pbyMultiAddr) // reverse most bit to least bit for (ii = 0; ii < (sizeof(byTmpHash) * 8); ii++) { byHash <<= 1; - if (BITbIsBitOn(byTmpHash, 0x01)) + if (byTmpHash & 0x01) byHash |= 1; byTmpHash >>= 1; } diff --git a/drivers/staging/vt6655/tether.h b/drivers/staging/vt6655/tether.h index 920a8bb..5a3c326 100644 --- a/drivers/staging/vt6655/tether.h +++ b/drivers/staging/vt6655/tether.h @@ -26,18 +26,10 @@ * */ - - #ifndef __TETHER_H__ #define __TETHER_H__ - -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif - - - /*--------------------- Export Definitions -------------------------*/ // @@ -179,7 +171,7 @@ typedef struct tagSEthernetHeader { BYTE abySrcAddr[U_ETHER_ADDR_LEN]; WORD wType; }__attribute__ ((__packed__)) -SEthernetHeader, DEF* PSEthernetHeader; +SEthernetHeader, *PSEthernetHeader; // @@ -190,7 +182,7 @@ typedef struct tagS802_3Header { BYTE abySrcAddr[U_ETHER_ADDR_LEN]; WORD wLen; }__attribute__ ((__packed__)) -S802_3Header, DEF* PS802_3Header; +S802_3Header, *PS802_3Header; // // 802_11 packet @@ -204,7 +196,7 @@ typedef struct tagS802_11Header { WORD wSeqCtl; BYTE abyAddr4[U_ETHER_ADDR_LEN]; }__attribute__ ((__packed__)) -S802_11Header, DEF* PS802_11Header; +S802_11Header, *PS802_11Header; /*--------------------- Export Macros ------------------------------*/ // Frame type macro @@ -233,23 +225,11 @@ S802_11Header, DEF* PS802_11Header; /*--------------------- Export Variables --------------------------*/ /*--------------------- Export Functions --------------------------*/ -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ - BYTE ETHbyGetHashIndexByCrc32(PBYTE pbyMultiAddr); //BYTE ETHbyGetHashIndexByCrc(PBYTE pbyMultiAddr); BOOL ETHbIsBufferCrc32Ok(PBYTE pbyBuffer, UINT cbFrameLength); - -#ifdef __cplusplus -} /* End of extern "C" { */ -#endif /* __cplusplus */ - - - - #endif // __TETHER_H__ diff --git a/drivers/staging/vt6655/tkip.c b/drivers/staging/vt6655/tkip.c index 2ded842..8ca1540 100644 --- a/drivers/staging/vt6655/tkip.c +++ b/drivers/staging/vt6655/tkip.c @@ -32,20 +32,8 @@ * */ - -#if !defined(__TMACRO_H__) #include "tmacro.h" -#endif -#if !defined(__TBIT_H__) -#include "tbit.h" -#endif -#if !defined(__TKIP_H__) #include "tkip.h" -#endif -#if !defined(__UMEM_H__) -#include "umem.h" -#endif - /*--------------------- Static Definitions -------------------------*/ diff --git a/drivers/staging/vt6655/tkip.h b/drivers/staging/vt6655/tkip.h index dc8382b..847ecdf 100644 --- a/drivers/staging/vt6655/tkip.h +++ b/drivers/staging/vt6655/tkip.h @@ -27,19 +27,11 @@ * */ - #ifndef __TKIP_H__ #define __TKIP_H__ -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif - -#if !defined(__TETHER_H__) #include "tether.h" -#endif - - /*--------------------- Export Definitions -------------------------*/ #define TKIP_KEY_LEN 16 @@ -53,9 +45,6 @@ /*--------------------- Export Variables --------------------------*/ /*--------------------- Export Functions --------------------------*/ -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ VOID TKIPvMixKey( PBYTE pbyTKey, @@ -65,11 +54,6 @@ VOID TKIPvMixKey( PBYTE pbyRC4Key ); -#ifdef __cplusplus -} /* End of extern "C" { */ -#endif /* __cplusplus */ - - #endif // __TKIP_H__ diff --git a/drivers/staging/vt6655/tmacro.h b/drivers/staging/vt6655/tmacro.h index 3d932a2..e96c140 100644 --- a/drivers/staging/vt6655/tmacro.h +++ b/drivers/staging/vt6655/tmacro.h @@ -26,27 +26,13 @@ * */ - #ifndef __TMACRO_H__ #define __TMACRO_H__ - -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif - - - /****** Common helper macros ***********************************************/ -#if !defined(LONIBBLE) -#define LONIBBLE(b) ((BYTE)(b) & 0x0F) -#endif -#if !defined(HINIBBLE) -#define HINIBBLE(b) ((BYTE)(((WORD)(b) >> 4) & 0x0F)) -#endif - #if !defined(LOBYTE) #define LOBYTE(w) ((BYTE)(w)) #endif @@ -64,88 +50,12 @@ #define LODWORD(q) ((q).u.dwLowDword) #define HIDWORD(q) ((q).u.dwHighDword) - - -#if !defined(MAKEBYTE) -#define MAKEBYTE(ln, hn) ((BYTE)(((BYTE)(ln) & 0x0F) | ((BYTE)(hn) << 4))) -#endif #if !defined(MAKEWORD) #define MAKEWORD(lb, hb) ((WORD)(((BYTE)(lb)) | (((WORD)((BYTE)(hb))) << 8))) #endif #if !defined(MAKEDWORD) #define MAKEDWORD(lw, hw) ((DWORD)(((WORD)(lw)) | (((DWORD)((WORD)(hw))) << 16))) #endif -#if !defined(MAKEQWORD) -#define MAKEQWORD(ld, hd, pq) {pq->u.dwLowDword = ld; pq->u.dwHighDword = hd;} -#endif - -#if !defined(MAKELONG) -#define MAKELONG(low, high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16))) -#endif - - - -// Bytes Reverse: big endian to little endian convert -#if !defined(REVWORD) -#define REVWORD(w) ((WORD)( ((WORD)(w) >> 8) | ((WORD)(w) << 8) )) -#endif -#if !defined(REVDWORD) -#define REVDWORD(d) (MAKEDWORD(MAKEWORD(HIBYTE(HIWORD(d)),LOBYTE(HIWORD(d))),MAKEWORD(HIBYTE(LOWORD(d)),LOBYTE(LOWORD(d))))) -#endif - -/* map to known network names */ -/* -#define ntohs(x) REVWORD(x) -#define ntohl(x) REVDWORD(x) -#define htons(x) REVWORD(x) -#define htonl(x) REVDWORD(x) -*/ - - -/* -#ifndef NOMINMAX -#ifndef max -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif -#ifndef min -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif -#endif // NOMINMAX -*/ - - - -/****** Misc macros ********************************************************/ - -// get the field offset in the type(struct, class, ...) -#define OFFSET(type, field) ((int)(&((type NEAR*)1)->field)-1) - - -/* string equality shorthand */ -#define STR_EQ(x, y) (strcmp(x, y) == 0) -#define STR_NE(x, y) (strcmp(x, y) != 0) - - -// calculate element # of array -#define ELEMENT_NUM(array) (sizeof(array) / sizeof(array[0])) -//#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) - - -// null statement -#define NULL_FUNC() - - -/* Since not all compilers support structure assignment, the ASSIGN() - * macro is used. This controls how it's actually implemented. - */ -#ifdef NOSTRUCTASSIGN /* Version for old compilers that don't support it */ -#define ASSIGN(a,b) memcpy((char *)&(a),(char *)&(b),sizeof(b); -#else /* Version for compilers that do */ -#define ASSIGN(a,b) ((a) = (b)) -#endif - - - #endif // __TMACRO_H__ diff --git a/drivers/staging/vt6655/tpci.h b/drivers/staging/vt6655/tpci.h deleted file mode 100644 index 4a1c8ed..0000000 --- a/drivers/staging/vt6655/tpci.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * - * File: tpci.h - * - * Purpose: PCI routines - * - * Author: Tevin Chen - * - * Date: May 21, 1996 - * - */ - - -#ifndef __TPCI_H__ -#define __TPCI_H__ - -#if !defined(__TTYPE_H__) -#include "ttype.h" -#endif - - - - -/*--------------------- Export Definitions -------------------------*/ -#define MAX_PCI_BUS 4 // max. # of PCI bus that we support -#define MAX_PCI_DEVICE 32 // max. # of PCI devices - - -// -// Registers in the PCI configuration space -// -#define PCI_REG_VENDOR_ID 0x00 // -#define PCI_REG_DEVICE_ID 0x02 // -#define PCI_REG_COMMAND 0x04 // -#define PCI_REG_STATUS 0x06 // -#define PCI_REG_REV_ID 0x08 // -#define PCI_REG_CLASS_CODE 0x09 // -#define PCI_REG_CACHELINE_SIZE 0x0C // -#define PCI_REG_LAT_TIMER 0x0D // -#define PCI_REG_HDR_TYPE 0x0E // -#define PCI_REG_BIST 0x0F // - -#define PCI_REG_BAR0 0x10 // -#define PCI_REG_BAR1 0x14 // -#define PCI_REG_BAR2 0x18 // -#define PCI_REG_CARDBUS_CIS_PTR 0x28 // - -#define PCI_REG_SUB_VEN_ID 0x2C // -#define PCI_REG_SUB_SYS_ID 0x2E // -#define PCI_REG_EXP_ROM_BAR 0x30 // -#define PCI_REG_CAP 0x34 // - -#define PCI_REG_INT_LINE 0x3C // -#define PCI_REG_INT_PIN 0x3D // -#define PCI_REG_MIN_GNT 0x3E // -#define PCI_REG_MAX_LAT 0x3F // - -#define PCI_REG_MAX_SIZE 0x100 // maximun total PCI registers - - -// -// Bits in the COMMAND register -// -#define COMMAND_BUSM 0x04 // -#define COMMAND_WAIT 0x80 // - -/*--------------------- Export Types ------------------------------*/ - -/*--------------------- Export Macros ------------------------------*/ - -// macro MAKE Bus Dev Fun ID into WORD -#define MAKE_BDF_TO_WORD(byBusId, byDevId, byFunId) \ - MAKEWORD( \ - ((((BYTE)(byDevId)) & 0x1F) << 3) + \ - (((BYTE)(byFunId)) & 0x07), \ - (byBusId) \ - ) - -#define GET_BUSID(wBusDevFunId) \ - HIBYTE(wBusDevFunId) - -#define GET_DEVID(wBusDevFunId) \ - (LOBYTE(wBusDevFunId) >> 3) - -#define GET_FUNID(wBusDevFunId) \ - (LOBYTE(wBusDevFunId) & 0x07) - - -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - - - - -#endif // __TPCI_H__ - - diff --git a/drivers/staging/vt6655/ttype.h b/drivers/staging/vt6655/ttype.h index 1f26702..4dfad04 100644 --- a/drivers/staging/vt6655/ttype.h +++ b/drivers/staging/vt6655/ttype.h @@ -1,5 +1,6 @@ /* - * File: ttype.h + * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. + * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,6 +16,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + * File: ttype.h + * * Purpose: define basic common types and macros * * Author: Tevin Chen @@ -34,14 +37,6 @@ #define VOID void #endif -#ifndef CONST -#define CONST const -#endif - -#ifndef STATIC -#define STATIC static -#endif - #ifndef IN #define IN #endif @@ -53,11 +48,8 @@ #ifndef TxInSleep #define TxInSleep #endif -#if! defined(__CPU8051) + typedef int BOOL; -#else // __CPU8051 -#define BOOL int -#endif // __CPU8051 #if !defined(TRUE) #define TRUE 1 @@ -70,9 +62,6 @@ typedef int BOOL; #if !defined(SUCCESS) #define SUCCESS 0 #endif -#if !defined(FAILED) -#define FAILED -1 -#endif //2007-0809-01<Add>by MikeLiu #ifndef update_BssList @@ -95,28 +84,18 @@ typedef int BOOL; /****** Simple typedefs ***************************************************/ -#if! defined(__CPU8051) - /* These lines assume that your compiler's longs are 32 bits and * shorts are 16 bits. It is already assumed that chars are 8 bits, * but it doesn't matter if they're signed or unsigned. */ typedef signed char I8; /* 8-bit signed integer */ -typedef signed short I16; /* 16-bit signed integer */ -typedef signed long I32; /* 32-bit signed integer */ typedef unsigned char U8; /* 8-bit unsigned integer */ typedef unsigned short U16; /* 16-bit unsigned integer */ typedef unsigned long U32; /* 32-bit unsigned integer */ -#if defined(__WIN32) -typedef signed __int64 I64; /* 64-bit signed integer */ -typedef unsigned __int64 U64; /* 64-bit unsigned integer */ -#endif // __WIN32 - - typedef char CHAR; typedef signed short SHORT; typedef signed int INT; @@ -127,7 +106,6 @@ typedef unsigned short USHORT; typedef unsigned int UINT; typedef unsigned long ULONG; typedef unsigned long long ULONGLONG; //64 bit -typedef unsigned long long ULONGULONG; @@ -147,170 +125,23 @@ typedef union tagUQuadWord { } UQuadWord; typedef UQuadWord QWORD; // 64-bit - - -#ifndef _TCHAR_DEFINED -typedef char TCHAR; -typedef char* PTCHAR; -typedef unsigned char TBYTE; -typedef unsigned char* PTBYTE; -#define _TCHAR_DEFINED -#endif - -#else // __CPU8051 - -#define U8 unsigned char -#define U16 unsigned short -#define U32 unsigned long - -#define USHORT unsigned short -#define UINT unsigned int - -#define BYTE unsigned char -#define WORD unsigned short -#define DWORD unsigned long - - -#endif // __CPU8051 - - -// maybe this should be defined in <limits.h> -#define U8_MAX 0xFFU -#define U16_MAX 0xFFFFU -#define U32_MAX 0xFFFFFFFFUL - -#define BYTE_MAX 0xFFU -#define WORD_MAX 0xFFFFU -#define DWORD_MAX 0xFFFFFFFFUL - - - - -/******* 32-bit vs. 16-bit definitions and typedefs ************************/ - -#if !defined(NULL) -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif // __cplusplus -#endif // !NULL - - - - -#if defined(__WIN32) || defined(__CPU8051) - -#if !defined(FAR) -#define FAR -#endif -#if !defined(NEAR) -#define NEAR -#endif -#if !defined(DEF) -#define DEF -#endif -#if !defined(CALLBACK) -#define CALLBACK -#endif - -#else // !__WIN32__ - -#if !defined(FAR) -#define FAR -#endif -#if !defined(NEAR) -#define NEAR -#endif -#if !defined(DEF) -// default pointer type is FAR, if you want near pointer just redefine it to NEAR -#define DEF -#endif -#if !defined(CALLBACK) -#define CALLBACK -#endif - -#endif // !__WIN32__ - - - - /****** Common pointer types ***********************************************/ -#if! defined(__CPU8051) +typedef unsigned long ULONG_PTR; // 32-bit +typedef unsigned long DWORD_PTR; // 32-bit -typedef signed char DEF* PI8; -typedef signed short DEF* PI16; -typedef signed long DEF* PI32; +// boolean pointer +typedef unsigned int * PUINT; -typedef unsigned char DEF* PU8; -typedef unsigned short DEF* PU16; -typedef unsigned long DEF* PU32; +typedef BYTE * PBYTE; -#if defined(__WIN32) -typedef signed __int64 DEF* PI64; -typedef unsigned __int64 DEF* PU64; -#endif // __WIN32 +typedef WORD * PWORD; -#if !defined(_WIN64) -typedef unsigned long ULONG_PTR; // 32-bit -typedef unsigned long DWORD_PTR; // 32-bit -#endif // _WIN64 +typedef DWORD * PDWORD; +typedef QWORD * PQWORD; -// boolean pointer -typedef int DEF* PBOOL; -typedef int NEAR* NPBOOL; -typedef int FAR* LPBOOL; - -typedef int DEF* PINT; -typedef int NEAR* NPINT; -typedef int FAR* LPINT; -typedef const int DEF* PCINT; -typedef const int NEAR* NPCINT; -typedef const int FAR* LPCINT; - -typedef unsigned int DEF* PUINT; -typedef const unsigned int DEF* PCUINT; - -typedef long DEF* PLONG; -typedef long NEAR* NPLONG; -typedef long FAR* LPLONG; -//typedef const long DEF* PCLONG; -typedef const long NEAR* NPCLONG; -typedef const long FAR* LPCLONG; - -typedef BYTE DEF* PBYTE; -typedef BYTE NEAR* NPBYTE; -typedef BYTE FAR* LPBYTE; -typedef const BYTE DEF* PCBYTE; -typedef const BYTE NEAR* NPCBYTE; -typedef const BYTE FAR* LPCBYTE; - -typedef WORD DEF* PWORD; -typedef WORD NEAR* NPWORD; -typedef WORD FAR* LPWORD; -typedef const WORD DEF* PCWORD; -typedef const WORD NEAR* NPCWORD; -typedef const WORD FAR* LPCWORD; - -typedef DWORD DEF* PDWORD; -typedef DWORD NEAR* NPDWORD; -typedef DWORD FAR* LPDWORD; -typedef const DWORD DEF* PCDWORD; -typedef const DWORD NEAR* NPCDWORD; -typedef const DWORD FAR* LPCDWORD; - -typedef QWORD DEF* PQWORD; -typedef QWORD NEAR* NPQWORD; -typedef QWORD FAR* LPQWORD; -typedef const QWORD DEF* PCQWORD; -typedef const QWORD NEAR* NPCQWORD; -typedef const QWORD FAR* LPCQWORD; - -typedef void DEF* PVOID; -typedef void NEAR* NPVOID; -typedef void FAR* LPVOID; +typedef void * PVOID; // handle declaration #ifdef STRICT @@ -319,68 +150,4 @@ typedef void *HANDLE; typedef PVOID HANDLE; #endif -// -// ANSI (Single-byte Character) types -// -typedef char DEF* PCH; -typedef char NEAR* NPCH; -typedef char FAR* LPCH; -typedef const char DEF* PCCH; -typedef const char NEAR* NPCCH; -typedef const char FAR* LPCCH; - -typedef char DEF* PSTR; -typedef char NEAR* NPSTR; -typedef char FAR* LPSTR; -typedef const char DEF* PCSTR; -typedef const char NEAR* NPCSTR; -typedef const char FAR* LPCSTR; - -#endif // !__CPU8051 - - - - -/****** Misc definitions, types ********************************************/ - -// parameter prefix -#ifndef IN -#define IN -#endif - -#ifndef OUT -#define OUT -#endif - - -// unreferenced parameter macro to avoid warning message in MS C -#if defined(__TURBOC__) - -//you should use "#pragma argsused" to avoid warning message in Borland C -#ifndef UNREFERENCED_PARAMETER -#define UNREFERENCED_PARAMETER(x) -#endif - -#else - -#ifndef UNREFERENCED_PARAMETER -//#define UNREFERENCED_PARAMETER(x) x -#define UNREFERENCED_PARAMETER(x) -#endif - -#endif - - -// in-line assembly prefix -#if defined(__TURBOC__) -#define ASM asm -#else // !__TURBOC__ -#define ASM _asm -#endif // !__TURBOC__ - - - - #endif // __TTYPE_H__ - - diff --git a/drivers/staging/vt6655/umem.h b/drivers/staging/vt6655/umem.h deleted file mode 100644 index 2c3eafa..0000000 --- a/drivers/staging/vt6655/umem.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * - * File: umem.h - * - * Purpose: Define Memory macros - * - * Author: Tevin Chen - * - * Date: Mar 17, 1997 - * - */ - - -#ifndef __UMEM_H__ -#define __UMEM_H__ - -#if !defined(__TTYPE_H__) -#include "ttype.h" -#endif - - - -/*--------------------- Export Definitions -------------------------*/ -// 4-byte memory tag -#define MEM_TAG 'mTEW' - -// Macros used for memory allocation and deallocation. - - - -#define ZERO_MEMORY(Destination,Length) { \ - memset((PVOID)(Destination), \ - 0, \ - (ULONG)(Length) \ - ); \ -} - -#define MEMvCopy(pvDest, pvSource, uCount) { \ - memcpy((PVOID)(pvDest), \ - (PVOID)(pvSource), \ - (ULONG)(uCount) \ - ); \ -} - - -#define MEMEqualMemory(Destination,Source,Length) (!memcmp((Destination),(Source),(Length))) -/*--------------------- Export Classes ----------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Export Functions --------------------------*/ - - - - -#endif // __UMEM_H__ - - diff --git a/drivers/staging/vt6655/upc.h b/drivers/staging/vt6655/upc.h index 113fc2c..acd1b66 100644 --- a/drivers/staging/vt6655/upc.h +++ b/drivers/staging/vt6655/upc.h @@ -26,16 +26,11 @@ * */ - #ifndef __UPC_H__ #define __UPC_H__ -#if !defined(DEVICE_H) #include "device.h" -#endif -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif /*--------------------- Export Definitions -------------------------*/ diff --git a/drivers/staging/vt6655/vntwifi.c b/drivers/staging/vt6655/vntwifi.c index 58a1ba0..fbe27a8 100644 --- a/drivers/staging/vt6655/vntwifi.c +++ b/drivers/staging/vt6655/vntwifi.c @@ -31,32 +31,13 @@ * */ -#if !defined(__VNTWIFI_H__) #include "vntwifi.h" -#endif -#if !defined(__UMEM_H__) -#include "umem.h" -#endif - - -#if !defined(__TBIT_H__) -#include "tbit.h" -#endif -#if !defined(__IEEE11h_H__) #include "IEEE11h.h" -#endif -#if !defined(__COUNTRY_H__) #include "country.h" -#endif -#if !defined(__DEVICE_H__) #include "device.h" -#endif -#if !defined(__WMGR_H__) #include "wmgr.h" -#endif -#if !defined(__DATARATE_H__) #include "datarate.h" -#endif + //#define PLICE_DEBUG /*--------------------- Static Definitions -------------------------*/ @@ -694,7 +675,7 @@ VNTWIFIbSetPMKIDCache ( return (FALSE); } pMgmt->gsPMKIDCache.BSSIDInfoCount = ulCount; - MEMvCopy(pMgmt->gsPMKIDCache.BSSIDInfo, pPMKIDInfo, (ulCount*sizeof(PMKIDInfo))); + memcpy(pMgmt->gsPMKIDCache.BSSIDInfo, pPMKIDInfo, (ulCount*sizeof(PMKIDInfo))); return (TRUE); } @@ -709,7 +690,7 @@ VNTWIFIwGetMaxSupportRate( PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject; for(wRate = RATE_54M; wRate > RATE_1M; wRate--) { - if (BITbIsBitOn(pMgmt->sNodeDBTable[0].wSuppRate, (1<<wRate))) { + if (pMgmt->sNodeDBTable[0].wSuppRate & (1<<wRate)) { return (wRate); } } @@ -758,24 +739,24 @@ VNTWIFIbMeasureReport( switch (pMgmt->pCurrMeasureEIDRep->byType) { case MEASURE_TYPE_BASIC : pMgmt->pCurrMeasureEIDRep->len += sizeof(MEASEURE_REP_BASIC); - MEMvCopy( &(pMgmt->pCurrMeasureEIDRep->sRep.sBasic), + memcpy( &(pMgmt->pCurrMeasureEIDRep->sRep.sBasic), &(((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->sReq), sizeof(MEASEURE_REQ)); pMgmt->pCurrMeasureEIDRep->sRep.sBasic.byMap = byBasicMap; break; case MEASURE_TYPE_CCA : pMgmt->pCurrMeasureEIDRep->len += sizeof(MEASEURE_REP_CCA); - MEMvCopy( &(pMgmt->pCurrMeasureEIDRep->sRep.sCCA), + memcpy( &(pMgmt->pCurrMeasureEIDRep->sRep.sCCA), &(((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->sReq), sizeof(MEASEURE_REQ)); pMgmt->pCurrMeasureEIDRep->sRep.sCCA.byCCABusyFraction = byCCAFraction; break; case MEASURE_TYPE_RPI : pMgmt->pCurrMeasureEIDRep->len += sizeof(MEASEURE_REP_RPI); - MEMvCopy( &(pMgmt->pCurrMeasureEIDRep->sRep.sRPI), + memcpy( &(pMgmt->pCurrMeasureEIDRep->sRep.sRPI), &(((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->sReq), sizeof(MEASEURE_REQ)); - MEMvCopy(pMgmt->pCurrMeasureEIDRep->sRep.sRPI.abyRPIdensity, pbyRPIs, 8); + memcpy(pMgmt->pCurrMeasureEIDRep->sRep.sRPI.abyRPIdensity, pbyRPIs, 8); break; default : break; diff --git a/drivers/staging/vt6655/vntwifi.h b/drivers/staging/vt6655/vntwifi.h index 3e620a7..2854dfc 100644 --- a/drivers/staging/vt6655/vntwifi.h +++ b/drivers/staging/vt6655/vntwifi.h @@ -30,15 +30,10 @@ #ifndef __VNTWIFI_H__ #define __VNTWIFI_H__ -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif -#if !defined(__80211MGR_H__) #include "80211mgr.h" -#endif -#if !defined(__CARD_H__) #include "card.h" -#endif +#include "wpa2.h" /*--------------------- Export Definitions -------------------------*/ #define RATE_1M 0 @@ -67,8 +62,6 @@ #define MAX_BSS_NUM 42 -#define MAX_PMKID_CACHE 16 - // Pre-configured Authenticaiton Mode (from XP) typedef enum tagWMAC_AUTHENTICATION_MODE { @@ -147,11 +140,6 @@ typedef enum tagWMAC_POWER_MODE { /*--------------------- Export Functions --------------------------*/ -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ - - VOID VNTWIFIvSetIBSSParameter ( IN PVOID pMgmtHandle, @@ -322,9 +310,4 @@ VNTWIFIbRadarPresent( ); */ -#ifdef __cplusplus -} /* End of extern "C" { */ -#endif /* __cplusplus */ - - #endif //__VNTWIFI_H__ diff --git a/drivers/staging/vt6655/wcmd.c b/drivers/staging/vt6655/wcmd.c index 92563bd..d81f5b7 100644 --- a/drivers/staging/vt6655/wcmd.c +++ b/drivers/staging/vt6655/wcmd.c @@ -1,4 +1,4 @@ - /* +/* * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. * All rights reserved. * @@ -16,7 +16,6 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * * File: wcmd.c * * Purpose: Handles the management command interface functions @@ -39,58 +38,21 @@ * */ - - - -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif -#if !defined(__TMACRO_H__) #include "tmacro.h" -#endif -#if !defined(__DEVICE_H__) #include "device.h" -#endif -#if !defined(__MAC_H__) #include "mac.h" -#endif -#if !defined(__CARD_H__) #include "card.h" -#endif -#if !defined(__80211HDR_H__) #include "80211hdr.h" -#endif -#if !defined(__WCMD_H__) #include "wcmd.h" -#endif -#if !defined(__WMGR_H__) #include "wmgr.h" -#endif -#if !defined(__POWER_H__) #include "power.h" -#endif -#if !defined(__WCTL_H__) #include "wctl.h" -#endif -#if !defined(__CARD_H__) #include "card.h" -#endif -#if !defined(__BASEBAND_H__) #include "baseband.h" -#endif -#if !defined(__UMEM_H__) -#include "umem.h" -#endif -#if !defined(__RXTX_H__) #include "rxtx.h" -#endif -#if !defined(__RF_H__) #include "rf.h" -#endif -//DavidWang -#if !defined(__IOWPA_H__) #include "iowpa.h" -#endif /*--------------------- Static Definitions -------------------------*/ @@ -122,6 +84,7 @@ s_MgrMakeProbeRequest( IN PWLAN_IE_SUPP_RATES pCurrExtSuppRates ); + static BOOL s_bCommandComplete ( @@ -134,6 +97,7 @@ s_bCommandComplete ( /*--------------------- Export Functions --------------------------*/ + /* * Description: * Stop AdHoc beacon during scan process @@ -186,7 +150,8 @@ vAdHocBeaconStop(PSDevice pDevice) MACvRegBitsOff(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX); } -} +} /* vAdHocBeaconStop */ + /* * Description: @@ -224,6 +189,8 @@ vAdHocBeaconRestart(PSDevice pDevice) + + /*+ * * Routine Description: @@ -274,10 +241,10 @@ s_vProbeChannel( if (pTxPacket != NULL ){ for (ii = 0; ii < 2 ; ii++) { if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request sending fail.. \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request sending fail.. \n"); } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request is sending.. \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request is sending.. \n"); } } } @@ -350,6 +317,7 @@ s_MgrMakeProbeRequest( + VOID vCommandTimerWait( IN HANDLE hDeviceContext, @@ -369,6 +337,7 @@ vCommandTimerWait( + VOID vCommandTimer ( IN HANDLE hDeviceContext @@ -409,7 +378,7 @@ vCommandTimer ( return; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_SCAN_START\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_SCAN_START\n"); pItemSSID = (PWLAN_IE_SSID)pMgmt->abyScanSSID; // wait all Data TD complete if (pDevice->iTDUsed[TYPE_AC0DMA] != 0){ @@ -429,7 +398,7 @@ vCommandTimer ( // Set Baseband's sensitivity back. // Set channel back CARDbSetChannel(pMgmt->pAdapter, pMgmt->uCurrChannel); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", pMgmt->uCurrChannel); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", pMgmt->uCurrChannel); if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_ADHOC); } else { @@ -441,7 +410,7 @@ vCommandTimer ( } else { //2008-8-4 <add> by chester if (!ChannelValid(pDevice->byZoneType, pMgmt->uScanChannel)) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Invalid channel pMgmt->uScanChannel = %d \n",pMgmt->uScanChannel); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Invalid channel pMgmt->uScanChannel = %d \n",pMgmt->uScanChannel); s_bCommandComplete(pDevice); return; } @@ -464,9 +433,9 @@ vCommandTimer ( vAdHocBeaconStop(pDevice); if (CARDbSetChannel(pMgmt->pAdapter, pMgmt->uScanChannel) == TRUE) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SCAN Channel: %d\n", pMgmt->uScanChannel); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SCAN Channel: %d\n", pMgmt->uScanChannel); } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SET SCAN Channel Fail: %d\n", pMgmt->uScanChannel); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SET SCAN Channel Fail: %d\n", pMgmt->uScanChannel); } CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_UNKNOWN); // printk("chester-mxch=%d\n",pDevice->byMaxChannel); @@ -502,7 +471,7 @@ vCommandTimer ( // Set Baseband's sensitivity back. // Set channel back CARDbSetChannel(pMgmt->pAdapter, pMgmt->uCurrChannel); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", pMgmt->uCurrChannel); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", pMgmt->uCurrChannel); if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_ADHOC); } else { @@ -531,7 +500,7 @@ vCommandTimer ( spin_unlock_irq(&pDevice->lock); return; } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Send Disassociation Packet..\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Send Disassociation Packet..\n"); // reason = 8 : disassoc because sta has left vMgrDisassocBeginSta((HANDLE)pDevice, pMgmt, pMgmt->abyCurrBSSID, (8), &Status); pDevice->bLinkPass = FALSE; @@ -551,7 +520,7 @@ vCommandTimer ( spin_unlock_irq(&pDevice->lock); return; }; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" CARDbRadioPowerOff\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" CARDbRadioPowerOff\n"); //2008-09-02 <mark> by chester // CARDbRadioPowerOff(pDevice); s_bCommandComplete(pDevice); @@ -582,15 +551,15 @@ printk("chester-abyDesireSSID=%s\n",((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySS //((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len + WLAN_IEHDR_LEN); pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; pItemSSIDCurr = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" cmd: desire ssid = %s\n", pItemSSID->abySSID); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" cmd: curr ssid = %s\n", pItemSSIDCurr->abySSID); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" cmd: desire ssid = %s\n", pItemSSID->abySSID); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" cmd: curr ssid = %s\n", pItemSSIDCurr->abySSID); if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Cmd pMgmt->eCurrState == WMAC_STATE_ASSOC\n"); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pItemSSID->len =%d\n",pItemSSID->len); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pItemSSIDCurr->len = %d\n",pItemSSIDCurr->len); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" desire ssid = %s\n", pItemSSID->abySSID); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" curr ssid = %s\n", pItemSSIDCurr->abySSID); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Cmd pMgmt->eCurrState == WMAC_STATE_ASSOC\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pItemSSID->len =%d\n",pItemSSID->len); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pItemSSIDCurr->len = %d\n",pItemSSIDCurr->len); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" desire ssid = %s\n", pItemSSID->abySSID); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" curr ssid = %s\n", pItemSSIDCurr->abySSID); } if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) || @@ -629,7 +598,7 @@ printk("chester-abyDesireSSID=%s\n",((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySS pDevice->eCommandState = WLAN_AUTHENTICATE_WAIT; vCommandTimerWait((HANDLE)pDevice, AUTHENTICATE_TIMEOUT); spin_unlock_irq(&pDevice->lock); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Set eCommandState = WLAN_AUTHENTICATE_WAIT\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Set eCommandState = WLAN_AUTHENTICATE_WAIT\n"); return; } } @@ -649,7 +618,7 @@ printk("chester-abyDesireSSID=%s\n",((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySS // start own IBSS vMgrCreateOwnIBSS((HANDLE)pDevice, &Status); if (Status != CMD_STATUS_SUCCESS){ - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " WLAN_CMD_IBSS_CREATE fail ! \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " WLAN_CMD_IBSS_CREATE fail ! \n"); }; BSSvAddMulticastNode(pDevice); } @@ -661,7 +630,7 @@ printk("chester-abyDesireSSID=%s\n",((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySS // start own IBSS vMgrCreateOwnIBSS((HANDLE)pDevice, &Status); if (Status != CMD_STATUS_SUCCESS){ - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO" WLAN_CMD_IBSS_CREATE fail ! \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" WLAN_CMD_IBSS_CREATE fail ! \n"); }; BSSvAddMulticastNode(pDevice); if (netif_queue_stopped(pDevice->dev)){ @@ -670,7 +639,7 @@ printk("chester-abyDesireSSID=%s\n",((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySS pDevice->bLinkPass = TRUE; } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disconnect SSID none\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disconnect SSID none\n"); #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT // if(pDevice->bWPASuppWextEnabled == TRUE) { @@ -688,15 +657,15 @@ printk("chester-abyDesireSSID=%s\n",((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySS break; case WLAN_AUTHENTICATE_WAIT : - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_AUTHENTICATE_WAIT\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_AUTHENTICATE_WAIT\n"); if (pMgmt->eCurrState == WMAC_STATE_AUTH) { // Call mgr to begin the association pDevice->byLinkWaitCount = 0; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCurrState == WMAC_STATE_AUTH\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCurrState == WMAC_STATE_AUTH\n"); vMgrAssocBeginSta((HANDLE)pDevice, pMgmt, &Status); if (Status == CMD_STATUS_SUCCESS) { pDevice->byLinkWaitCount = 0; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState = WLAN_ASSOCIATE_WAIT\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState = WLAN_ASSOCIATE_WAIT\n"); pDevice->eCommandState = WLAN_ASSOCIATE_WAIT; vCommandTimerWait((HANDLE)pDevice, ASSOCIATE_TIMEOUT); spin_unlock_irq(&pDevice->lock); @@ -732,7 +701,7 @@ printk("chester-abyDesireSSID=%s\n",((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySS case WLAN_ASSOCIATE_WAIT : if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCurrState == WMAC_STATE_ASSOC\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCurrState == WMAC_STATE_ASSOC\n"); if (pDevice->ePSMode != WMAC_POWER_CAM) { PSvEnablePowerSaving((HANDLE)pDevice, pMgmt->wListenInterval); } @@ -796,7 +765,7 @@ printk("chester-abyDesireSSID=%s\n",((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySS break; case WLAN_CMD_AP_MODE_START : - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_AP_MODE_START\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_AP_MODE_START\n"); if (pMgmt->eConfigMode == WMAC_CONFIG_AP) { del_timer(&pMgmt->sTimerSecondCallback); @@ -813,12 +782,12 @@ printk("chester-abyDesireSSID=%s\n",((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySS vMgrCreateOwnIBSS((HANDLE)pDevice, &Status); if (Status != CMD_STATUS_SUCCESS){ - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " vMgrCreateOwnIBSS fail ! \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " vMgrCreateOwnIBSS fail ! \n"); }; // alway turn off unicast bit MACvRegBitsOff(pDevice->PortOffset, MAC_REG_RCR, RCR_UNICAST); pDevice->byRxMode &= ~RCR_UNICAST; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wcmd: rx_mode = %x\n", pDevice->byRxMode ); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wcmd: rx_mode = %x\n", pDevice->byRxMode ); BSSvAddMulticastNode(pDevice); if (netif_queue_stopped(pDevice->dev)){ netif_wake_queue(pDevice->dev); @@ -841,7 +810,7 @@ printk("chester-abyDesireSSID=%s\n",((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySS pDevice->bMoreData = TRUE; } if (!device_dma0_xmit(pDevice, skb, 0)) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Multicast ps tx fail \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Multicast ps tx fail \n"); } pMgmt->sNodeDBTable[0].wEnQueueCnt--; } @@ -851,7 +820,7 @@ printk("chester-abyDesireSSID=%s\n",((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySS for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) { if (pMgmt->sNodeDBTable[ii].bActive && pMgmt->sNodeDBTable[ii].bRxPSPoll) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d Enqueu Cnt= %d\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d Enqueu Cnt= %d\n", ii, pMgmt->sNodeDBTable[ii].wEnQueueCnt); while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) != NULL) { if (skb_queue_empty(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) { @@ -864,7 +833,7 @@ printk("chester-abyDesireSSID=%s\n",((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySS pDevice->bMoreData = TRUE; } if (!device_dma0_xmit(pDevice, skb, ii)) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "sta ps tx fail \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "sta ps tx fail \n"); } pMgmt->sNodeDBTable[ii].wEnQueueCnt--; // check if sta ps enable, wait next pspoll @@ -876,7 +845,7 @@ printk("chester-abyDesireSSID=%s\n",((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySS // clear tx map pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[ii].wAID >> 3] &= ~byMask[pMgmt->sNodeDBTable[ii].wAID & 7]; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d PS queue clear \n", ii); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d PS queue clear \n", ii); } pMgmt->sNodeDBTable[ii].bRxPSPoll = FALSE; } @@ -887,7 +856,7 @@ printk("chester-abyDesireSSID=%s\n",((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySS case WLAN_CMD_RADIO_START : - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_RADIO_START\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_RADIO_START\n"); if (pDevice->bRadioCmd == TRUE) CARDbRadioPowerOn(pDevice); else @@ -898,7 +867,7 @@ printk("chester-abyDesireSSID=%s\n",((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySS case WLAN_CMD_CHECK_BBSENSITIVITY_CHANGE : - //DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_CHECK_BBSENSITIVITY_START\n"); + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_CHECK_BBSENSITIVITY_START\n"); // wait all TD complete if (pDevice->iTDUsed[TYPE_AC0DMA] != 0){ vCommandTimerWait((HANDLE)pDevice, 10); @@ -912,7 +881,7 @@ printk("chester-abyDesireSSID=%s\n",((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySS } pDevice->byBBVGACurrent = pDevice->byBBVGANew; BBvSetVGAGainOffset(pDevice, pDevice->byBBVGACurrent); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SetVGAGainOffset %02X\n", pDevice->byBBVGACurrent); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SetVGAGainOffset %02X\n", pDevice->byBBVGACurrent); s_bCommandComplete(pDevice); break; @@ -956,18 +925,18 @@ s_bCommandComplete ( pDevice->bCmdRunning = TRUE; switch ( pDevice->eCommand ) { case WLAN_CMD_BSSID_SCAN: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_BSSID_SCAN\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_BSSID_SCAN\n"); pDevice->eCommandState = WLAN_CMD_SCAN_START; pMgmt->uScanChannel = 0; if (pSSID->len != 0) { - MEMvCopy(pMgmt->abyScanSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); + memcpy(pMgmt->abyScanSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); } else { memset(pMgmt->abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); } /* if ((bForceSCAN == FALSE) && (pDevice->bLinkPass == TRUE)) { if ((pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) && - (MEMEqualMemory(pSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID, pSSID->len))) { + ( !memcmp(pSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID, pSSID->len))) { pDevice->eCommandState = WLAN_CMD_IDLE; } } @@ -978,8 +947,8 @@ s_bCommandComplete ( if (pSSID->len > WLAN_SSID_MAXLEN) pSSID->len = WLAN_SSID_MAXLEN; if (pSSID->len != 0) - MEMvCopy(pDevice->pMgmt->abyDesireSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_SSID_START\n"); + memcpy(pDevice->pMgmt->abyDesireSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_SSID_START\n"); break; case WLAN_CMD_DISASSOCIATE: pDevice->eCommandState = WLAN_CMD_DISASSOCIATE_START; @@ -1031,18 +1000,18 @@ BOOL bScheduleCommand ( switch (eCommand) { case WLAN_CMD_BSSID_SCAN: - MEMvCopy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, + memcpy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = FALSE; break; case WLAN_CMD_SSID: - MEMvCopy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, + memcpy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); break; case WLAN_CMD_DISASSOCIATE: - pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bNeedRadioOFF = *((PBOOL)pbyItem0); + pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bNeedRadioOFF = *((int *)pbyItem0); break; /* case WLAN_CMD_DEAUTH: @@ -1054,7 +1023,7 @@ BOOL bScheduleCommand ( break; case WLAN_CMD_RADIO: - pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bRadioCmd = *((PBOOL)pbyItem0); + pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bRadioCmd = *((int *)pbyItem0); break; case WLAN_CMD_CHANGE_BBSENSITIVITY: diff --git a/drivers/staging/vt6655/wcmd.h b/drivers/staging/vt6655/wcmd.h index 8c6bbc4..af32e57 100644 --- a/drivers/staging/vt6655/wcmd.h +++ b/drivers/staging/vt6655/wcmd.h @@ -29,15 +29,9 @@ #ifndef __WCMD_H__ #define __WCMD_H__ -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif -#if !defined(__80211HDR_H__) #include "80211hdr.h" -#endif -#if !defined(__80211MGR_H__) #include "80211mgr.h" -#endif /*--------------------- Export Definitions -------------------------*/ @@ -46,6 +40,7 @@ #define AUTHENTICATE_TIMEOUT 1000 //ms #define ASSOCIATE_TIMEOUT 1000 //ms + // Command code typedef enum tagCMD_CODE { WLAN_CMD_BSSID_SCAN, @@ -63,21 +58,19 @@ typedef enum tagCMD_CODE { WLAN_CMD_MAC_DISPOWERSAVING, WLAN_CMD_11H_CHSW, WLAN_CMD_RUN_AP -} CMD_CODE, DEF* PCMD_CODE; +} CMD_CODE, *PCMD_CODE; #define CMD_Q_SIZE 32 - -// Command code typedef enum tagCMD_STATUS { - CMD_STATUS_SUCCESS, + CMD_STATUS_SUCCESS = 0, CMD_STATUS_FAILURE, CMD_STATUS_RESOURCES, CMD_STATUS_TIMEOUT, CMD_STATUS_PENDING -} CMD_STATUS, DEF* PCMD_STATUS; +} CMD_STATUS, *PCMD_STATUS; typedef struct tagCMD_ITEM { @@ -87,7 +80,7 @@ typedef struct tagCMD_ITEM { WORD wDeAuthenReason; BOOL bRadioCmd; BOOL bForceSCAN; -} CMD_ITEM, DEF* PCMD_ITEM; +} CMD_ITEM, *PCMD_ITEM; // Command state typedef enum tagCMD_STATE { @@ -103,7 +96,8 @@ typedef enum tagCMD_STATE { WLAN_CMD_RADIO_START, WLAN_CMD_CHECK_BBSENSITIVITY_CHANGE, WLAN_CMD_IDLE -} CMD_STATE, DEF* PCMD_STATE; +} CMD_STATE, *PCMD_STATE; + /*--------------------- Export Classes ----------------------------*/ @@ -115,7 +109,6 @@ typedef enum tagCMD_STATE { /*--------------------- Export Functions --------------------------*/ - VOID vResetCommandTimer( IN HANDLE hDeviceContext @@ -148,4 +141,5 @@ BSSvSecondTxData( IN HANDLE hDeviceContext ); #endif + #endif //__WCMD_H__ diff --git a/drivers/staging/vt6655/wctl.c b/drivers/staging/vt6655/wctl.c index b4fecc2..4406f8c 100644 --- a/drivers/staging/vt6655/wctl.c +++ b/drivers/staging/vt6655/wctl.c @@ -34,16 +34,9 @@ * */ - -#if !defined(__WCTL_H__) #include "wctl.h" -#endif -#if !defined(__DEVICE_H__) #include "device.h" -#endif -#if !defined(__CARD_H__) #include "card.h" -#endif /*--------------------- Static Definitions -------------------------*/ @@ -212,16 +205,12 @@ UINT uHeaderSize; } } // reserve 4 byte to match MAC RX Buffer -#ifdef PRIVATE_OBJ - pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer = (PBYTE) (pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].ref_skb.data + 4); -#else pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer = (PBYTE) (pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].skb->data + 4); -#endif memcpy(pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer, pMACHeader, cbFrameLength); pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].cbFrameLength = cbFrameLength; pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer += cbFrameLength; pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum++; - //DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "First pDevice->uCurrentDFCBIdx= %d\n", pDevice->uCurrentDFCBIdx); + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "First pDevice->uCurrentDFCBIdx= %d\n", pDevice->uCurrentDFCBIdx); return(FALSE); } else { @@ -235,7 +224,7 @@ UINT uHeaderSize; pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].cbFrameLength += (cbFrameLength - uHeaderSize); pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer += (cbFrameLength - uHeaderSize); pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum++; - //DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Second pDevice->uCurrentDFCBIdx= %d\n", pDevice->uCurrentDFCBIdx); + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Second pDevice->uCurrentDFCBIdx= %d\n", pDevice->uCurrentDFCBIdx); } else { // seq error or frag # error flush DFCB @@ -251,7 +240,7 @@ UINT uHeaderSize; //enq defragcontrolblock pDevice->cbFreeDFCB++; pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].bInUse = FALSE; - //DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Last pDevice->uCurrentDFCBIdx= %d\n", pDevice->uCurrentDFCBIdx); + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Last pDevice->uCurrentDFCBIdx= %d\n", pDevice->uCurrentDFCBIdx); return(TRUE); } return(FALSE); diff --git a/drivers/staging/vt6655/wctl.h b/drivers/staging/vt6655/wctl.h index f75ca59..a1ac479 100644 --- a/drivers/staging/vt6655/wctl.h +++ b/drivers/staging/vt6655/wctl.h @@ -26,21 +26,12 @@ * */ - #ifndef __WCTL_H__ #define __WCTL_H__ -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif -#if !defined(__TETHER_H__) #include "tether.h" -#endif -#if !defined(__DEVICE_H__) #include "device.h" -#endif - - /*--------------------- Export Definitions -------------------------*/ @@ -105,22 +96,12 @@ /*--------------------- Export Variables --------------------------*/ /*--------------------- Export Functions --------------------------*/ -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ BOOL WCTLbIsDuplicate(PSCache pCache, PS802_11Header pMACHeader); BOOL WCTLbHandleFragment(PSDevice pDevice, PS802_11Header pMACHeader, UINT cbFrameLength, BOOL bWEP, BOOL bExtIV); UINT WCTLuSearchDFCB(PSDevice pDevice, PS802_11Header pMACHeader); UINT WCTLuInsertDFCB(PSDevice pDevice, PS802_11Header pMACHeader); -#ifdef __cplusplus -} /* End of extern "C" { */ -#endif /* __cplusplus */ - - - - #endif // __WCTL_H__ diff --git a/drivers/staging/vt6655/wmgr.c b/drivers/staging/vt6655/wmgr.c index c0886ed..659be05 100644 --- a/drivers/staging/vt6655/wmgr.c +++ b/drivers/staging/vt6655/wmgr.c @@ -16,6 +16,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + * * File: wmgr.c * * Purpose: Handles the 802.11 management functions @@ -60,64 +61,23 @@ * */ - -#if !defined(__TMACRO_H__) #include "tmacro.h" -#endif -#if !defined(__TBIT_H__) -#include "tbit.h" -#endif -#if !defined(__DESC_H__) #include "desc.h" -#endif -#if !defined(__DEVICE_H__) #include "device.h" -#endif -#if !defined(__CARD_H__) #include "card.h" -#endif -#if !defined(__80211HDR_H__) #include "80211hdr.h" -#endif -#if !defined(__80211MGR_H__) #include "80211mgr.h" -#endif -#if !defined(__WMGR_H__) #include "wmgr.h" -#endif -#if !defined(__WCMD_H__) #include "wcmd.h" -#endif -#if !defined(__MAC_H__) #include "mac.h" -#endif -#if !defined(__BSSDB_H__) #include "bssdb.h" -#endif -#if !defined(__POWER_H__) #include "power.h" -#endif -#if !defined(__DATARATE_H__) #include "datarate.h" -#endif -#if !defined(__BASEBAND_H__) #include "baseband.h" -#endif -#if !defined(__RXTX_H__) #include "rxtx.h" -#endif -#if !defined(__WPA_H__) #include "wpa.h" -#endif -#if !defined(__RF_H__) #include "rf.h" -#endif -#if !defined(__UMEM_H__) -#include "umem.h" -#endif -#if !defined(__IOWPA_H__) #include "iowpa.h" -#endif #define PLICE_DEBUG @@ -137,6 +97,7 @@ static BOOL ChannelExceedZoneType( IN PSDevice pDevice, IN BYTE byCurrChannel ); + // Association/diassociation functions static PSTxMgmtPacket @@ -363,33 +324,10 @@ s_bCipherMatch ( OUT PBYTE pbyCCSGK ); - static VOID Encyption_Rebuild( IN PSDevice pDevice, IN PKnownBSS pCurr ); -/* -static -VOID -s_vProbeChannel( - IN PSDevice pDevice - ); - -static -VOID -s_vListenChannel( - IN PSDevice pDevice - ); - -static -PSTxMgmtPacket -s_MgrMakeProbeRequest( - IN PSMgmtObject pMgmt, - IN PBYTE pScanBSSID, - IN PWLAN_IE_SSID pSSID, - IN PWLAN_IE_SUPP_RATES pCurrRates - ); -*/ @@ -656,10 +594,10 @@ vMgrReAssocBeginSta( /* send the frame */ *pStatus = csMgmt_xmit(pDevice, pTxPacket); if (*pStatus != CMD_STATUS_PENDING) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Reassociation tx failed.\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Reassociation tx failed.\n"); } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Reassociation tx sending.\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Reassociation tx sending.\n"); } } @@ -836,8 +774,8 @@ s_vMgrRxAssocRequest( pDevice->bBarkerPreambleMd = TRUE; } - DEVICE_PRT(MSG_LEVEL_INFO, KERN_INFO "Associate AID= %d \n", wAssocAID); - DEVICE_PRT(MSG_LEVEL_INFO, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X \n", + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Associate AID= %d \n", wAssocAID); + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X \n", sFrame.pHdr->sA3.abyAddr2[0], sFrame.pHdr->sA3.abyAddr2[1], sFrame.pHdr->sA3.abyAddr2[2], @@ -845,7 +783,7 @@ s_vMgrRxAssocRequest( sFrame.pHdr->sA3.abyAddr2[4], sFrame.pHdr->sA3.abyAddr2[5] ) ; - DEVICE_PRT(MSG_LEVEL_INFO, KERN_INFO "Max Support rate = %d \n", + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Max Support rate = %d \n", pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate); }//else { TODO: received STA under state1 handle } else { @@ -873,10 +811,10 @@ s_vMgrRxAssocRequest( /* send the frame */ Status = csMgmt_xmit(pDevice, pTxPacket); if (Status != CMD_STATUS_PENDING) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Assoc response tx failed\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Assoc response tx failed\n"); } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Assoc response tx sending..\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Assoc response tx sending..\n"); } } @@ -996,8 +934,8 @@ s_vMgrRxReAssocRequest( pDevice->bBarkerPreambleMd = TRUE; } - DEVICE_PRT(MSG_LEVEL_INFO, KERN_INFO "Rx ReAssociate AID= %d \n", wAssocAID); - DEVICE_PRT(MSG_LEVEL_INFO, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X \n", + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Rx ReAssociate AID= %d \n", wAssocAID); + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X \n", sFrame.pHdr->sA3.abyAddr2[0], sFrame.pHdr->sA3.abyAddr2[1], sFrame.pHdr->sA3.abyAddr2[2], @@ -1005,7 +943,7 @@ s_vMgrRxReAssocRequest( sFrame.pHdr->sA3.abyAddr2[4], sFrame.pHdr->sA3.abyAddr2[5] ) ; - DEVICE_PRT(MSG_LEVEL_INFO, KERN_INFO "Max Support rate = %d \n", + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Max Support rate = %d \n", pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate); } @@ -1031,10 +969,10 @@ s_vMgrRxReAssocRequest( } Status = csMgmt_xmit(pDevice, pTxPacket); if (Status != CMD_STATUS_PENDING) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:ReAssoc response tx failed\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:ReAssoc response tx failed\n"); } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:ReAssoc response tx sending..\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:ReAssoc response tx sending..\n"); } } return; @@ -1099,13 +1037,13 @@ s_vMgrRxAssocResponse( pMgmt->wCurrAID = cpu_to_le16((*(sFrame.pwAid))); if ( (pMgmt->wCurrAID >> 14) != (BIT0 | BIT1) ) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "AID from AP, has two msb clear.\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "AID from AP, has two msb clear.\n"); }; - DEVICE_PRT(MSG_LEVEL_INFO, KERN_INFO "Association Successful, AID=%d.\n", pMgmt->wCurrAID & ~(BIT14|BIT15)); + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Association Successful, AID=%d.\n", pMgmt->wCurrAID & ~(BIT14|BIT15)); pMgmt->eCurrState = WMAC_STATE_ASSOC; BSSvUpdateAPNode((HANDLE)pDevice, sFrame.pwCapInfo, sFrame.pSuppRates, sFrame.pExtSuppRates); pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; - DEVICE_PRT(MSG_LEVEL_INFO, KERN_INFO "Link with AP(SSID): %s\n", pItemSSID->abySSID); + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Link with AP(SSID): %s\n", pItemSSID->abySSID); pDevice->bLinkPass = TRUE; pDevice->uBBVGADiffCount = 0; if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) { @@ -1125,7 +1063,7 @@ s_vMgrRxAssocResponse( ); skb_put(pDevice->skb, sizeof(viawget_wpa_header) + wpahdr->resp_ie_len + wpahdr->req_ie_len); 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)); @@ -1362,7 +1300,7 @@ s_vMgrRxAuthentication( s_vMgrRxAuthenSequence_4(pDevice, pMgmt, &sFrame); break; default: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Auth Sequence error, seq = %d\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Auth Sequence error, seq = %d\n", cpu_to_le16((*(sFrame.pwAuthSequence)))); break; } @@ -1469,9 +1407,9 @@ s_vMgrRxAuthenSequence_1( if (pDevice->bEnableHostapd) { return; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_1 tx.. \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_1 tx.. \n"); if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_1 tx failed.\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_1 tx failed.\n"); } return; } @@ -1506,12 +1444,12 @@ s_vMgrRxAuthenSequence_2( { case WLAN_AUTH_ALG_OPENSYSTEM: if ( cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS ){ - DEVICE_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (OPEN) Successful.\n"); + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (OPEN) Successful.\n"); pMgmt->eCurrState = WMAC_STATE_AUTH; timer_expire(pDevice->sTimerCommand, 0); } else { - DEVICE_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (OPEN) Failed.\n"); + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (OPEN) Failed.\n"); s_vMgrLogStatus(pMgmt, cpu_to_le16((*(pFrame->pwStatus)))); pMgmt->eCurrState = WMAC_STATE_IDLE; } @@ -1556,12 +1494,12 @@ s_vMgrRxAuthenSequence_2( pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; // send the frame if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Auth_reply sequence_2 tx failed.\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Auth_reply sequence_2 tx failed.\n"); } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Auth_reply sequence_2 tx ...\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Auth_reply sequence_2 tx ...\n"); } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:rx Auth_reply sequence_2 status error ...\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:rx Auth_reply sequence_2 status error ...\n"); if ( pDevice->eCommandState == WLAN_AUTHENTICATE_WAIT ) { // spin_unlock_irq(&pDevice->lock); // vCommandTimerWait((HANDLE)pDevice, 0); @@ -1571,7 +1509,7 @@ s_vMgrRxAuthenSequence_2( } break; default: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt: rx auth.seq = 2 unknown AuthAlgorithm=%d\n", cpu_to_le16((*(pFrame->pwAuthAlgorithm)))); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt: rx auth.seq = 2 unknown AuthAlgorithm=%d\n", cpu_to_le16((*(pFrame->pwAuthAlgorithm)))); break; } return; @@ -1629,7 +1567,7 @@ s_vMgrRxAuthenSequence_3( pMgmt->sNodeDBTable[uNodeIndex].byAuthSequence = 0; } uStatusCode = WLAN_MGMT_STATUS_SUCCESS; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Challenge text check ok..\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Challenge text check ok..\n"); reply: // send auth reply @@ -1662,7 +1600,7 @@ reply: return; } if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_4 tx failed.\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_4 tx failed.\n"); } return; @@ -1690,12 +1628,12 @@ s_vMgrRxAuthenSequence_4( { if ( cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS ){ - DEVICE_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (SHAREDKEY) Successful.\n"); + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (SHAREDKEY) Successful.\n"); pMgmt->eCurrState = WMAC_STATE_AUTH; timer_expire(pDevice->sTimerCommand, 0); } else{ - DEVICE_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (SHAREDKEY) Failed.\n"); + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (SHAREDKEY) Failed.\n"); s_vMgrLogStatus(pMgmt, cpu_to_le16((*(pFrame->pwStatus))) ); pMgmt->eCurrState = WMAC_STATE_IDLE; } @@ -1741,14 +1679,14 @@ s_vMgrRxDisassociation( BSSvRemoveOneNode(pDevice, uNodeIndex); } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx disassoc, sta not found\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx disassoc, sta not found\n"); } } else if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA ){ sFrame.len = pRxPacket->cbMPDULen; sFrame.pBuf = (PBYTE)pRxPacket->p80211Header; vMgrDecodeDisassociation(&sFrame); - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP disassociated me, reason=%d.\n", cpu_to_le16(*(sFrame.pwReason))); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP disassociated me, reason=%d.\n", cpu_to_le16(*(sFrame.pwReason))); //TODO: do something let upper layer know or //try to send associate packet again because of inactivity timeout // if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { @@ -1761,7 +1699,7 @@ s_vMgrRxDisassociation( 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); @@ -1780,7 +1718,6 @@ s_vMgrRxDisassociation( wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); } #endif - } /* else, ignore it */ @@ -1822,7 +1759,7 @@ s_vMgrRxDeauthentication( BSSvRemoveOneNode(pDevice, uNodeIndex); } else { - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Rx deauth, sta not found\n"); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Rx deauth, sta not found\n"); } } else { @@ -1830,7 +1767,7 @@ s_vMgrRxDeauthentication( sFrame.len = pRxPacket->cbMPDULen; sFrame.pBuf = (PBYTE)pRxPacket->p80211Header; vMgrDecodeDeauthen(&sFrame); - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP deauthed me, reason=%d.\n", cpu_to_le16((*(sFrame.pwReason)))); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP deauthed me, reason=%d.\n", cpu_to_le16((*(sFrame.pwReason)))); // TODO: update BSS list for specific BSSID if pre-authentication case if (IS_ETH_ADDRESS_EQUAL(sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID)) { if (pMgmt->eCurrState >= WMAC_STATE_AUTHPENDING) { @@ -1849,7 +1786,7 @@ s_vMgrRxDeauthentication( 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)); @@ -1857,13 +1794,13 @@ s_vMgrRxDeauthentication( pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz); }; - #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT + #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT // if(pDevice->bWPASuppWextEnabled == TRUE) { union iwreq_data wrqu; memset(&wrqu, 0, sizeof (wrqu)); wrqu.ap_addr.sa_family = ARPHRD_ETHER; - printk("wireless_send_event--->SIOCGIWAP(disauthen)\n"); + PRINT_K("wireless_send_event--->SIOCGIWAP(disauthen)\n"); wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); } #endif @@ -1972,7 +1909,7 @@ s_vMgrRxBeacon( (sFrame.pwCapInfo == 0) || (sFrame.pSSID == 0) || (sFrame.pSuppRates == 0) ) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx beacon frame error\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx beacon frame error\n"); return; }; @@ -2008,7 +1945,7 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) pBSSList = BSSpAddrIsInBSSList((HANDLE)pDevice, sFrame.pHdr->sA3.abyAddr3, sFrame.pSSID); if (pBSSList == NULL) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Beacon/insert: RxChannel = : %d\n", byCurrChannel); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Beacon/insert: RxChannel = : %d\n", byCurrChannel); BSSbInsertToBSSList((HANDLE)pDevice, sFrame.pHdr->sA3.abyAddr3, *sFrame.pqwTimestamp, @@ -2029,7 +1966,7 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) ); } else { -// DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"update bcn: RxChannel = : %d\n", byCurrChannel); +// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"update bcn: RxChannel = : %d\n", byCurrChannel); BSSbUpdateToBSSList((HANDLE)pDevice, *sFrame.pqwTimestamp, *sFrame.pwBeaconInterval, @@ -2106,7 +2043,7 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) if (pMgmt->sNodeDBTable[0].uInActiveCount != 0) { pMgmt->sNodeDBTable[0].uInActiveCount = 0; - //DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BCN:Wake Count= [%d]\n", pMgmt->wCountToWakeUp); + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BCN:Wake Count= [%d]\n", pMgmt->wCountToWakeUp); } } // check if SSID the same @@ -2195,7 +2132,7 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) } } -// DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Beacon 2 \n"); +// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Beacon 2 \n"); // check if CF field exisit if (WLAN_GET_CAP_INFO_ESS(*sFrame.pwCapInfo)) { if (sFrame.pCFParms->wCFPDurRemaining > 0) { @@ -2276,23 +2213,23 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) (pMgmt->bMulticastTIM && (pMgmt->byDTIMCount == 0))) { pMgmt->bInTIMWake = TRUE; // send out ps-poll packet -// DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN:In TIM\n"); +// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN:In TIM\n"); if (pMgmt->bInTIM) { PSvSendPSPOLL((PSDevice)pDevice); -// DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN:PS-POLL sent..\n"); +// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN:PS-POLL sent..\n"); }; } else { pMgmt->bInTIMWake = FALSE; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Not In TIM..\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Not In TIM..\n"); if (pDevice->bPWBitOn == FALSE) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Send Null Packet\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Send Null Packet\n"); if (PSbSendNullPacket(pDevice)) pDevice->bPWBitOn = TRUE; } if(PSbConsiderPowerDown(pDevice, FALSE, FALSE)) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Power down now...\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Power down now...\n"); }; } @@ -2369,7 +2306,7 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) // if other stations jointed, indicate connect to upper layer.. if (pMgmt->eCurrState == WMAC_STATE_STARTED) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Current IBSS State: [Started]........to: [Jointed] \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Current IBSS State: [Started]........to: [Jointed] \n"); pMgmt->eCurrState = WMAC_STATE_JOINTED; pDevice->bLinkPass = TRUE; if (netif_queue_stopped(pDevice->dev)){ @@ -2397,7 +2334,7 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, WLAN_RATES_MAXLEN_11B); // set HW beacon interval and re-synchronizing.... - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rejoining to Other Adhoc group with same SSID........\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rejoining to Other Adhoc group with same SSID........\n"); VNSvOutPortW(pDevice->PortOffset + MAC_REG_BI, pMgmt->wCurrBeaconPeriod); CARDbUpdateTSF(pDevice, pRxPacket->byRxRate, qwTimestamp, qwLocalTSF); CARDvUpdateNextTBTT(pDevice->PortOffset, qwTimestamp, pMgmt->wCurrBeaconPeriod); @@ -2466,7 +2403,7 @@ vMgrCreateOwnIBSS( BYTE abyOFDM_RATE[] = {0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; WORD wSuppRate; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create Basic Service Set .......\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create Basic Service Set .......\n"); if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) { if ((pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) && @@ -2559,7 +2496,7 @@ vMgrCreateOwnIBSS( } if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) { - MEMvCopy(pMgmt->abyIBSSDFSOwner, pDevice->abyCurrentNetAddr, 6); + memcpy(pMgmt->abyIBSSDFSOwner, pDevice->abyCurrentNetAddr, 6); pMgmt->byIBSSDFSRecovery = 10; pMgmt->eCurrMode = WMAC_MODE_IBSS_STA; } @@ -2583,7 +2520,7 @@ vMgrCreateOwnIBSS( if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { // AP mode BSSID = MAC addr memcpy(pMgmt->abyCurrBSSID, pMgmt->abyMACAddr, WLAN_ADDR_LEN); - DEVICE_PRT(MSG_LEVEL_INFO, KERN_INFO"AP beacon created BSSID:%02x-%02x-%02x-%02x-%02x-%02x \n", + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO"AP beacon created BSSID:%02x-%02x-%02x-%02x-%02x-%02x \n", pMgmt->abyCurrBSSID[0], pMgmt->abyCurrBSSID[1], pMgmt->abyCurrBSSID[2], @@ -2612,7 +2549,7 @@ vMgrCreateOwnIBSS( pMgmt->abyCurrBSSID[0] |= IEEE_ADDR_UNIVERSAL; - DEVICE_PRT(MSG_LEVEL_INFO, KERN_INFO"Adhoc beacon created bssid:%02x-%02x-%02x-%02x-%02x-%02x \n", + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO"Adhoc beacon created bssid:%02x-%02x-%02x-%02x-%02x-%02x \n", pMgmt->abyCurrBSSID[0], pMgmt->abyCurrBSSID[1], pMgmt->abyCurrBSSID[2], @@ -2743,7 +2680,7 @@ vMgrJoinBSSBegin( if (ii == MAX_BSS_NUM) { *pStatus = CMD_STATUS_RESOURCES; - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "BSS finding:BSS list is empty.\n"); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "BSS finding:BSS list is empty.\n"); return; }; @@ -2759,11 +2696,11 @@ vMgrJoinBSSBegin( if (pCurr == NULL){ *pStatus = CMD_STATUS_RESOURCES; pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Scanning [%s] not found, disconnected !\n", pItemSSID->abySSID); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Scanning [%s] not found, disconnected !\n", pItemSSID->abySSID); return; }; - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP(BSS) finding:Found a AP(BSS)..\n"); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP(BSS) finding:Found a AP(BSS)..\n"); if (WLAN_GET_CAP_INFO_ESS(cpu_to_le16(pCurr->wCapInfo))){ if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA)||(pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK)) { @@ -2772,14 +2709,14 @@ vMgrJoinBSSBegin( /* if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) { if (WPA_SearchRSN(0, WPA_TKIP, pCurr) == FALSE) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"No match RSN info. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"No match RSN info. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); // encryption mode error pMgmt->eCurrState = WMAC_STATE_IDLE; return; } } else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) { if (WPA_SearchRSN(0, WPA_AESCCMP, pCurr) == FALSE) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"No match RSN info. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"No match RSN info. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); // encryption mode error pMgmt->eCurrState = WMAC_STATE_IDLE; return; @@ -2866,10 +2803,10 @@ vMgrJoinBSSBegin( // This should only works for WPA2 BSS, and WPA2 BSS check must be done before. if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) { BOOL bResult = bAdd_PMKID_Candidate((HANDLE)pDevice, pMgmt->abyCurrBSSID, &pCurr->sRSNCapObj); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"bAdd_PMKID_Candidate: 1(%d)\n", bResult); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"bAdd_PMKID_Candidate: 1(%d)\n", bResult); if (bResult == FALSE) { vFlush_PMKID_Candidate((HANDLE)pDevice); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"vFlush_PMKID_Candidate: 4\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"vFlush_PMKID_Candidate: 4\n"); bAdd_PMKID_Candidate((HANDLE)pDevice, pMgmt->abyCurrBSSID, &pCurr->sRSNCapObj); } } @@ -2877,11 +2814,11 @@ vMgrJoinBSSBegin( // Preamble type auto-switch: if AP can receive short-preamble cap, // we can turn on too. - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Join ESS\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Join ESS\n"); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"End of Join AP -- A/B/G Action\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"End of Join AP -- A/B/G Action\n"); } else { pMgmt->eCurrState = WMAC_STATE_IDLE; @@ -2949,7 +2886,7 @@ vMgrJoinBSSBegin( // pDevice->bLinkPass = TRUE; // memcpy(pDevice->abyBSSID, pCurr->abyBSSID, WLAN_BSSID_LEN); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Join IBSS ok:%02x-%02x-%02x-%02x-%02x-%02x \n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Join IBSS ok:%02x-%02x-%02x-%02x-%02x-%02x \n", pMgmt->abyCurrBSSID[0], pMgmt->abyCurrBSSID[1], pMgmt->abyCurrBSSID[2], @@ -3008,7 +2945,7 @@ s_vMgrSynchBSS ( pDevice->eEncryptionStatus, &(pMgmt->byCSSPK), &(pMgmt->byCSSGK)) == FALSE) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "s_bCipherMatch Fail .......\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "s_bCipherMatch Fail .......\n"); return; } @@ -3046,7 +2983,7 @@ s_vMgrSynchBSS ( MACvReadBSSIDAddress(pDevice->PortOffset, pMgmt->abyCurrBSSID); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Sync:set CurrBSSID address = %02x-%02x-%02x=%02x-%02x-%02x\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Sync:set CurrBSSID address = %02x-%02x-%02x=%02x-%02x-%02x\n", pMgmt->abyCurrBSSID[0], pMgmt->abyCurrBSSID[1], pMgmt->abyCurrBSSID[2], @@ -3081,14 +3018,14 @@ s_vMgrSynchBSS ( } if (ePhyType == PHY_TYPE_11A) { - MEMvCopy(pMgmt->abyCurrSuppRates, &abyCurrSuppRatesA[0], sizeof(abyCurrSuppRatesA)); + memcpy(pMgmt->abyCurrSuppRates, &abyCurrSuppRatesA[0], sizeof(abyCurrSuppRatesA)); pMgmt->abyCurrExtSuppRates[1] = 0; } else if (ePhyType == PHY_TYPE_11B) { - MEMvCopy(pMgmt->abyCurrSuppRates, &abyCurrSuppRatesB[0], sizeof(abyCurrSuppRatesB)); + memcpy(pMgmt->abyCurrSuppRates, &abyCurrSuppRatesB[0], sizeof(abyCurrSuppRatesB)); pMgmt->abyCurrExtSuppRates[1] = 0; } else { - MEMvCopy(pMgmt->abyCurrSuppRates, &abyCurrSuppRatesG[0], sizeof(abyCurrSuppRatesG)); - MEMvCopy(pMgmt->abyCurrExtSuppRates, &abyCurrExtSuppRatesG[0], sizeof(abyCurrExtSuppRatesG)); + memcpy(pMgmt->abyCurrSuppRates, &abyCurrSuppRatesG[0], sizeof(abyCurrSuppRatesG)); + memcpy(pMgmt->abyCurrExtSuppRates, &abyCurrExtSuppRatesG[0], sizeof(abyCurrExtSuppRatesG)); } @@ -3110,12 +3047,12 @@ s_vMgrSynchBSS ( pMgmt->abyCurrSuppRates, pMgmt->abyCurrExtSuppRates ) != TRUE) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "<----s_bSynchBSS Set Phy Mode Fail [%d]\n", ePhyType); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "<----s_bSynchBSS Set Phy Mode Fail [%d]\n", ePhyType); return; } // set channel and clear NAV if (CARDbSetChannel(pMgmt->pAdapter, pCurr->uChannel) == FALSE) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "<----s_bSynchBSS Set Channel [%d]\n", pCurr->uChannel); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "<----s_bSynchBSS Set Channel [%d]\n", pCurr->uChannel); return; } @@ -3128,7 +3065,7 @@ s_vMgrSynchBSS ( } if (pDevice->byBBVGANew != pDevice->byBBVGACurrent) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RSSI[%d] NewGain[%d] OldGain[%d] \n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RSSI[%d] NewGain[%d] OldGain[%d] \n", (int)pCurr->ldBmMAX, pDevice->byBBVGANew, pDevice->byBBVGACurrent); printk("RSSI[%d] NewGain[%d] OldGain[%d] \n", (int)pCurr->ldBmMAX, pDevice->byBBVGANew, pDevice->byBBVGACurrent); @@ -3140,7 +3077,7 @@ s_vMgrSynchBSS ( pMgmt->uCurrChannel = pCurr->uChannel; pMgmt->eCurrentPHYMode = ePhyType; pMgmt->byERPContext = pCurr->sERP.byERP; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Sync:Set to channel = [%d]\n", (INT)pCurr->uChannel); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Sync:Set to channel = [%d]\n", (INT)pCurr->uChannel); *pStatus = CMD_STATUS_SUCCESS; @@ -3172,22 +3109,22 @@ s_vMgrSynchBSS ( pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK; if(pCurr->abyPKType[0] == WPA_TKIP) { pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; //TKIP - printk("Encyption_Rebuild--->ssid reset config to [WPAPSK-TKIP]\n"); + PRINT_K("Encyption_Rebuild--->ssid reset config to [WPAPSK-TKIP]\n"); } else if(pCurr->abyPKType[0] == WPA_AESCCMP) { pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; //AES - printk("Encyption_Rebuild--->ssid reset config to [WPAPSK-AES]\n"); + PRINT_K("Encyption_Rebuild--->ssid reset config to [WPAPSK-AES]\n"); } } else if(pCurr->bWPA2Valid == TRUE) { //WPA2-PSK pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK; if(pCurr->abyCSSPK[0] == WLAN_11i_CSS_TKIP) { pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; //TKIP - printk("Encyption_Rebuild--->ssid reset config to [WPA2PSK-TKIP]\n"); + PRINT_K("Encyption_Rebuild--->ssid reset config to [WPA2PSK-TKIP]\n"); } else if(pCurr->abyCSSPK[0] == WLAN_11i_CSS_CCMP) { pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; //AES - printk("Encyption_Rebuild--->ssid reset config to [WPA2PSK-AES]\n"); + PRINT_K("Encyption_Rebuild--->ssid reset config to [WPA2PSK-AES]\n"); } } } @@ -3438,7 +3375,7 @@ s_MgrMakeBeacon( pIBSSDFS = (PWLAN_IE_IBSS_DFS) pbyBuffer; pIBSSDFS->byElementID = WLAN_EID_IBSS_DFS; pIBSSDFS->len = 7; - MEMvCopy( pIBSSDFS->abyDFSOwner, + memcpy( pIBSSDFS->abyDFSOwner, pMgmt->abyIBSSDFSOwner, 6); pIBSSDFS->byDFSRecovery = pMgmt->byIBSSDFSRecovery; @@ -3471,7 +3408,7 @@ s_MgrMakeBeacon( if (((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len != 0) { sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN; - MEMvCopy(sFrame.pExtSuppRates, + memcpy(sFrame.pExtSuppRates, pCurrExtSuppRates, ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN ); @@ -3642,7 +3579,7 @@ s_MgrMakeProbeResponse( pIBSSDFS = (PWLAN_IE_IBSS_DFS) pbyBuffer; pIBSSDFS->byElementID = WLAN_EID_IBSS_DFS; pIBSSDFS->len = 7; - MEMvCopy( pIBSSDFS->abyDFSOwner, + memcpy( pIBSSDFS->abyDFSOwner, pMgmt->abyIBSSDFSOwner, 6); pIBSSDFS->byDFSRecovery = pMgmt->byIBSSDFSRecovery; @@ -3663,7 +3600,7 @@ s_MgrMakeProbeResponse( if (((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len != 0) { sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN; - MEMvCopy(sFrame.pExtSuppRates, + memcpy(sFrame.pExtSuppRates, pCurrExtSuppRates, ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN ); @@ -3749,7 +3686,7 @@ s_MgrMakeAssocRequest( pMgmt->sAssocInfo.AssocInfo.RequestIELength = pCurrSSID->len + WLAN_IEHDR_LEN; pMgmt->sAssocInfo.AssocInfo.OffsetRequestIEs = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); pbyIEs = pMgmt->sAssocInfo.abyIEs; - MEMvCopy(pbyIEs, pCurrSSID, pCurrSSID->len + WLAN_IEHDR_LEN); + memcpy(pbyIEs, pCurrSSID, pCurrSSID->len + WLAN_IEHDR_LEN); pbyIEs += pCurrSSID->len + WLAN_IEHDR_LEN; // Copy the rate set @@ -3768,7 +3705,7 @@ s_MgrMakeAssocRequest( } pMgmt->sAssocInfo.AssocInfo.RequestIELength += pCurrRates->len + WLAN_IEHDR_LEN; - MEMvCopy(pbyIEs, pCurrRates, pCurrRates->len + WLAN_IEHDR_LEN); + memcpy(pbyIEs, pCurrRates, pCurrRates->len + WLAN_IEHDR_LEN); pbyIEs += pCurrRates->len + WLAN_IEHDR_LEN; // for 802.11h @@ -3832,6 +3769,7 @@ s_MgrMakeAssocRequest( *pbyRSN++=0x01; *pbyRSN++=0x00; *pbyRSN++=0x00; + *pbyRSN++=0x50; *pbyRSN++=0xf2; if (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) { @@ -3843,16 +3781,19 @@ s_MgrMakeAssocRequest( else { *pbyRSN++=WPA_NONE; } + sFrame.pRSNWPA->len +=6; // RSN Capabilites + *pbyRSN++=0x00; *pbyRSN++=0x00; sFrame.pRSNWPA->len +=2; + sFrame.len += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN; // copy to AssocInfo. for OID_802_11_ASSOCIATION_INFORMATION pMgmt->sAssocInfo.AssocInfo.RequestIELength += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN; - MEMvCopy(pbyIEs, sFrame.pRSNWPA, sFrame.pRSNWPA->len + WLAN_IEHDR_LEN); + memcpy(pbyIEs, sFrame.pRSNWPA, sFrame.pRSNWPA->len + WLAN_IEHDR_LEN); pbyIEs += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN; } else if (((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || @@ -3914,7 +3855,7 @@ s_MgrMakeAssocRequest( // RSN Capabilites if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist == TRUE) { - MEMvCopy(&sFrame.pRSN->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2); + memcpy(&sFrame.pRSN->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2); } else { sFrame.pRSN->abyRSN[16] = 0; sFrame.pRSN->abyRSN[17] = 0; @@ -3928,9 +3869,9 @@ s_MgrMakeAssocRequest( *pwPMKID = 0; // Initialize PMKID count pbyRSN += 2; // Point to PMKID list for (ii = 0; ii < pDevice->gsPMKID.BSSIDInfoCount; ii++) { - if (MEMEqualMemory(&pDevice->gsPMKID.BSSIDInfo[ii].BSSID[0], pMgmt->abyCurrBSSID, U_ETHER_ADDR_LEN)) { + if ( !memcmp(&pDevice->gsPMKID.BSSIDInfo[ii].BSSID[0], pMgmt->abyCurrBSSID, U_ETHER_ADDR_LEN)) { (*pwPMKID) ++; - MEMvCopy(pbyRSN, pDevice->gsPMKID.BSSIDInfo[ii].PMKID, 16); + memcpy(pbyRSN, pDevice->gsPMKID.BSSIDInfo[ii].PMKID, 16); pbyRSN += 16; } } @@ -3942,7 +3883,7 @@ s_MgrMakeAssocRequest( sFrame.len += sFrame.pRSN->len + WLAN_IEHDR_LEN; // copy to AssocInfo. for OID_802_11_ASSOCIATION_INFORMATION pMgmt->sAssocInfo.AssocInfo.RequestIELength += sFrame.pRSN->len + WLAN_IEHDR_LEN; - MEMvCopy(pbyIEs, sFrame.pRSN, sFrame.pRSN->len + WLAN_IEHDR_LEN); + memcpy(pbyIEs, sFrame.pRSN, sFrame.pRSN->len + WLAN_IEHDR_LEN); pbyIEs += sFrame.pRSN->len + WLAN_IEHDR_LEN; } @@ -4024,7 +3965,7 @@ s_MgrMakeReAssocRequest( pMgmt->sAssocInfo.AssocInfo.RequestIELength = pCurrSSID->len + WLAN_IEHDR_LEN; pMgmt->sAssocInfo.AssocInfo.OffsetRequestIEs = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION); pbyIEs = pMgmt->sAssocInfo.abyIEs; - MEMvCopy(pbyIEs, pCurrSSID, pCurrSSID->len + WLAN_IEHDR_LEN); + memcpy(pbyIEs, pCurrSSID, pCurrSSID->len + WLAN_IEHDR_LEN); pbyIEs += pCurrSSID->len + WLAN_IEHDR_LEN; /* Copy the rate set */ @@ -4041,7 +3982,7 @@ s_MgrMakeReAssocRequest( } pMgmt->sAssocInfo.AssocInfo.RequestIELength += pCurrRates->len + WLAN_IEHDR_LEN; - MEMvCopy(pbyIEs, pCurrRates, pCurrRates->len + WLAN_IEHDR_LEN); + memcpy(pbyIEs, pCurrRates, pCurrRates->len + WLAN_IEHDR_LEN); pbyIEs += pCurrRates->len + WLAN_IEHDR_LEN; if (((pMgmt->eAuthenMode == WMAC_AUTH_WPA) || @@ -4087,6 +4028,7 @@ s_MgrMakeReAssocRequest( *pbyRSN++=0x01; *pbyRSN++=0x00; *pbyRSN++=0x00; + *pbyRSN++=0x50; *pbyRSN++=0xf2; if (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) { @@ -4096,16 +4038,18 @@ s_MgrMakeReAssocRequest( } else { *pbyRSN++=WPA_NONE; } + sFrame.pRSNWPA->len +=6; // RSN Capabilites *pbyRSN++=0x00; *pbyRSN++=0x00; sFrame.pRSNWPA->len +=2; + sFrame.len += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN; // copy to AssocInfo. for OID_802_11_ASSOCIATION_INFORMATION pMgmt->sAssocInfo.AssocInfo.RequestIELength += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN; - MEMvCopy(pbyIEs, sFrame.pRSNWPA, sFrame.pRSNWPA->len + WLAN_IEHDR_LEN); + memcpy(pbyIEs, sFrame.pRSNWPA, sFrame.pRSNWPA->len + WLAN_IEHDR_LEN); pbyIEs += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN; } else if (((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || @@ -4167,7 +4111,7 @@ s_MgrMakeReAssocRequest( // RSN Capabilites if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist == TRUE) { - MEMvCopy(&sFrame.pRSN->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2); + memcpy(&sFrame.pRSN->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2); } else { sFrame.pRSN->abyRSN[16] = 0; sFrame.pRSN->abyRSN[17] = 0; @@ -4181,9 +4125,9 @@ s_MgrMakeReAssocRequest( *pwPMKID = 0; // Initialize PMKID count pbyRSN += 2; // Point to PMKID list for (ii = 0; ii < pDevice->gsPMKID.BSSIDInfoCount; ii++) { - if (MEMEqualMemory(&pDevice->gsPMKID.BSSIDInfo[ii].BSSID[0], pMgmt->abyCurrBSSID, U_ETHER_ADDR_LEN)) { + if ( !memcmp(&pDevice->gsPMKID.BSSIDInfo[ii].BSSID[0], pMgmt->abyCurrBSSID, U_ETHER_ADDR_LEN)) { (*pwPMKID) ++; - MEMvCopy(pbyRSN, pDevice->gsPMKID.BSSIDInfo[ii].PMKID, 16); + memcpy(pbyRSN, pDevice->gsPMKID.BSSIDInfo[ii].PMKID, 16); pbyRSN += 16; } } @@ -4195,7 +4139,7 @@ s_MgrMakeReAssocRequest( sFrame.len += sFrame.pRSN->len + WLAN_IEHDR_LEN; // copy to AssocInfo. for OID_802_11_ASSOCIATION_INFORMATION pMgmt->sAssocInfo.AssocInfo.RequestIELength += sFrame.pRSN->len + WLAN_IEHDR_LEN; - MEMvCopy(pbyIEs, sFrame.pRSN, sFrame.pRSN->len + WLAN_IEHDR_LEN); + memcpy(pbyIEs, sFrame.pRSN, sFrame.pRSN->len + WLAN_IEHDR_LEN); pbyIEs += sFrame.pRSN->len + WLAN_IEHDR_LEN; } @@ -4269,7 +4213,7 @@ s_MgrMakeAssocResponse( if (((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len != 0) { sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN; - MEMvCopy(sFrame.pExtSuppRates, + memcpy(sFrame.pExtSuppRates, pCurrExtSuppRates, ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN ); @@ -4343,7 +4287,7 @@ s_MgrMakeReAssocResponse( if (((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len != 0) { sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN; - MEMvCopy(sFrame.pExtSuppRates, + memcpy(sFrame.pExtSuppRates, pCurrExtSuppRates, ((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN ); @@ -4395,13 +4339,13 @@ s_vMgrRxProbeResponse( (sFrame.pwCapInfo == 0) || (sFrame.pSSID == 0) || (sFrame.pSuppRates == 0)) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe resp:Fail addr:[%p] \n", pRxPacket->p80211Header); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe resp:Fail addr:[%p] \n", pRxPacket->p80211Header); DBG_PORT80(0xCC); return; }; if(sFrame.pSSID->len == 0) - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx Probe resp: SSID len = 0 \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx Probe resp: SSID len = 0 \n"); if (sFrame.pDSParms != 0) { if (byCurrChannel > CB_MAX_CHANNEL_24G) { @@ -4457,7 +4401,7 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==TRUE) ); } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Probe resp/insert: RxChannel = : %d\n", byCurrChannel); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Probe resp/insert: RxChannel = : %d\n", byCurrChannel); BSSbInsertToBSSList((HANDLE)pDevice, sFrame.pHdr->sA3.abyAddr3, *sFrame.pqwTimestamp, @@ -4517,7 +4461,7 @@ s_vMgrRxProbeRequest( sFrame.pBuf = (PBYTE)pRxPacket->p80211Header; vMgrDecodeProbeRequest(&sFrame); /* - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request rx:MAC addr:%02x-%02x-%02x=%02x-%02x-%02x \n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request rx:MAC addr:%02x-%02x-%02x=%02x-%02x-%02x \n", sFrame.pHdr->sA3.abyAddr2[0], sFrame.pHdr->sA3.abyAddr2[1], sFrame.pHdr->sA3.abyAddr2[2], @@ -4560,10 +4504,10 @@ s_vMgrRxProbeRequest( /* send the frame */ Status = csMgmt_xmit(pDevice, pTxPacket); if (Status != CMD_STATUS_PENDING) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Probe response tx failed\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Probe response tx failed\n"); } else { -// DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Probe response tx sending..\n"); +// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Probe response tx sending..\n"); } } } @@ -4613,7 +4557,7 @@ vMgrRxManagePacket( case WLAN_FSTYPE_ASSOCREQ: // Frame Clase = 2 - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx assocreq\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx assocreq\n"); if (eNodeState < NODE_AUTH) { // send deauth notification // reason = (6) class 2 received from nonauth sta @@ -4623,7 +4567,7 @@ vMgrRxManagePacket( (6), &Status ); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: send vMgrDeAuthenBeginSta 1\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: send vMgrDeAuthenBeginSta 1\n"); } else { s_vMgrRxAssocRequest(pDevice, pMgmt, pRxPacket, uNodeIndex); @@ -4632,14 +4576,14 @@ vMgrRxManagePacket( case WLAN_FSTYPE_ASSOCRESP: // Frame Clase = 2 - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx assocresp1\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx assocresp1\n"); s_vMgrRxAssocResponse(pDevice, pMgmt, pRxPacket, FALSE); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx assocresp2\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx assocresp2\n"); break; case WLAN_FSTYPE_REASSOCREQ: // Frame Clase = 2 - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx reassocreq\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx reassocreq\n"); // Todo: reassoc if (eNodeState < NODE_AUTH) { // send deauth notification @@ -4650,7 +4594,7 @@ vMgrRxManagePacket( (6), &Status ); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: send vMgrDeAuthenBeginSta 2\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: send vMgrDeAuthenBeginSta 2\n"); } s_vMgrRxReAssocRequest(pDevice, pMgmt, pRxPacket, uNodeIndex); @@ -4658,26 +4602,26 @@ vMgrRxManagePacket( case WLAN_FSTYPE_REASSOCRESP: // Frame Clase = 2 - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx reassocresp\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx reassocresp\n"); s_vMgrRxAssocResponse(pDevice, pMgmt, pRxPacket, TRUE); break; case WLAN_FSTYPE_PROBEREQ: // Frame Clase = 0 - //DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx probereq\n"); + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx probereq\n"); s_vMgrRxProbeRequest(pDevice, pMgmt, pRxPacket); break; case WLAN_FSTYPE_PROBERESP: // Frame Clase = 0 - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx proberesp\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx proberesp\n"); s_vMgrRxProbeResponse(pDevice, pMgmt, pRxPacket); break; case WLAN_FSTYPE_BEACON: // Frame Clase = 0 - // DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx beacon\n"); + //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx beacon\n"); if (pMgmt->eScanState != WMAC_NO_SCANNING) { bInScan = TRUE; }; @@ -4686,12 +4630,12 @@ vMgrRxManagePacket( case WLAN_FSTYPE_ATIM: // Frame Clase = 1 - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx atim\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx atim\n"); break; case WLAN_FSTYPE_DISASSOC: // Frame Clase = 2 - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx disassoc\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx disassoc\n"); if (eNodeState < NODE_AUTH) { // send deauth notification // reason = (6) class 2 received from nonauth sta @@ -4701,25 +4645,25 @@ vMgrRxManagePacket( (6), &Status ); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: send vMgrDeAuthenBeginSta 3\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: send vMgrDeAuthenBeginSta 3\n"); } s_vMgrRxDisassociation(pDevice, pMgmt, pRxPacket); break; case WLAN_FSTYPE_AUTHEN: // Frame Clase = 1 - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx authen\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx authen\n"); s_vMgrRxAuthentication(pDevice, pMgmt, pRxPacket); break; case WLAN_FSTYPE_DEAUTHEN: // Frame Clase = 1 - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx deauthen\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx deauthen\n"); s_vMgrRxDeauthentication(pDevice, pMgmt, pRxPacket); break; default: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx unknown mgmt\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx unknown mgmt\n"); } return; @@ -4802,46 +4746,46 @@ s_vMgrLogStatus( { switch( wStatus ){ case WLAN_MGMT_STATUS_UNSPEC_FAILURE: - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Unspecified error.\n"); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Unspecified error.\n"); break; case WLAN_MGMT_STATUS_CAPS_UNSUPPORTED: - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Can't support all requested capabilities.\n"); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Can't support all requested capabilities.\n"); break; case WLAN_MGMT_STATUS_REASSOC_NO_ASSOC: - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Reassoc denied, can't confirm original Association.\n"); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Reassoc denied, can't confirm original Association.\n"); break; case WLAN_MGMT_STATUS_ASSOC_DENIED_UNSPEC: - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, undefine in spec\n"); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, undefine in spec\n"); break; case WLAN_MGMT_STATUS_UNSUPPORTED_AUTHALG: - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Peer doesn't support authen algorithm.\n"); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Peer doesn't support authen algorithm.\n"); break; case WLAN_MGMT_STATUS_RX_AUTH_NOSEQ: - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Authen frame received out of sequence.\n"); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Authen frame received out of sequence.\n"); break; case WLAN_MGMT_STATUS_CHALLENGE_FAIL: - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Authen rejected, challenge failure.\n"); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Authen rejected, challenge failure.\n"); break; case WLAN_MGMT_STATUS_AUTH_TIMEOUT: - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Authen rejected, timeout waiting for next frame.\n"); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Authen rejected, timeout waiting for next frame.\n"); break; case WLAN_MGMT_STATUS_ASSOC_DENIED_BUSY: - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, AP too busy.\n"); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, AP too busy.\n"); break; case WLAN_MGMT_STATUS_ASSOC_DENIED_RATES: - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, we haven't enough basic rates.\n"); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, we haven't enough basic rates.\n"); break; case WLAN_MGMT_STATUS_ASSOC_DENIED_SHORTPREAMBLE: - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, we do not support short preamble.\n"); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, we do not support short preamble.\n"); break; case WLAN_MGMT_STATUS_ASSOC_DENIED_PBCC: - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, we do not support PBCC.\n"); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, we do not support PBCC.\n"); break; case WLAN_MGMT_STATUS_ASSOC_DENIED_AGILITY: - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, we do not support channel agility.\n"); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, we do not support channel agility.\n"); break; default: - DEVICE_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Unknown status code %d.\n", wStatus); + DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Unknown status code %d.\n", wStatus); break; } } @@ -4874,7 +4818,7 @@ bAdd_PMKID_Candidate ( PPMKID_CANDIDATE pCandidateList; UINT ii = 0; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"bAdd_PMKID_Candidate START: (%d)\n", (int)pDevice->gsPMKIDCandidate.NumCandidates); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"bAdd_PMKID_Candidate START: (%d)\n", (int)pDevice->gsPMKIDCandidate.NumCandidates); if ((pDevice == NULL) || (pbyBSSID == NULL) || (psRSNCapObj == NULL)) return FALSE; @@ -4887,7 +4831,7 @@ bAdd_PMKID_Candidate ( // Update Old Candidate for (ii = 0; ii < pDevice->gsPMKIDCandidate.NumCandidates; ii++) { pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[ii]; - if (MEMEqualMemory(pCandidateList->BSSID, pbyBSSID, U_ETHER_ADDR_LEN)) { + if ( !memcmp(pCandidateList->BSSID, pbyBSSID, U_ETHER_ADDR_LEN)) { if ((psRSNCapObj->bRSNCapExist == TRUE) && (psRSNCapObj->wRSNCap & BIT0)) { pCandidateList->Flags |= NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED; } else { @@ -4904,9 +4848,9 @@ bAdd_PMKID_Candidate ( } else { pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED); } - MEMvCopy(pCandidateList->BSSID, pbyBSSID, U_ETHER_ADDR_LEN); + memcpy(pCandidateList->BSSID, pbyBSSID, U_ETHER_ADDR_LEN); pDevice->gsPMKIDCandidate.NumCandidates++; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"NumCandidates:%d\n", (int)pDevice->gsPMKIDCandidate.NumCandidates); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"NumCandidates:%d\n", (int)pDevice->gsPMKIDCandidate.NumCandidates); return TRUE; } @@ -4934,7 +4878,7 @@ vFlush_PMKID_Candidate ( if (pDevice == NULL) return; - ZERO_MEMORY(&pDevice->gsPMKIDCandidate, sizeof(SPMKIDCandidateEvent)); + memset(&pDevice->gsPMKIDCandidate, 0, sizeof(SPMKIDCandidateEvent)); } static BOOL @@ -4953,7 +4897,6 @@ s_bCipherMatch ( return FALSE; // check cap. of BSS - if ((WLAN_GET_CAP_INFO_PRIVACY(pBSSNode->wCapInfo) != 0) && (EncStatus == Ndis802_11Encryption1Enabled)) { // default is WEP only @@ -4962,8 +4905,8 @@ s_bCipherMatch ( if ((WLAN_GET_CAP_INFO_PRIVACY(pBSSNode->wCapInfo) != 0) && (pBSSNode->bWPA2Valid == TRUE) && + //20080123-01,<Add> by Einsn Liu ((EncStatus == Ndis802_11Encryption3Enabled)||(EncStatus == Ndis802_11Encryption2Enabled))) { - //WPA2 // check Group Key Cipher if ((pBSSNode->byCSSGK == WLAN_11i_CSS_WEP40) || @@ -4993,10 +4936,10 @@ s_bCipherMatch ( i = pBSSNode->wCSSPKCount; } } + } else if ((WLAN_GET_CAP_INFO_PRIVACY(pBSSNode->wCapInfo) != 0) && (pBSSNode->bWPAValid == TRUE) && - ((EncStatus == Ndis802_11Encryption3Enabled)||(EncStatus == Ndis802_11Encryption2Enabled))) { - + ((EncStatus == Ndis802_11Encryption3Enabled) || (EncStatus == Ndis802_11Encryption2Enabled))) { //WPA // check Group Key Cipher if ((pBSSNode->byGKType == WPA_WEP40) || @@ -5024,11 +4967,12 @@ s_bCipherMatch ( } } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%d, %d, %d, %d, EncStatus:%d\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%d, %d, %d, %d, EncStatus:%d\n", byMulticastCipher, byCipherMask, pBSSNode->bWPAValid, pBSSNode->bWPA2Valid, EncStatus); // mask our cap. with BSS if (EncStatus == Ndis802_11Encryption1Enabled) { + // For supporting Cisco migration mode, don't care pairwise key cipher if ((byMulticastCipher == KEY_CTL_WEP) && (byCipherMask == 0)) { diff --git a/drivers/staging/vt6655/wmgr.h b/drivers/staging/vt6655/wmgr.h index 5b526ab..1c1f2ea 100644 --- a/drivers/staging/vt6655/wmgr.h +++ b/drivers/staging/vt6655/wmgr.h @@ -31,36 +31,17 @@ * */ - #ifndef __WMGR_H__ #define __WMGR_H__ -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif -#if !defined(__80211MGR_H__) #include "80211mgr.h" -#endif -#if !defined(__80211HDR_H__) #include "80211hdr.h" -#endif -#if !defined(__WCMD_H__) #include "wcmd.h" -#endif -#if !defined(__BSSDB_H__) #include "bssdb.h" -#endif -#if !defined(__CARD_H__) -#include "card.h" -#endif -#if !defined(__WPA2_H__) #include "wpa2.h" -#endif -#if !defined(__VNTWIFI_H__) #include "vntwifi.h" -#endif - - +#include "card.h" /*--------------------- Export Definitions -------------------------*/ @@ -143,7 +124,7 @@ typedef struct tagSAssocInfo { // store ReqIEs set by OID_802_11_ASSOCIATION_INFORMATION ULONG RequestIELength; BYTE abyReqIEs[WLAN_BEACON_FR_MAXLEN]; -} SAssocInfo, DEF* PSAssocInfo; +} SAssocInfo, *PSAssocInfo; //--- @@ -246,7 +227,7 @@ typedef struct tagSTxMgmtPacket { UINT cbMPDULen; UINT cbPayloadLen; -} STxMgmtPacket, DEF* PSTxMgmtPacket; +} STxMgmtPacket, *PSTxMgmtPacket; // Rx Managment Packet descriptor @@ -261,7 +242,7 @@ typedef struct tagSRxMgmtPacket { BYTE byRxRate; BYTE byRxChannel; -} SRxMgmtPacket, DEF* PSRxMgmtPacket; +} SRxMgmtPacket, *PSRxMgmtPacket; @@ -356,11 +337,11 @@ typedef struct tagSMgmtObject BOOL bRxBeaconInTBTTWake; BYTE abyPSTxMap[MAX_NODE_NUM + 1]; - // managment command related + // management command related UINT uCmdBusy; UINT uCmdHostAPBusy; - // managment packet pool + // management packet pool PBYTE pbyMgmtPacketPool; BYTE byMgmtPacketPool[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN]; @@ -409,7 +390,7 @@ typedef struct tagSMgmtObject struct sk_buff skb; -} SMgmtObject, DEF *PSMgmtObject; +} SMgmtObject, *PSMgmtObject; /*--------------------- Export Macros ------------------------------*/ diff --git a/drivers/staging/vt6655/wpa.c b/drivers/staging/vt6655/wpa.c index 8b4e7fc..f92d33f 100644 --- a/drivers/staging/vt6655/wpa.c +++ b/drivers/staging/vt6655/wpa.c @@ -32,38 +32,15 @@ * */ - -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif -#if !defined(__UMEM_H__) -#include "umem.h" -#endif -#if !defined(__TMACRO_H__) #include "tmacro.h" -#endif -#if !defined(__TETHER_H__) #include "tether.h" -#endif -#if !defined(__DEVICE_H__) #include "device.h" -#endif -#if !defined(__80211HDR_H__) #include "80211hdr.h" -#endif -#if !defined(__BSSDB_H__) #include "bssdb.h" -#endif -#if !defined(__WMGR_H__) #include "wmgr.h" -#endif -#if !defined(__WPA_H__) #include "wpa.h" -#endif -#if !defined(__80211MGR_H__) #include "80211mgr.h" -#endif - /*--------------------- Static Variables --------------------------*/ static int msglevel =MSG_LEVEL_INFO; @@ -139,47 +116,47 @@ WPA_ParseRSN ( WPA_ClearRSN(pBSSList); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"WPA_ParseRSN: [%d]\n", pRSN->len); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"WPA_ParseRSN: [%d]\n", pRSN->len); // information element header makes sense if ((pRSN->len >= 6) // oui1(4)+ver(2) - && (pRSN->byElementID == WLAN_EID_RSN_WPA) && MEMEqualMemory(pRSN->abyOUI, abyOUI01, 4) + && (pRSN->byElementID == WLAN_EID_RSN_WPA) && !memcmp(pRSN->abyOUI, abyOUI01, 4) && (pRSN->wVersion == 1)) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Legal RSN\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Legal RSN\n"); // update each variable if pRSN is long enough to contain the variable if (pRSN->len >= 10) //oui1(4)+ver(2)+GKSuite(4) { - if (MEMEqualMemory(pRSN->abyMulticast, abyOUI01, 4)) + if ( !memcmp(pRSN->abyMulticast, abyOUI01, 4)) pBSSList->byGKType = WPA_WEP40; - else if (MEMEqualMemory(pRSN->abyMulticast, abyOUI02, 4)) + else if ( !memcmp(pRSN->abyMulticast, abyOUI02, 4)) pBSSList->byGKType = WPA_TKIP; - else if (MEMEqualMemory(pRSN->abyMulticast, abyOUI03, 4)) + else if ( !memcmp(pRSN->abyMulticast, abyOUI03, 4)) pBSSList->byGKType = WPA_AESWRAP; - else if (MEMEqualMemory(pRSN->abyMulticast, abyOUI04, 4)) + else if ( !memcmp(pRSN->abyMulticast, abyOUI04, 4)) pBSSList->byGKType = WPA_AESCCMP; - else if (MEMEqualMemory(pRSN->abyMulticast, abyOUI05, 4)) + else if ( !memcmp(pRSN->abyMulticast, abyOUI05, 4)) pBSSList->byGKType = WPA_WEP104; else // any vendor checks here pBSSList->byGKType = WPA_NONE; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"byGKType: %x\n", pBSSList->byGKType); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"byGKType: %x\n", pBSSList->byGKType); } if (pRSN->len >= 12) //oui1(4)+ver(2)+GKS(4)+PKSCnt(2) { j = 0; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wPKCount: %d, sizeof(pBSSList->abyPKType): %d\n", pRSN->wPKCount, sizeof(pBSSList->abyPKType)); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wPKCount: %d, sizeof(pBSSList->abyPKType): %ld\n", pRSN->wPKCount, sizeof(pBSSList->abyPKType)); for(i = 0; (i < pRSN->wPKCount) && (j < sizeof(pBSSList->abyPKType)/sizeof(BYTE)); i++) { if(pRSN->len >= 12+i*4+4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*i) - if (MEMEqualMemory(pRSN->PKSList[i].abyOUI, abyOUI00, 4)) + if ( !memcmp(pRSN->PKSList[i].abyOUI, abyOUI00, 4)) pBSSList->abyPKType[j++] = WPA_NONE; - else if (MEMEqualMemory(pRSN->PKSList[i].abyOUI, abyOUI02, 4)) + else if ( !memcmp(pRSN->PKSList[i].abyOUI, abyOUI02, 4)) pBSSList->abyPKType[j++] = WPA_TKIP; - else if (MEMEqualMemory(pRSN->PKSList[i].abyOUI, abyOUI03, 4)) + else if ( !memcmp(pRSN->PKSList[i].abyOUI, abyOUI03, 4)) pBSSList->abyPKType[j++] = WPA_AESWRAP; - else if (MEMEqualMemory(pRSN->PKSList[i].abyOUI, abyOUI04, 4)) + else if ( !memcmp(pRSN->PKSList[i].abyOUI, abyOUI04, 4)) pBSSList->abyPKType[j++] = WPA_AESCCMP; else // any vendor checks here @@ -190,24 +167,24 @@ WPA_ParseRSN ( //DBG_PRN_GRP14(("abyPKType[%d]: %X\n", j-1, pBSSList->abyPKType[j-1])); } //for pBSSList->wPKCount = (WORD)j; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wPKCount: %d\n", pBSSList->wPKCount); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wPKCount: %d\n", pBSSList->wPKCount); } m = pRSN->wPKCount; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"m: %d\n", m); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"14+m*4: %d\n", 14+m*4); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"m: %d\n", m); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"14+m*4: %d\n", 14+m*4); if (pRSN->len >= 14+m*4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*m)+AKC(2) // overlay IE_RSN_Auth structure into correct place pIE_RSN_Auth = (PWLAN_IE_RSN_AUTH) pRSN->PKSList[m].abyOUI; j = 0; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wAuthCount: %d, sizeof(pBSSList->abyAuthType): %d\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wAuthCount: %d, sizeof(pBSSList->abyAuthType): %ld\n", pIE_RSN_Auth->wAuthCount, sizeof(pBSSList->abyAuthType)); for(i = 0; (i < pIE_RSN_Auth->wAuthCount) && (j < sizeof(pBSSList->abyAuthType)/sizeof(BYTE)); i++) { if(pRSN->len >= 14+4+(m+i)*4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*m)+AKC(2)+AKS(4*i) - if (MEMEqualMemory(pIE_RSN_Auth->AuthKSList[i].abyOUI, abyOUI01, 4)) + if ( !memcmp(pIE_RSN_Auth->AuthKSList[i].abyOUI, abyOUI01, 4)) pBSSList->abyAuthType[j++] = WPA_AUTH_IEEE802_1X; - else if (MEMEqualMemory(pIE_RSN_Auth->AuthKSList[i].abyOUI, abyOUI02, 4)) + else if ( !memcmp(pIE_RSN_Auth->AuthKSList[i].abyOUI, abyOUI02, 4)) pBSSList->abyAuthType[j++] = WPA_AUTH_PSK; else // any vendor checks here @@ -219,15 +196,15 @@ WPA_ParseRSN ( } if(j > 0) pBSSList->wAuthCount = (WORD)j; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wAuthCount: %d\n", pBSSList->wAuthCount); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wAuthCount: %d\n", pBSSList->wAuthCount); } if (pIE_RSN_Auth != NULL) { n = pIE_RSN_Auth->wAuthCount; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"n: %d\n", n); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"14+4+(m+n)*4: %d\n", 14+4+(m+n)*4); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"n: %d\n", n); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"14+4+(m+n)*4: %d\n", 14+4+(m+n)*4); if(pRSN->len+2 >= 14+4+(m+n)*4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*m)+AKC(2)+AKS(4*n)+Cap(2) pbyCaps = (PBYTE)pIE_RSN_Auth->AuthKSList[n].abyOUI; @@ -329,7 +306,7 @@ WPAb_Is_RSN ( return FALSE; if ((pRSN->len >= 6) && // oui1(4)+ver(2) - (pRSN->byElementID == WLAN_EID_RSN_WPA) && MEMEqualMemory(pRSN->abyOUI, abyOUI01, 4) && + (pRSN->byElementID == WLAN_EID_RSN_WPA) && !memcmp(pRSN->abyOUI, abyOUI01, 4) && (pRSN->wVersion == 1)) { return TRUE; } diff --git a/drivers/staging/vt6655/wpa.h b/drivers/staging/vt6655/wpa.h index 8000a37..9d9ce01 100644 --- a/drivers/staging/vt6655/wpa.h +++ b/drivers/staging/vt6655/wpa.h @@ -31,14 +31,8 @@ #ifndef __WPA_H__ #define __WPA_H__ - -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif -#if !defined(__80211HDR_H__) #include "80211hdr.h" -#endif - /*--------------------- Export Definitions -------------------------*/ @@ -63,9 +57,6 @@ /*--------------------- Export Functions --------------------------*/ -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ VOID WPA_ClearRSN( @@ -90,9 +81,4 @@ WPAb_Is_RSN( IN PWLAN_IE_RSN_EXT pRSN ); -#ifdef __cplusplus -} /* End of extern "C" { */ -#endif /* __cplusplus */ - - #endif // __WPA_H__ diff --git a/drivers/staging/vt6655/wpa2.c b/drivers/staging/vt6655/wpa2.c index e2fdb33..931b6bd 100644 --- a/drivers/staging/vt6655/wpa2.c +++ b/drivers/staging/vt6655/wpa2.c @@ -30,19 +30,10 @@ * Date: Oct. 4, 2004 * */ -#if !defined(__WPA2_H__) + #include "wpa2.h" -#endif -#if !defined(__UMEM_H__) -#include "umem.h" -#endif -#if !defined(__DEVICE_H__) #include "device.h" -#endif -#if !defined(__WMGR_H__) #include "wmgr.h" -#endif - /*--------------------- Static Definitions -------------------------*/ static int msglevel =MSG_LEVEL_INFO; @@ -127,7 +118,7 @@ WPA2vParseRSN ( PBYTE pbyOUI; BOOL bUseGK = FALSE; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"WPA2_ParseRSN: [%d]\n", pRSN->len); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"WPA2_ParseRSN: [%d]\n", pRSN->len); WPA2_ClearRSN(pBSSNode); @@ -147,25 +138,25 @@ WPA2vParseRSN ( if ((pRSN->byElementID == WLAN_EID_RSN) && (pRSN->wVersion == 1)) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Legal 802.11i RSN\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Legal 802.11i RSN\n"); pbyOUI = &(pRSN->abyRSN[0]); - if (MEMEqualMemory(pbyOUI, abyOUIWEP40, 4)) + if ( !memcmp(pbyOUI, abyOUIWEP40, 4)) pBSSNode->byCSSGK = WLAN_11i_CSS_WEP40; - else if (MEMEqualMemory(pbyOUI, abyOUITKIP, 4)) + else if ( !memcmp(pbyOUI, abyOUITKIP, 4)) pBSSNode->byCSSGK = WLAN_11i_CSS_TKIP; - else if (MEMEqualMemory(pbyOUI, abyOUICCMP, 4)) + else if ( !memcmp(pbyOUI, abyOUICCMP, 4)) pBSSNode->byCSSGK = WLAN_11i_CSS_CCMP; - else if (MEMEqualMemory(pbyOUI, abyOUIWEP104, 4)) + else if ( !memcmp(pbyOUI, abyOUIWEP104, 4)) pBSSNode->byCSSGK = WLAN_11i_CSS_WEP104; - else if (MEMEqualMemory(pbyOUI, abyOUIGK, 4)) { + else if ( !memcmp(pbyOUI, abyOUIGK, 4)) { // invalid CSS, P802.11i/D10.0, p32 return; } else // any vendor checks here pBSSNode->byCSSGK = WLAN_11i_CSS_UNKNOWN; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"802.11i CSS: %X\n", pBSSNode->byCSSGK); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"802.11i CSS: %X\n", pBSSNode->byCSSGK); if (pRSN->len == 6) { pBSSNode->bWPA2Valid = TRUE; @@ -180,26 +171,26 @@ WPA2vParseRSN ( for (i = 0; (i < pBSSNode->wCSSPKCount) && (j < sizeof(pBSSNode->abyCSSPK)/sizeof(BYTE)); i++) { if (pRSN->len >= 8+i*4+4) { // ver(2)+GK(4)+PKCnt(2)+PKS(4*i) - if (MEMEqualMemory(pbyOUI, abyOUIGK, 4)) { + if ( !memcmp(pbyOUI, abyOUIGK, 4)) { pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_USE_GROUP; bUseGK = TRUE; - } else if (MEMEqualMemory(pbyOUI, abyOUIWEP40, 4)) { + } else if ( !memcmp(pbyOUI, abyOUIWEP40, 4)) { // Invialid CSS, continue to parsing - } else if (MEMEqualMemory(pbyOUI, abyOUITKIP, 4)) { + } else if ( !memcmp(pbyOUI, abyOUITKIP, 4)) { if (pBSSNode->byCSSGK != WLAN_11i_CSS_CCMP) pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_TKIP; else ; // Invialid CSS, continue to parsing - } else if (MEMEqualMemory(pbyOUI, abyOUICCMP, 4)) { + } else if ( !memcmp(pbyOUI, abyOUICCMP, 4)) { pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_CCMP; - } else if (MEMEqualMemory(pbyOUI, abyOUIWEP104, 4)) { + } else if ( !memcmp(pbyOUI, abyOUIWEP104, 4)) { // Invialid CSS, continue to parsing } else { // any vendor checks here pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_UNKNOWN; } pbyOUI += 4; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyCSSPK[%d]: %X\n", j-1, pBSSNode->abyCSSPK[j-1]); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyCSSPK[%d]: %X\n", j-1, pBSSNode->abyCSSPK[j-1]); } else break; } //for @@ -219,7 +210,7 @@ WPA2vParseRSN ( return; } pBSSNode->wCSSPKCount = (WORD)j; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wCSSPKCount: %d\n", pBSSNode->wCSSPKCount); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wCSSPKCount: %d\n", pBSSNode->wCSSPKCount); } m = *((PWORD) &(pRSN->abyRSN[4])); @@ -230,19 +221,19 @@ WPA2vParseRSN ( pbyOUI = &(pRSN->abyRSN[8+4*m]); for (i = 0; (i < pBSSNode->wAKMSSAuthCount) && (j < sizeof(pBSSNode->abyAKMSSAuthType)/sizeof(BYTE)); i++) { if (pRSN->len >= 10+(m+i)*4+4) { // ver(2)+GK(4)+PKCnt(2)+PKS(4*m)+AKMSS(2)+AKS(4*i) - if (MEMEqualMemory(pbyOUI, abyOUI8021X, 4)) + if ( !memcmp(pbyOUI, abyOUI8021X, 4)) pBSSNode->abyAKMSSAuthType[j++] = WLAN_11i_AKMSS_802_1X; - else if (MEMEqualMemory(pbyOUI, abyOUIPSK, 4)) + else if ( !memcmp(pbyOUI, abyOUIPSK, 4)) pBSSNode->abyAKMSSAuthType[j++] = WLAN_11i_AKMSS_PSK; else // any vendor checks here pBSSNode->abyAKMSSAuthType[j++] = WLAN_11i_AKMSS_UNKNOWN; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyAKMSSAuthType[%d]: %X\n", j-1, pBSSNode->abyAKMSSAuthType[j-1]); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyAKMSSAuthType[%d]: %X\n", j-1, pBSSNode->abyAKMSSAuthType[j-1]); } else break; } pBSSNode->wAKMSSAuthCount = (WORD)j; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wAKMSSAuthCount: %d\n", pBSSNode->wAKMSSAuthCount); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wAKMSSAuthCount: %d\n", pBSSNode->wAKMSSAuthCount); n = *((PWORD) &(pRSN->abyRSN[6+4*m]));; if (pRSN->len >= 12+4*m+4*n) { // ver(2)+GK(4)+PKCnt(2)+PKS(4*m)+AKMSSCnt(2)+AKMSS(4*n)+Cap(2) @@ -340,7 +331,7 @@ WPA2uSetIEs( // RSN Capabilites if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist == TRUE) { - MEMvCopy(&pRSNIEs->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2); + memcpy(&pRSNIEs->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2); } else { pRSNIEs->abyRSN[16] = 0; pRSNIEs->abyRSN[17] = 0; @@ -355,9 +346,9 @@ WPA2uSetIEs( *pwPMKID = 0; // Initialize PMKID count pbyBuffer = &pRSNIEs->abyRSN[20]; // Point to PMKID list for (ii = 0; ii < pMgmt->gsPMKIDCache.BSSIDInfoCount; ii++) { - if (MEMEqualMemory(&pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyBSSID[0], pMgmt->abyCurrBSSID, U_ETHER_ADDR_LEN)) { + if ( !memcmp(&pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyBSSID[0], pMgmt->abyCurrBSSID, U_ETHER_ADDR_LEN)) { (*pwPMKID) ++; - MEMvCopy(pbyBuffer, pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyPMKID, 16); + memcpy(pbyBuffer, pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyPMKID, 16); pbyBuffer += 16; } } diff --git a/drivers/staging/vt6655/wpa2.h b/drivers/staging/vt6655/wpa2.h index bda045b..e553b38 100644 --- a/drivers/staging/vt6655/wpa2.h +++ b/drivers/staging/vt6655/wpa2.h @@ -31,26 +31,13 @@ #ifndef __WPA2_H__ #define __WPA2_H__ - -#if !defined(__TTYPE_H__) #include "ttype.h" -#endif -#if !defined(__80211MGR_H__) #include "80211mgr.h" -#endif -#if !defined(__80211HDR_H__) #include "80211hdr.h" -#endif -#if !defined(__BSSDB_H__) #include "bssdb.h" -#endif -#if !defined(__VNTWIFI_H__) -#include "vntwifi.h" -#endif - - /*--------------------- Export Definitions -------------------------*/ +#define MAX_PMKID_CACHE 16 typedef struct tagsPMKIDInfo { BYTE abyBSSID[6]; @@ -70,9 +57,6 @@ typedef struct tagSPMKIDCache { /*--------------------- Export Types ------------------------------*/ /*--------------------- Export Functions --------------------------*/ -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ VOID WPA2_ClearRSN ( @@ -91,10 +75,4 @@ WPA2uSetIEs( OUT PWLAN_IE_RSN pRSNIEs ); - -#ifdef __cplusplus -} /* End of extern "C" { */ -#endif /* __cplusplus */ - - #endif // __WPA2_H__ diff --git a/drivers/staging/vt6655/wpactl.c b/drivers/staging/vt6655/wpactl.c index cc4f0ad..574e0b0 100644 --- a/drivers/staging/vt6655/wpactl.c +++ b/drivers/staging/vt6655/wpactl.c @@ -16,6 +16,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + * * File: wpactl.c * * Purpose: handle wpa supplicant ioctl input/out functions @@ -30,32 +31,14 @@ * */ - -#if !defined(__WPACTL_H__) #include "wpactl.h" -#endif -#if !defined(__KEY_H__) #include "key.h" -#endif -#if !defined(__MAC_H__) #include "mac.h" -#endif -#if !defined(__DEVICE_H__) #include "device.h" -#endif -#if !defined(__WMGR_H__) #include "wmgr.h" -#endif -#if !defined(__IOCMD_H__) #include "iocmd.h" -#endif -#if !defined(__IOWPA_H__) #include "iowpa.h" -#endif -//2008-0717-05, <Add> by James -#if !defined(__RF_H__) #include "rf.h" -#endif /*--------------------- Static Definitions -------------------------*/ @@ -79,8 +62,6 @@ static int msglevel =MSG_LEVEL_INFO; /*--------------------- Export Variables --------------------------*/ - - static void wpadev_setup(struct net_device *dev) { dev->type = ARPHRD_IEEE80211; @@ -94,8 +75,6 @@ static void wpadev_setup(struct net_device *dev) dev->flags = IFF_BROADCAST|IFF_MULTICAST; } - - /* * Description: * register netdev for wpa supplicant deamon @@ -122,7 +101,6 @@ static int wpa_init_wpadev(PSDevice pDevice) wpadev_priv = netdev_priv(pDevice->wpadev); *wpadev_priv = *pDevice; - memcpy(pDevice->wpadev->dev_addr, dev->dev_addr, U_ETHER_ADDR_LEN); pDevice->wpadev->base_addr = dev->base_addr; pDevice->wpadev->irq = dev->irq; @@ -130,7 +108,7 @@ static int wpa_init_wpadev(PSDevice pDevice) pDevice->wpadev->mem_end = dev->mem_end; ret = register_netdev(pDevice->wpadev); if (ret) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: register_netdev(WPA) failed!\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: register_netdev(WPA) failed!\n", dev->name); free_netdev(pDevice->wpadev); return -1; @@ -142,7 +120,7 @@ static int wpa_init_wpadev(PSDevice pDevice) return -ENOMEM; } - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Registered netdev %s for WPA management\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Registered netdev %s for WPA management\n", dev->name, pDevice->wpadev->name); return 0; @@ -164,14 +142,13 @@ static int wpa_init_wpadev(PSDevice pDevice) static int wpa_release_wpadev(PSDevice pDevice) { - if (pDevice->skb) { dev_kfree_skb(pDevice->skb); pDevice->skb = NULL; } if (pDevice->wpadev) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Netdevice %s unregistered\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Netdevice %s unregistered\n", pDevice->dev->name, pDevice->wpadev->name); unregister_netdev(pDevice->wpadev); free_netdev(pDevice->wpadev); @@ -201,8 +178,6 @@ static int wpa_release_wpadev(PSDevice pDevice) int wpa_set_wpadev(PSDevice pDevice, int val) { - - if (val) return wpa_init_wpadev(pDevice); else @@ -224,9 +199,9 @@ int wpa_set_wpadev(PSDevice pDevice, int val) * */ -int wpa_set_keys(PSDevice pDevice, void *ctx, BOOL fcpfkernel) + int wpa_set_keys(PSDevice pDevice, void *ctx, BOOL fcpfkernel) { - struct viawget_wpa_param *param=ctx; + struct viawget_wpa_param *param=ctx; PSMgmtObject pMgmt = pDevice->pMgmt; DWORD dwKeyIndex = 0; BYTE abyKey[MAX_KEY_LEN]; @@ -241,7 +216,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, BOOL fcpfkernel) if (param->u.wpa_key.alg_name > WPA_ALG_CCMP) return -EINVAL; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "param->u.wpa_key.alg_name = %d \n", param->u.wpa_key.alg_name); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "param->u.wpa_key.alg_name = %d \n", param->u.wpa_key.alg_name); if (param->u.wpa_key.alg_name == WPA_ALG_NONE) { pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; pDevice->bEncryptionEnable = FALSE; @@ -261,8 +236,8 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, BOOL fcpfkernel) else { spin_unlock_irq(&pDevice->lock); if (param->u.wpa_key.key && - copy_from_user(&abyKey[0], param->u.wpa_key.key, param->u.wpa_key.key_len)){ - spin_lock_irq(&pDevice->lock); + copy_from_user(&abyKey[0], param->u.wpa_key.key, param->u.wpa_key.key_len)) { + spin_lock_irq(&pDevice->lock); return -EINVAL; } spin_lock_irq(&pDevice->lock); @@ -302,9 +277,8 @@ spin_lock_irq(&pDevice->lock); else { spin_unlock_irq(&pDevice->lock); if (param->u.wpa_key.seq && - copy_from_user(&abySeq[0], param->u.wpa_key.seq, param->u.wpa_key.seq_len)){ - - spin_lock_irq(&pDevice->lock); + copy_from_user(&abySeq[0], param->u.wpa_key.seq, param->u.wpa_key.seq_len)) { + spin_lock_irq(&pDevice->lock); return -EINVAL; } spin_lock_irq(&pDevice->lock); @@ -322,7 +296,7 @@ spin_lock_irq(&pDevice->lock); } if (param->u.wpa_key.key_index >= MAX_GROUP_KEY) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "return dwKeyIndex > 3\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "return dwKeyIndex > 3\n"); return -EINVAL; } @@ -337,6 +311,7 @@ spin_lock_irq(&pDevice->lock); if (param->u.wpa_key.set_tx) dwKeyIndex |= (1 << 31); + if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) byKeyDecMode = KEY_CTL_CCMP; else if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) @@ -359,13 +334,12 @@ spin_lock_irq(&pDevice->lock); byKeyDecMode = KEY_CTL_WEP; } - // Check TKIP key length if ((byKeyDecMode == KEY_CTL_TKIP) && (param->u.wpa_key.key_len != MAX_KEY_LEN)) { // TKIP Key must be 256 bits //DBG_PRN_WLAN03(("return NDIS_STATUS_INVALID_DATA - TKIP Key must be 256 bits\n")); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "return- TKIP Key must be 256 bits!\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "return- TKIP Key must be 256 bits!\n"); return -EINVAL; } // Check AES key length @@ -379,7 +353,7 @@ spin_lock_irq(&pDevice->lock); // spin_lock_irq(&pDevice->lock); if (IS_BROADCAST_ADDRESS(¶m->addr[0]) || (param->addr == NULL)) { // If IS_BROADCAST_ADDRESS, set the key as every key entry's group key. - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Groupe Key Assign.\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Groupe Key Assign.\n"); if ((KeybSetAllGroupKey(&(pDevice->sKey), dwKeyIndex, @@ -397,7 +371,7 @@ spin_lock_irq(&pDevice->lock); byKeyDecMode, pDevice->PortOffset, pDevice->byLocalID) == TRUE) ) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "GROUP Key Assign.\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "GROUP Key Assign.\n"); } else { //DBG_PRN_WLAN03(("return NDIS_STATUS_INVALID_DATA -KeybSetDefaultKey Fail.0\n")); @@ -406,11 +380,11 @@ spin_lock_irq(&pDevice->lock); } } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key Assign.\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key Assign.\n"); // BSSID not 0xffffffffffff // Pairwise Key can't be WEP if (byKeyDecMode == KEY_CTL_WEP) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key can't be WEP\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key can't be WEP\n"); //spin_unlock_irq(&pDevice->lock); return -EINVAL; } @@ -430,7 +404,7 @@ spin_lock_irq(&pDevice->lock); byKeyDecMode, pDevice->PortOffset, pDevice->byLocalID) == TRUE) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key Set\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key Set\n"); } else { // Key Table Full @@ -455,7 +429,7 @@ spin_lock_irq(&pDevice->lock); //spin_unlock_irq(&pDevice->lock); /* - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " key=%x-%x-%x-%x-%x-xxxxx \n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " key=%x-%x-%x-%x-%x-xxxxx \n", pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[byKeyIndex][0], pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[byKeyIndex][1], pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[byKeyIndex][2], @@ -752,7 +726,7 @@ static int wpa_get_scan(PSDevice pDevice, ret = -EFAULT; }; param->u.scan_results.scan_count = count; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO " param->u.scan_results.scan_count = %d\n", count) + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " param->u.scan_results.scan_count = %d\n", count) kfree(pBuf); return ret; @@ -785,12 +759,12 @@ static int wpa_set_associate(PSDevice pDevice, BOOL bWepEnabled=FALSE; // set key type & algorithm - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pairwise_suite = %d\n", param->u.wpa_associate.pairwise_suite); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "group_suite = %d\n", param->u.wpa_associate.group_suite); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "key_mgmt_suite = %d\n", param->u.wpa_associate.key_mgmt_suite); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "auth_alg = %d\n", param->u.wpa_associate.auth_alg); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "mode = %d\n", param->u.wpa_associate.mode); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ie_len = %d\n", param->u.wpa_associate.wpa_ie_len); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pairwise_suite = %d\n", param->u.wpa_associate.pairwise_suite); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "group_suite = %d\n", param->u.wpa_associate.group_suite); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "key_mgmt_suite = %d\n", param->u.wpa_associate.key_mgmt_suite); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "auth_alg = %d\n", param->u.wpa_associate.auth_alg); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "mode = %d\n", param->u.wpa_associate.mode); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ie_len = %d\n", param->u.wpa_associate.wpa_ie_len); if (param->u.wpa_associate.wpa_ie && @@ -943,59 +917,59 @@ int wpa_ioctl(PSDevice pDevice, struct iw_point *p) switch (param->cmd) { case VIAWGET_SET_WPA: ret = wpa_set_wpa(pDevice, param); - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_WPA \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_WPA \n"); break; case VIAWGET_SET_KEY: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_KEY \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_KEY \n"); spin_lock_irq(&pDevice->lock); ret = wpa_set_keys(pDevice, param, FALSE); spin_unlock_irq(&pDevice->lock); break; case VIAWGET_SET_SCAN: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_SCAN \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_SCAN \n"); ret = wpa_set_scan(pDevice, param); break; case VIAWGET_GET_SCAN: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_SCAN\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_SCAN\n"); ret = wpa_get_scan(pDevice, param); wpa_ioctl = 1; break; case VIAWGET_GET_SSID: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_SSID \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_SSID \n"); ret = wpa_get_ssid(pDevice, param); wpa_ioctl = 1; break; case VIAWGET_GET_BSSID: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_BSSID \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_BSSID \n"); ret = wpa_get_bssid(pDevice, param); wpa_ioctl = 1; break; case VIAWGET_SET_ASSOCIATE: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_ASSOCIATE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_ASSOCIATE \n"); ret = wpa_set_associate(pDevice, param); break; case VIAWGET_SET_DISASSOCIATE: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DISASSOCIATE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DISASSOCIATE \n"); ret = wpa_set_disassociate(pDevice, param); break; case VIAWGET_SET_DROP_UNENCRYPT: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DROP_UNENCRYPT \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DROP_UNENCRYPT \n"); break; case VIAWGET_SET_DEAUTHENTICATE: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DEAUTHENTICATE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DEAUTHENTICATE \n"); break; default: - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ioctl: unknown cmd=%d\n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ioctl: unknown cmd=%d\n", param->cmd); return -EOPNOTSUPP; break; diff --git a/drivers/staging/vt6655/wpactl.h b/drivers/staging/vt6655/wpactl.h index 9e78897..b0d92d5 100644 --- a/drivers/staging/vt6655/wpactl.h +++ b/drivers/staging/vt6655/wpactl.h @@ -26,18 +26,13 @@ * */ - #ifndef __WPACTL_H__ #define __WPACTL_H__ -#if !defined(__DEVICE_H__) #include "device.h" -#endif #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT -#if !defined(__IOWPA_H__) #include "iowpa.h" #endif -#endif /*--------------------- Export Definitions -------------------------*/ @@ -67,22 +62,10 @@ typedef ULONGLONG NDIS_802_11_KEY_RSC; /*--------------------- Export Functions --------------------------*/ - -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ - int wpa_set_wpadev(PSDevice pDevice, int val); int wpa_ioctl(PSDevice pDevice, struct iw_point *p); int wpa_set_keys(PSDevice pDevice, void *ctx, BOOL fcpfkernel); -#ifdef __cplusplus -} /* End of extern "C" { */ -#endif /* __cplusplus */ - - - - #endif // __WPACL_H__ diff --git a/drivers/staging/vt6655/wroute.c b/drivers/staging/vt6655/wroute.c index 219ae21..ab99161 100644 --- a/drivers/staging/vt6655/wroute.c +++ b/drivers/staging/vt6655/wroute.c @@ -31,25 +31,13 @@ * */ - -#if !defined(__MAC_H__) #include "mac.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(__CARD_H__) #include "card.h" -#endif -#if !defined(__BASEBAND_H__) #include "baseband.h" -#endif + /*--------------------- Static Definitions -------------------------*/ /*--------------------- Static Classes ----------------------------*/ @@ -83,7 +71,7 @@ BOOL ROUTEbRelay (PSDevice pDevice, PBYTE pbySkbData, UINT uDataLen, UINT uNodeI PSTxDesc pHeadTD, pLastTD; UINT cbFrameBodySize; UINT uMACfragNum; - BYTE byPktTyp; + BYTE byPktType; BOOL bNeedEncryption = FALSE; SKeyItem STempKey; PSKeyItem pTransmitKey = NULL; @@ -95,7 +83,7 @@ BOOL ROUTEbRelay (PSDevice pDevice, PBYTE pbySkbData, UINT uDataLen, UINT uNodeI if (AVAIL_TD(pDevice, TYPE_AC0DMA)<=0) { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Relay can't allocate TD1..\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Relay can't allocate TD1..\n"); return FALSE; } @@ -118,9 +106,9 @@ BOOL ROUTEbRelay (PSDevice pDevice, PBYTE pbySkbData, UINT uDataLen, UINT uNodeI pbyBSSID = pDevice->abyBroadcastAddr; if(KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == FALSE) { pTransmitKey = NULL; - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"KEY is NULL. [%d]\n", pDevice->pMgmt->eCurrMode); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"KEY is NULL. [%d]\n", pDevice->pMgmt->eCurrMode); } else { - DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"Get GTK.\n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"Get GTK.\n"); } } @@ -144,7 +132,7 @@ BOOL ROUTEbRelay (PSDevice pDevice, PBYTE pbySkbData, UINT uDataLen, UINT uNodeI if (uMACfragNum > AVAIL_TD(pDevice,TYPE_AC0DMA)) { return FALSE; } - byPktTyp = (BYTE)pDevice->byPacketType; + byPktType = (BYTE)pDevice->byPacketType; if (pDevice->bFixRate) { if (pDevice->eCurrentPHYType == PHY_TYPE_11B) { @@ -170,9 +158,9 @@ BOOL ROUTEbRelay (PSDevice pDevice, PBYTE pbySkbData, UINT uDataLen, UINT uNodeI } if (pDevice->wCurrentRate <= RATE_11M) - byPktTyp = PK_TYPE_11B; + byPktType = PK_TYPE_11B; - vGenerateFIFOHeader(pDevice, byPktTyp, pDevice->pbyTmpBuff, bNeedEncryption, + vGenerateFIFOHeader(pDevice, byPktType, pDevice->pbyTmpBuff, bNeedEncryption, cbFrameBodySize, TYPE_AC0DMA, pHeadTD, &pDevice->sTxEthHeader, pbySkbData, pTransmitKey, uNodeIndex, &uMACfragNum, diff --git a/drivers/staging/vt6655/wroute.h b/drivers/staging/vt6655/wroute.h index ea5f589..295cdc5 100644 --- a/drivers/staging/vt6655/wroute.h +++ b/drivers/staging/vt6655/wroute.h @@ -26,16 +26,10 @@ * */ - #ifndef __WROUTE_H__ #define __WROUTE_H__ - -#if !defined(__DEVICE_H__) #include "device.h" -#endif - - /*--------------------- Export Definitions -------------------------*/ @@ -45,20 +39,8 @@ /*--------------------- Export Functions --------------------------*/ - -#ifdef __cplusplus -extern "C" { /* Assume C declarations for C++ */ -#endif /* __cplusplus */ - BOOL ROUTEbRelay (PSDevice pDevice, PBYTE pbySkbData, UINT uDataLen, UINT uNodeIndex); -#ifdef __cplusplus -} /* End of extern "C" { */ -#endif /* __cplusplus */ - - - - #endif // __WROUTE_H__ |